Import cmake 2.8.2-rc3.

ci/unstable
Modestas Vainius 15 years ago
parent 06aa077526
commit 328faf3cf3

@ -27,16 +27,9 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_PACKAGE_VENDOR "Kitware") SET(CPACK_PACKAGE_VENDOR "Kitware")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${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 "${CMake_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME SET(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
"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)
IF(NOT DEFINED CPACK_SYSTEM_NAME) IF(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just # make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name # cygwin is good for the system name
@ -73,22 +66,11 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# cygwin specific packaging stuff # cygwin specific packaging stuff
IF(CYGWIN) 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 # setup the cygwin package name
SET(CPACK_PACKAGE_NAME cmake) SET(CPACK_PACKAGE_NAME cmake)
# setup the name of the package for cygwin cmake-2.4.3 # setup the name of the package for cygwin cmake-2.4.3
SET(CPACK_PACKAGE_FILE_NAME 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 # the source has the same name as the binary
SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
# Create a cygwin version number in case there are changes for cygwin # Create a cygwin version number in case there are changes for cygwin

@ -79,11 +79,6 @@ MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES)
CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib"
${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON) ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON)
# There is currently no option for system tar because the upstream
# libtar does not have our modifications to allow reentrant
# object-oriented use of the library.
# OPTION(CMAKE_USE_SYSTEM_TAR "Use system-installed tar" OFF)
# Mention to the user what system libraries are being used. # Mention to the user what system libraries are being used.
FOREACH(util CURL EXPAT XMLRPC ZLIB) FOREACH(util CURL EXPAT XMLRPC ZLIB)
IF(CMAKE_USE_SYSTEM_${util}) IF(CMAKE_USE_SYSTEM_${util})
@ -248,24 +243,40 @@ MACRO (CMAKE_BUILD_UTILITIES)
ENDIF(NOT CMAKE_BUILD_CURL_SHARED) ENDIF(NOT CMAKE_BUILD_CURL_SHARED)
SET(CMAKE_CURL_INCLUDES) SET(CMAKE_CURL_INCLUDES)
SET(CMAKE_CURL_LIBRARIES cmcurl) SET(CMAKE_CURL_LIBRARIES cmcurl)
IF(CMAKE_TESTS_CDASH_SERVER)
SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php")
ENDIF(CMAKE_TESTS_CDASH_SERVER)
ADD_SUBDIRECTORY(Utilities/cmcurl) ADD_SUBDIRECTORY(Utilities/cmcurl)
ENDIF(CMAKE_USE_SYSTEM_CURL) ENDIF(CMAKE_USE_SYSTEM_CURL)
#---------------------------------------------------------------------
# Build Tar library for CTest.
SET(CMTAR_ZLIB_HEADER ${CMAKE_ZLIB_HEADER})
SET(CMTAR_ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES})
SET(CMTAR_ZLIB_INCLUDE_DIRS ${CMAKE_ZLIB_INCLUDES})
SET(CMAKE_TAR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar)
SET(CMAKE_TAR_LIBRARIES cmtar)
SUBDIRS(Utilities/cmtar)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build Compress library for CTest. # Build Compress library for CTest.
SET(CMAKE_COMPRESS_INCLUDES SET(CMAKE_COMPRESS_INCLUDES
"${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress") "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
ADD_SUBDIRECTORY(Utilities/cmcompress) ADD_SUBDIRECTORY(Utilities/cmcompress)
IF(CMAKE_USE_SYSTEM_BZIP2)
FIND_PACKAGE(BZip2)
ELSE()
SET(BZIP2_INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2")
SET(BZIP2_LIBRARIES cmbzip2)
ADD_SUBDIRECTORY(Utilities/cmbzip2)
ENDIF()
IF(CMAKE_USE_SYSTEM_LIBARCHIVE)
FIND_PACKAGE(libarchive)
SET(CMAKE_TAR_LIBRARIES libarchive)
ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE)
SET(HAVE_LIBZ 1)
SET(HAVE_ZLIB_H 1)
SET(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES})
SET(ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES})
SET(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES})
SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE)
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
ADD_SUBDIRECTORY(Utilities/cmlibarchive)
SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES})
ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Build expat library for CMake and CTest. # Build expat library for CMake and CTest.
@ -328,20 +339,37 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
# The CMake version number. # The CMake version number.
SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_MINOR 8)
SET(CMake_VERSION_PATCH 1) SET(CMake_VERSION_PATCH 2)
#SET(CMake_VERSION_RC 5) SET(CMake_VERSION_TWEAK 0)
SET(CMake_VERSION_RC 3)
# Releases define a tweak level.
IF(DEFINED CMake_VERSION_TWEAK)
SET(CMake_VERSION_IS_RELEASE 1)
SET(CMake_VERSION_SOURCE "")
ELSE()
SET(CMake_VERSION_IS_RELEASE 0)
# We use odd minor numbers for development versions. # Use the date as the tweak level.
# Use a date for the development patch level.
IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$")
INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake) 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}" "${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}") INCLUDE(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake)
SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}") 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 # Include the standard Dart testing module
ENABLE_TESTING() ENABLE_TESTING()
@ -361,13 +389,24 @@ SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
# install tree. # install tree.
SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") 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).") "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).") "Install location for documentation (relative to prefix).")
SET(CMAKE_MAN_DIR "/man" CACHE STRING SET(CMAKE_MAN_DIR "/man" CACHE STRING
"Install location for man pages (relative to prefix).") "Install location for man pages (relative to prefix).")
MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR) 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_DATA_DEST "${CMAKE_DATA_DIR}")
STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}") STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}")
@ -383,6 +422,23 @@ INCLUDE(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
# CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
#
# If not defined or "", this variable defaults to the server at
# http://www.cdash.org/CDash.
#
# If set explicitly to "NOTFOUND", curl tests and ctest tests that use
# the network are skipped.
#
# If set to something starting with "http://localhost/", the CDash is
# expected to be an instance of CDash used for CDash testing, pointing
# to a cdash4simpletest database. In these cases, the CDash dashboards
# should be run first.
#
IF("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
SET(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash")
ENDIF("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
# build the utilities (a macro defined in this file) # build the utilities (a macro defined in this file)
CMAKE_BUILD_UTILITIES() CMAKE_BUILD_UTILITIES()

@ -10,7 +10,7 @@
# See the License for more information. # See the License for more information.
#============================================================================= #=============================================================================
set(CTEST_PROJECT_NAME "CMake") set(CTEST_PROJECT_NAME "CMake")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
set(CTEST_DROP_METHOD "http") set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_SITE "www.cdash.org")

@ -12,22 +12,34 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"not sorted slower link editing will result" "not sorted slower link editing will result"
"stl_deque.h:479" "stl_deque.h:479"
"Utilities.cmzlib." "Utilities.cmzlib."
"Utilities.cmbzip2."
"Source.CTest.Curl" "Source.CTest.Curl"
"Source.CursesDialog.form" "Source.CursesDialog.form"
"Utilities.cmcurl" "Utilities.cmcurl"
"Utilities.cmexpat." "Utilities.cmexpat."
"Utilities.cmtar" "Utilities.cmlibarchive"
"/usr/include.*warning.*shadowed declaration is here" "/usr/include.*warning.*shadowed declaration is here"
"/usr/bin/ld.*warning.*-..*directory.name.*bin.*does not exist" "/usr/bin/ld.*warning.*-..*directory.name.*bin.*does not exist"
"Redeclaration of .send..... with a different storage class specifier" "Redeclaration of .send..... with a different storage class specifier"
"is not used for resolving any symbol" "is not used for resolving any symbol"
"Clock skew detected" "Clock skew detected"
"remark\\(1209" "remark\\(1209"
"LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF"
"Warning: library was too large for page size.*"
"Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*"
"Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*"
"Warning: public.*_archive.*clashes with prior module.*"
"Warning: LINN32: Last line.*is less.*"
"warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*"
"stl_deque.h:1051" "stl_deque.h:1051"
"(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)"
"[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value" "[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value"
"Parser.cxx.*warning.*2111-D.*statement is unreachable" "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" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element"
"cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast
) )
IF(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") IF(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")

@ -1,3 +1,133 @@
Changes in CMake 2.8.2-rc3 (since 2.8.2-rc2)
--------------------------------------------
Brad King (1):
Preserve ENV{MAKEFLAGS} in CMake script mode
David Cole (4):
Remove "Microsoft Visual Studio .NET" from VS8 and VS9 find modules.
Use full path file names in generate.stamp.list.
Use full path file names to express dependencies.
Look in the ctest ini file for GitCommand.
James Bigler (2):
Fixed: CUDA_VERSION_MAJOR/MINOR now computed after first run.
CUDA_VERSION variable passed to REGEX needs quotes to work when not defined.
Mathieu Malaterre (1):
Cleanup FindDCMTK (using foreach). Fix linking on win32 static libs.
Zach Mullen (2):
Do not exit if stoptime is passed.
Document ctest_build() TARGET option
Changes in CMake 2.8.2-rc2 (since 2.8.2-rc1)
--------------------------------------------
Bill Hoffman (1):
Make sure libarchive uses cmzlib and not the system libz if found.
Brad King (12):
Use forward slashes for objects in response files
Use platform variable for response file flag
Use response file for objects on MinGW and MSYS
Generalize CTest.Update* test dashboard script helpers
ctest_update: Support custom Git update command
ctest_update: Support Git upstream branch rewrites
Fix CMake data and doc paths in Cygwin package
Document scope of source file properties
Run CTest.NoNewline test using built CMake
Tru64: Place cmOStringStream vtable uniquely (#10541)
Enable BootstrapTest on MSYS
Tru64: Use full-path include directives in Makefiles (#10569)
Christoph Watzl (1):
Fix nested source groups with VS 10 (#9863)
Clinton Stimpson (2):
Support pthreads on irix.
Remove macro for querying qmake for qmake variables.
David Cole (2):
Fix issue #10346. Error if SOURCE_DIR is empty.
Remove CTestTest3.
Zach Mullen (1):
Extra coverage glob should subtract the explicitly defined excluded files
Changes in CMake 2.8.2-rc1 (since 2.8.1):
- Build on Tru64 (#10542)
- Build on mingw-w64
- Build on old Sun (#10550, #10543)
- CPack: Add native BZip2 support
- CPack: Set compression type in RPM spec (#10363)
- CPack: Try harder to initialize staging directory (#10793)
- CTest: Add --stop-time argument
- CTest: Cost data with '-j'
- CTest: Fix memory report
- CTest: Glob for uncovered files during coverage tests
- CTest: Option to specify cdash server
- CTest: PHP Coverage support
- CTest: Process tree kill for OpenBSD, FreeBSD, kFreeBSD, GNU/Hurd
- CTest: Report failure in Update.xml
- CTest: Submit author email in Update.xml
- CTest: Teach ctest_update about Git submodules
- CTest: Teach ctest_update to handle Git upstream branch rewrites
- Cygwin: Export all symbols with ENABLE_EXPORTS (#10122)
- Do not list file names during 'cmake -E tar xz'
- Documentation: Comply with "XHTML 1.0 Strict"
- Documentation: Fix typo in CMAKE_LIBRARY_PATH (#10291)
- Documentation: Fix typo in HAS_CXX docs (#10578)
- Documentation: More consistent command signatures
- Eclipse: Do not add INCLUDE to environment twice
- Enable extra CodeBlocks generator on Cygwin
- ExternalProject: Support .zip and .bz2 archives, MD5 verification
- ExternalProject: Reconfigure when args change (#10258)
- ExternalProject: Support Git, SVN username/password
- FindCurses: Fix for cygwin ncurses package
- FindHSPELL: Version support
- FindJava: Error if version is not found only when REQUIRED
- FindJava: Support runtime and development components (#9840)
- FindKDE4: Prefer kdeconfig results over system paths
- FindMPEG: Check for 'vo' library
- FindPNG: Support png 1.4 versioned lib names (#10551)
- FindPkgConfig: Add QUIET keyword to pkgconfig macros (see #10469)
- FindZLIB: GnuWin32 support, version support (#5588)
- FindwxWidget: Fix CXX flag parsing (#10209)
- Fix .pdb name attribute in VS project files (#10614)
- Fix CodeBlocks to work with Fortran-only
- Fix VS 2010 custom commands (#10503)
- Fix VS 6 support for COMPILE_DEFINITIONS_MINSIZEREL (#10700)
- Fix cross-compiling from Linux to iPhone (#10526)
- Fix documentation typos
- Fix g95 Fortran compiler support
- Fix uname masking in file(WRITE) and write_file (#10789)
- GetPrerequisites: Provide an override hook
- Handle non-ASCII terminators in file(STRINGS)
- Module fixes: FindPythonLibs, FindQt4, FindX11, FindwxWidgets
- PathScale Fortran compiler tool detection
- Qt4 OpenGL framework fix
- Qt4ConfigDependentSettings.cmake Qt4Macros.cmake UseQt4.cmake
- Recognize ARM ABI/EABI with GNU compilers
- Recognize Clang compiler
- Search basic directories on "Generic" platform
- Set MSVC* variables consistently on all generators, and test
- Support SunPro C++ 5.11 on Linux (new compiler)
- Support VS 10 Express (related to #10670)
- Support compression with 'cmake -E tar'
- Support multiple arguments in CC,CXX,FC environment variables
- Support per-configuration librarian flags (#10768)
- Support per-platform initial ASM language flags (#10577)
- Use Fortran ABI detection results conservatively
- Use libarchive to replace the unmaintained libtar
- UseQt4: Support QtMultimedia (#10675)
- bootstrap: Fix make tool detection (#10544)
- cmake-gui: Add simple grouped view
- cmake-gui: Support build tree under symlink (#9975)
- Cleanup modules FindASPELL, FindAVIFile, FindBZip2, FindDart,
FindEXPAT, FindGCCXML, FindGLU, FindHSPELL, FindJasper, FindLibXml2,
FindLibXslt, FindMPEG, FindOpenAL, FindPhysFS, FindQuickTime,
FindSubversion, FindZLIB.
Changes in CMake 2.8.1 Changes in CMake 2.8.1
- Fix failing test on cygwin - Fix failing test on cygwin
- Add a new serach path for MPICH2 - Add a new serach path for MPICH2

@ -42,10 +42,45 @@ IF(NOT _INCLUDED_FILE)
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL)
ENDIF(NOT _INCLUDED_FILE) ENDIF(NOT _INCLUDED_FILE)
# Set default assembler file extensions:
IF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) IF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
# avoid just having a space as the initial value for the cache
IF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT)
ENDIF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ")
SET (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING
"Flags used by the assembler during all build types.")
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
IF(NOT CMAKE_NO_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
"Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT CMAKE_NO_BUILD_TYPE)
SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the assembler during debug builds.")
SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING
"Flags used by the assembler during release minsize builds.")
SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING
"Flags used by the assembler during release builds.")
SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
"Flags used by the assembler during Release with Debug Info builds.")
ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS
CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG
CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL
CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE
CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO
)
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>") SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)

@ -9,6 +9,9 @@
#if defined(__INTEL_COMPILER) || defined(__ICC) #if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel" # define COMPILER_ID "Intel"
#elif defined(__clang__)
# define COMPILER_ID "Clang"
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
# define COMPILER_ID "Borland" # define COMPILER_ID "Borland"

@ -11,6 +11,9 @@
#elif defined(__INTEL_COMPILER) || defined(__ICC) #elif defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel" # define COMPILER_ID "Intel"
#elif defined(__clang__)
# define COMPILER_ID "Clang"
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
# define COMPILER_ID "Borland" # define COMPILER_ID "Borland"

@ -17,6 +17,16 @@ const char info_sizeof_dptr[] = {
# define ABI_ID "ELF N32" # define ABI_ID "ELF N32"
#elif defined(__sgi) && defined(_ABI64) #elif defined(__sgi) && defined(_ABI64)
# define ABI_ID "ELF 64" # define ABI_ID "ELF 64"
/* Check for (some) ARM ABIs.
* See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
# define ABI_ID "ELF ARMEABI"
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
# define ABI_ID "ELF ARM"
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__)
# define ABI_ID "ELF ARM"
#elif defined(__ELF__) #elif defined(__ELF__)
# define ABI_ID "ELF" # define ABI_ID "ELF"
#endif #endif

@ -49,12 +49,10 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
IF(ABI_SIZEOF_DPTR) IF(ABI_SIZEOF_DPTR)
SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE) SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
SET(CMAKE_SIZEOF_VOID_P "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
ENDIF(ABI_SIZEOF_DPTR) ENDIF(ABI_SIZEOF_DPTR)
IF(ABI_NAME) IF(ABI_NAME)
SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE) SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${ABI_NAME}" PARENT_SCOPE)
ENDIF(ABI_NAME) ENDIF(ABI_NAME)
# Parse implicit linker information for this language, if available. # Parse implicit linker information for this language, if available.

@ -19,6 +19,7 @@
FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
# Make sure the compiler arguments are clean. # Make sure the compiler arguments are clean.
STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1) STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1)
STRING(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}")
# Make sure user-specified compiler flags are used. # Make sure user-specified compiler flags are used.
IF(CMAKE_${lang}_FLAGS) IF(CMAKE_${lang}_FLAGS)

@ -49,6 +49,7 @@ IF(NOT CMAKE_Fortran_COMPILER)
# gfortran: putative GNU Fortran 95+ compiler (in progress) # gfortran: putative GNU Fortran 95+ compiler (in progress)
# fort77: native F77 compiler under HP-UX (and some older Crays) # fort77: native F77 compiler under HP-UX (and some older Crays)
# frt: Fujitsu F77 compiler # frt: Fujitsu F77 compiler
# pathf90/pathf95/pathf2003: PathScale Fortran compiler
# pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers # pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers
# xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers
# lf95: Lahey-Fujitsu F95 compiler # lf95: Lahey-Fujitsu F95 compiler
@ -63,14 +64,16 @@ IF(NOT CMAKE_Fortran_COMPILER)
# then 77 or older compilers, gnu is always last in the group, # then 77 or older compilers, gnu is always last in the group,
# so if you paid for a compiler it is picked by default. # so if you paid for a compiler it is picked by default.
SET(CMAKE_Fortran_COMPILER_LIST SET(CMAKE_Fortran_COMPILER_LIST
ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran gfortran-4 g95 f90 ifort ifc efc f95 pathf2003 pathf95 pgf95 lf95 xlf95 fort
pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77
frt pgf77 xlf fl32 af77 g77 f77
) )
# Vendor-specific compiler names. # Vendor-specific compiler names.
SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77)
SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc)
SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgf90 pgf77) SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgf90 pgf77)
SET(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90)
SET(_Fortran_COMPILER_NAMES_XL xlf) SET(_Fortran_COMPILER_NAMES_XL xlf)
SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf)

@ -34,9 +34,9 @@ ENDIF(UNIX)
SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@") SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@")
SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@") SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@")
IF(CMAKE_Fortran_SIZEOF_DATA_PTR) IF(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P)
SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}") SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}")
ENDIF(CMAKE_Fortran_SIZEOF_DATA_PTR) ENDIF()
IF(CMAKE_Fortran_COMPILER_ABI) IF(CMAKE_Fortran_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}") SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}")

@ -27,7 +27,7 @@ MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_
MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}") MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}")
MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}") MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}")
MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}") MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}")
MESSAGE("CMAKE_COMPILER_IS_GNUGCC = ${CMAKE_COMPILER_IS_GNUGCC}") MESSAGE("CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}")
MESSAGE("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}") MESSAGE("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}")
MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")

@ -74,6 +74,7 @@ ELSE(NOT CMAKE_C_COMPILER_WORKS)
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake
@ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
) )
INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake)
ENDIF(CMAKE_C_COMPILER_FORCED) ENDIF(CMAKE_C_COMPILER_FORCED)
ENDIF(NOT CMAKE_C_COMPILER_WORKS) ENDIF(NOT CMAKE_C_COMPILER_WORKS)

@ -67,5 +67,6 @@ ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake
@ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
) )
INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake)
ENDIF(CMAKE_CXX_COMPILER_FORCED) ENDIF(CMAKE_CXX_COMPILER_FORCED)
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS) ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)

@ -90,5 +90,6 @@ ELSE(NOT CMAKE_Fortran_COMPILER_WORKS)
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
@ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0
) )
INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake)
ENDIF(CMAKE_Fortran_COMPILER_FORCED) ENDIF(CMAKE_Fortran_COMPILER_FORCED)
ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS) ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)

@ -12,38 +12,14 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
# VCExpress does not support cross compiling, which is necessary for Win CE # We use MSBuild as the build tool for VS 10
SET( _CMAKE_MAKE_PROGRAM_NAMES devenv)
IF(NOT CMAKE_CROSSCOMPILING)
SET( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress)
ENDIF(NOT CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM FIND_PROGRAM(CMAKE_MAKE_PROGRAM
NAMES MSBuild NAMES MSBuild
HINTS HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir]
"$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
"c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
) "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/"
FIND_PROGRAM(CMAKE_MAKE_PROGRAM
NAMES ${_CMAKE_MAKE_PROGRAM_NAMES}
HINTS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup;Dbghelp_path]
"$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio10.0/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio 10/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio10/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10.0/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10/Common7/IDE"
"/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/"
"/Program Files/Microsoft Visual Studio 10/Common7/IDE/"
PATHS
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE"
) )
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)

@ -28,9 +28,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE" "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE"
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE" "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE"
"/Program Files/Microsoft Visual Studio 8/Common7/IDE/" "/Program Files/Microsoft Visual Studio 8/Common7/IDE/"
PATHS
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE"
) )
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
SET(MSVC80 1) SET(MSVC80 1)

@ -33,10 +33,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE" "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE"
"/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/" "/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/"
"/Program Files/Microsoft Visual Studio 9/Common7/IDE/" "/Program Files/Microsoft Visual Studio 9/Common7/IDE/"
PATHS
"$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE"
"$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE"
) )
MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM)
SET(MSVC90 1) SET(MSVC90 1)

@ -49,6 +49,14 @@
# CPACK_RPM_PACKAGE_DESCRIPTION # CPACK_RPM_PACKAGE_DESCRIPTION
# Mandatory : YES # Mandatory : YES
# Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available" # Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available"
# CPACK_RPM_COMPRESSION_TYPE
# Mandatory : NO
# Default : -
# May be used to override RPM compression type to be used
# to build the RPM. For example some Linux distribution now default
# to lzma or xz compression whereas older cannot use such RPM.
# Using this one can enforce compression type to be used.
# Possible value are: lzma, xz, bzip2 and gzip.
# CPACK_RPM_PACKAGE_REQUIRES # CPACK_RPM_PACKAGE_REQUIRES
# Mandatory : NO # Mandatory : NO
# Default : - # Default : -
@ -265,6 +273,27 @@ IF (NOT CPACK_RPM_PACKAGE_DESCRIPTION)
ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE) ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE)
ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION)
# CPACK_RPM_COMPRESSION_TYPE
#
IF (CPACK_RPM_COMPRESSION_TYPE)
IF(CPACK_RPM_PACKAGE_DEBUG)
MESSAGE("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio")
ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma")
IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio")
ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz")
IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio")
ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2")
IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio")
ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip")
ELSE(CPACK_RPM_COMPRESSION_TYPE)
SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")
ENDIF(CPACK_RPM_COMPRESSION_TYPE)
# CPACK_RPM_PACKAGE_REQUIRES # CPACK_RPM_PACKAGE_REQUIRES
# Placeholder used to specify binary RPM dependencies (if any) # Placeholder used to specify binary RPM dependencies (if any)
# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html # see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html
@ -419,6 +448,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@
%define _topdir \@CPACK_RPM_DIRECTORY\@ %define _topdir \@CPACK_RPM_DIRECTORY\@
\@TMP_RPM_SPEC_INSTALL_POST\@ \@TMP_RPM_SPEC_INSTALL_POST\@
\@CPACK_RPM_SPEC_MORE_DEFINE\@ \@CPACK_RPM_SPEC_MORE_DEFINE\@
\@CPACK_RPM_COMPRESSION_TYPE_TMP\@
%description %description
\@CPACK_RPM_PACKAGE_DESCRIPTION\@ \@CPACK_RPM_PACKAGE_DESCRIPTION\@
@ -459,6 +489,8 @@ fi
${CPACK_RPM_INSTALL_FILES} ${CPACK_RPM_INSTALL_FILES}
%changelog %changelog
* Sun Apr 4 2010 Erk <eric.noulard@gmail.com>
Add support for specifying RPM compression type
* Sat Nov 28 2009 Erk <eric.noulard@gmail.com> * Sat Nov 28 2009 Erk <eric.noulard@gmail.com>
Refix backup/restore install tree for OpenSuSE 11.2 Refix backup/restore install tree for OpenSuSE 11.2
* Sun Nov 22 2009 Erk <eric.noulard@gmail.com> * Sun Nov 22 2009 Erk <eric.noulard@gmail.com>

@ -0,0 +1 @@
include(Compiler/GNU-C)

@ -0,0 +1 @@
include(Compiler/GNU-CXX)

@ -1,11 +1,11 @@
SET(CMAKE_C_VERBOSE_FLAG "-#")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
SET(CMAKE_C_VERBOSE_FLAG "-#")
SET(CMAKE_C_FLAGS_INIT "") SET(CMAKE_C_FLAGS_INIT "")
SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") SET(CMAKE_C_FLAGS_DEBUG_INIT "-g")
SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")

@ -1,11 +1,11 @@
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
SET(CMAKE_CXX_FLAGS_INIT "") SET(CMAKE_CXX_FLAGS_INIT "")
SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")

@ -1,3 +1,5 @@
SET(CMAKE_Fortran_VERBOSE_FLAG "-v")
SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R")
@ -12,4 +14,3 @@ SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=") SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=")
SET(CMAKE_Fortran_MODPATH_FLAG "-M") SET(CMAKE_Fortran_MODPATH_FLAG "-M")
SET(CMAKE_Fortran_VERBOSE_FLAG "-v")

@ -1,4 +1,5 @@
SET(CMAKE_Fortran_VERBOSE_FLAG "-V") SET(CMAKE_Fortran_VERBOSE_FLAG "-V")
SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D") SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D")
SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")

@ -7,6 +7,9 @@
SourceDirectory: @PROJECT_SOURCE_DIR@ SourceDirectory: @PROJECT_SOURCE_DIR@
BuildDirectory: @PROJECT_BINARY_DIR@ BuildDirectory: @PROJECT_BINARY_DIR@
# Where to place the cost data store
CostDataFile: @CTEST_COST_DATA_FILE@
# Site is something like machine.domain, i.e. pragmatic.crd # Site is something like machine.domain, i.e. pragmatic.crd
Site: @SITE@ Site: @SITE@
@ -43,6 +46,11 @@ CVSUpdateOptions: @CVS_UPDATE_OPTIONS@
SVNCommand: @SVNCOMMAND@ SVNCommand: @SVNCOMMAND@
SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@
# Git options
GITCommand: @GITCOMMAND@
GITUpdateOptions: @GIT_UPDATE_OPTIONS@
GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@
# Generic update command # Generic update command
UpdateCommand: @UPDATE_COMMAND@ UpdateCommand: @UPDATE_COMMAND@
UpdateOptions: @UPDATE_OPTIONS@ UpdateOptions: @UPDATE_OPTIONS@

@ -16,7 +16,12 @@
# [CVS_TAG tag] # Tag to checkout from CVS repo # [CVS_TAG tag] # Tag to checkout from CVS repo
# [SVN_REPOSITORY url] # URL of Subversion repo # [SVN_REPOSITORY url] # URL of Subversion repo
# [SVN_REVISION rev] # Revision to checkout from 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 /.../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 # [TIMEOUT seconds] # Time allowed for file download operations
# #--Update/Patch step---------- # #--Update/Patch step----------
# [UPDATE_COMMAND cmd...] # Source work-tree update command # [UPDATE_COMMAND cmd...] # Source work-tree update command
@ -111,19 +116,19 @@
# License text for the above reference.) # License text for the above reference.)
# Pre-compute a regex to match documented keywords for each command. # Pre-compute a regex to match documented keywords for each command.
file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 100 file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 103
REGEX "^# ( \\[[A-Z_]+ [^]]*\\] +#.*$|[A-Za-z_]+\\()") REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
foreach(line IN LISTS lines) foreach(line IN LISTS lines)
if("${line}" MATCHES "^# [A-Za-z_]+\\(") if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
if(_ep_func) if(_ep_func)
set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$")
endif() 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}]") #message("function [${_ep_func}]")
set(_ep_keywords_${_ep_func} "^(") set(_ep_keywords_${_ep_func} "^(")
set(_ep_keyword_sep) set(_ep_keyword_sep)
else() else()
string(REGEX REPLACE "^# \\[([A-Z_]+) .*" "\\1" _ep_key "${line}") string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}")
#message(" keyword [${_ep_key}]") #message(" keyword [${_ep_key}]")
set(_ep_keywords_${_ep_func} set(_ep_keywords_${_ep_func}
"${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}") "${_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) foreach(arg IN LISTS args)
set(is_value 1) 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 STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND
NOT arg MATCHES "^(TRUE|FALSE)$") NOT arg MATCHES "^(TRUE|FALSE)$")
if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}") 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") if(NOT (key STREQUAL "COMMAND")
AND NOT (key STREQUAL "CVS_MODULE") AND NOT (key STREQUAL "CVS_MODULE")
AND NOT (key STREQUAL "DEPENDS") AND NOT (key STREQUAL "DEPENDS")
AND NOT (key STREQUAL "DOWNLOAD_COMMAND")
) )
message(AUTHOR_WARNING "unknown ${f} keyword: ${arg}") message(AUTHOR_WARNING "unknown ${f} keyword: ${arg}")
endif() 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) if(timeout)
set(timeout_args TIMEOUT ${timeout}) set(timeout_args TIMEOUT ${timeout})
set(timeout_msg "${timeout} seconds") set(timeout_msg "${timeout} seconds")
@ -212,6 +274,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout)
set(timeout_msg "none") set(timeout_msg "none")
endif() endif()
if(md5)
set(md5_args EXPECTED_MD5 ${md5})
else()
set(md5_args "# no EXPECTED_MD5")
endif()
file(WRITE ${script_filename} file(WRITE ${script_filename}
"message(STATUS \"downloading... "message(STATUS \"downloading...
src='${remote}' src='${remote}'
@ -221,6 +289,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout)
file(DOWNLOAD file(DOWNLOAD
\"${remote}\" \"${remote}\"
\"${local}\" \"${local}\"
SHOW_PROGRESS
${md5_args}
${timeout_args} ${timeout_args}
STATUS status STATUS status
LOG log) LOG log)
@ -243,23 +313,64 @@ message(STATUS \"downloading... done\")
endfunction(_ep_write_downloadfile_script) endfunction(_ep_write_downloadfile_script)
function(_ep_write_extractfile_script script_filename filename tmp directory) function(_ep_write_verifyfile_script script_filename local md5)
set(args "") file(WRITE ${script_filename}
"message(STATUS \"verifying file...
file='${local}'\")
if(filename MATCHES ".tar$") set(verified 0)
set(args xf)
# 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() endif()
if(filename MATCHES ".tgz$") string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\")
set(args xfz)
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() 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) set(args xfz)
endif() endif()
if(filename MATCHES "\\.tar$")
set(args xf)
endif()
if(args STREQUAL "") 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() return()
endif() endif()
@ -267,20 +378,23 @@ function(_ep_write_extractfile_script script_filename filename tmp directory)
"# Make file names absolute: "# Make file names absolute:
# #
get_filename_component(filename \"${filename}\" ABSOLUTE) get_filename_component(filename \"${filename}\" ABSOLUTE)
get_filename_component(tmp \"${tmp}\" ABSOLUTE)
get_filename_component(directory \"${directory}\" ABSOLUTE) get_filename_component(directory \"${directory}\" ABSOLUTE)
message(STATUS \"extracting... message(STATUS \"extracting...
src='\${filename}' src='\${filename}'
dst='\${directory}'\") dst='\${directory}'\")
if(NOT EXISTS \"\${filename}\")
message(FATAL_ERROR \"error: file to extract does not exist: '\${filename}'\")
endif()
# Prepare a space for extracting: # Prepare a space for extracting:
# #
set(i 1) set(i 1234)
while(EXISTS \"\${tmp}/extract\${i}\") while(EXISTS \"\${directory}/../ex\${i}\")
math(EXPR i \"\${i} + 1\") math(EXPR i \"\${i} + 1\")
endwhile() endwhile()
set(ut_dir \"\${tmp}/extract\${i}\") set(ut_dir \"\${directory}/../ex\${i}\")
file(MAKE_DIRECTORY \"\${ut_dir}\") file(MAKE_DIRECTORY \"\${ut_dir}\")
# Extract it: # Extract it:
@ -305,10 +419,12 @@ if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\")
set(contents \"\${ut_dir}\") set(contents \"\${ut_dir}\")
endif() endif()
# Copy \"the one\" directory to the final directory: # Move \"the one\" directory to the final directory:
# #
message(STATUS \"extracting... [copy]\") message(STATUS \"extracting... [rename]\")
file(COPY \"\${contents}/\" DESTINATION \${directory}) file(REMOVE_RECURSE \${directory})
get_filename_component(contents \${contents} ABSOLUTE)
file(RENAME \${contents} \${directory})
# Clean up: # Clean up:
# #
@ -609,6 +725,29 @@ function(_ep_add_mkdir_command name)
endfunction(_ep_add_mkdir_command) 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) function(_ep_add_download_command name)
ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir) 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(cmd TARGET ${name} PROPERTY _EP_DOWNLOAD_COMMAND)
get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY)
get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_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) get_property(url TARGET ${name} PROPERTY _EP_URL)
# TODO: Perhaps file:// should be copied to download dir before extraction. # TODO: Perhaps file:// should be copied to download dir before extraction.
@ -661,8 +801,10 @@ function(_ep_add_download_command name)
endif() endif()
get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) 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(module)
set(tag ${svn_revision}) set(tag ${svn_revision})
configure_file( configure_file(
@ -674,13 +816,55 @@ function(_ep_add_download_command name)
get_filename_component(src_name "${source_dir}" NAME) get_filename_component(src_name "${source_dir}" NAME)
get_filename_component(work_dir "${source_dir}" PATH) get_filename_component(work_dir "${source_dir}" PATH)
set(comment "Performing download step (SVN checkout) for '${name}'") 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) 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) elseif(url)
get_filename_component(work_dir "${source_dir}" PATH) get_filename_component(work_dir "${source_dir}" PATH)
get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5)
set(repository "external project URL") set(repository "external project URL")
set(module "${url}") set(module "${url}")
set(tag "") set(tag "${md5}")
configure_file( configure_file(
"${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
"${stamp_dir}/${name}-urlinfo.txt" "${stamp_dir}/${name}-urlinfo.txt"
@ -696,25 +880,30 @@ function(_ep_add_download_command name)
if("${url}" MATCHES "^[a-z]+://") if("${url}" MATCHES "^[a-z]+://")
# TODO: Should download and extraction be different steps? # TODO: Should download and extraction be different steps?
string(REGEX MATCH "[^/]*$" fname "${url}") 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}") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}")
endif() endif()
set(file ${download_dir}/${fname}) set(file ${download_dir}/${fname})
get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) 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 set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake
COMMAND) COMMAND)
set(comment "Performing download step (download and extract) for '${name}'") set(comment "Performing download step (download, verify and extract) for '${name}'")
else() else()
set(file "${url}") set(file "${url}")
set(comment "Performing download step (extract) for '${name}'") set(comment "Performing download step (verify and extract) for '${name}'")
endif() 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. # 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) list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake)
endif() endif()
else() 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() endif()
ExternalProject_Add_Step(${name} download 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(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND)
get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY)
get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_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(work_dir)
set(comment) set(comment)
@ -757,7 +947,25 @@ function(_ep_add_update_command name)
set(work_dir ${source_dir}) set(work_dir ${source_dir})
set(comment "Performing update step (SVN update) for '${name}'") set(comment "Performing update step (SVN update) for '${name}'")
get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) 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) set(always 1)
endif() endif()
@ -793,7 +1001,7 @@ endfunction(_ep_add_patch_command)
# TODO: Make sure external projects use the proper compiler # TODO: Make sure external projects use the proper compiler
function(_ep_add_configure_command name) 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) _ep_get_configuration_subdir_suffix(cfgdir)
@ -827,6 +1035,16 @@ function(_ep_add_configure_command name)
endif() endif()
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 ExternalProject_Add_Step(${name} configure
COMMAND ${cmd} COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir} WORKING_DIRECTORY ${binary_dir}

@ -20,11 +20,6 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
IF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
# Already in cache, be silent
SET(ASPELL_FIND_QUIETLY TRUE)
ENDIF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
FIND_PATH(ASPELL_INCLUDE_DIR aspell.h ) FIND_PATH(ASPELL_INCLUDE_DIR aspell.h )
FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell) FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell)
@ -34,5 +29,4 @@ FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell)
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR)
MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES) MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES)

@ -35,16 +35,14 @@ IF (UNIX)
ENDIF (UNIX) ENDIF (UNIX)
SET (AVIFILE_FOUND "NO") # handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
IF(AVIFILE_INCLUDE_DIR) IF (AVIFILE_FOUND)
IF(AVIFILE_AVIPLAY_LIBRARY)
SET(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY}) SET(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY})
SET( AVIFILE_FOUND "YES" )
SET(AVIFILE_DEFINITIONS "") SET(AVIFILE_DEFINITIONS "")
ENDIF()
ENDIF(AVIFILE_AVIPLAY_LIBRARY)
ENDIF(AVIFILE_INCLUDE_DIR)
MARK_AS_ADVANCED(AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) MARK_AS_ADVANCED(AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)

@ -4,7 +4,6 @@
# BZIP2_FOUND - system has BZip2 # BZIP2_FOUND - system has BZip2
# BZIP2_INCLUDE_DIR - the BZip2 include directory # BZIP2_INCLUDE_DIR - the BZip2 include directory
# BZIP2_LIBRARIES - Link these to use BZip2 # BZIP2_LIBRARIES - Link these to use BZip2
# BZIP2_DEFINITIONS - Compiler switches required for using BZip2
# BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ # BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_
#============================================================================= #=============================================================================
@ -21,10 +20,6 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
SET(BZip2_FIND_QUIETLY TRUE)
ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ) FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 ) FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )

@ -484,6 +484,10 @@ if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT}) string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.") set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
mark_as_advanced(CUDA_VERSION) mark_as_advanced(CUDA_VERSION)
else()
# Need to set these based off of the cached value
string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${CUDA_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}")
endif() endif()
# Always set this convenience variable # Always set this convenience variable

@ -33,6 +33,15 @@ SET(CURSES_USE_NCURSES FALSE)
IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
SET(CURSES_USE_NCURSES TRUE) SET(CURSES_USE_NCURSES TRUE)
ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY)
# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
# cygwin ncurses stopped providing curses.h symlinks see above
# message. Cygwin is an ncurses package, so force ncurses on
# cygwin if the curses.h is missing
IF(CYGWIN)
IF(NOT EXISTS /usr/include/curses.h)
SET(CURSES_USE_NCURSES TRUE)
ENDIF()
ENDIF()
# Not sure the logic is correct here. # Not sure the logic is correct here.

@ -1,7 +1,7 @@
# - find DCMTK libraries and applications # - find DCMTK libraries and applications
# #
# DCMTK_INCLUDE_DIR - Directories to include to use DCMTK # DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
# DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK
# DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK
# DCMTK_DIR - (optional) Source directory for DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK
@ -13,7 +13,8 @@
#============================================================================= #=============================================================================
# Copyright 2004-2009 Kitware, Inc. # Copyright 2004-2009 Kitware, Inc.
# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com> # Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# Copyright 2010 Thomas Sondergaard <ts@medical-insight.com>
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -28,155 +29,124 @@
# #
# Written for VXL by Amitha Perera. # Written for VXL by Amitha Perera.
# Upgraded for GDCM by Mathieu Malaterre. # Upgraded for GDCM by Mathieu Malaterre.
# Modified for EasyViz by Thomas Sondergaard.
# #
IF( NOT DCMTK_FOUND ) if(NOT DCMTK_FOUND AND NOT DCMTK_DIR)
SET( DCMTK_DIR "/usr/include/dcmtk/" set(DCMTK_DIR
CACHE PATH "Root of DCMTK source tree (optional)." ) "/usr/include/dcmtk/"
MARK_AS_ADVANCED( DCMTK_DIR ) CACHE
ENDIF( NOT DCMTK_FOUND ) PATH
"Root of DCMTK source tree (optional).")
mark_as_advanced(DCMTK_DIR)
FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h endif()
${DCMTK_DIR}/config/include
${DCMTK_DIR}/config
${DCMTK_DIR}/include foreach(lib
) dcmdata
dcmimage
FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h dcmimgle
${DCMTK_DIR}/ofstd/include dcmjpeg
${DCMTK_DIR}/ofstd dcmnet
${DCMTK_DIR}/include/ofstd dcmpstat
) dcmqrdb
dcmsign
FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd dcmsr
${DCMTK_DIR}/ofstd/libsrc dcmtls
${DCMTK_DIR}/ofstd/libsrc/Release ijg12
${DCMTK_DIR}/ofstd/libsrc/Debug ijg16
${DCMTK_DIR}/ofstd/Release ijg8
${DCMTK_DIR}/ofstd/Debug ofstd)
${DCMTK_DIR}/lib
) find_library(DCMTK_${lib}_LIBRARY
${lib}
PATHS
FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h ${DCMTK_DIR}/${lib}/libsrc
${DCMTK_DIR}/include/dcmdata ${DCMTK_DIR}/${lib}/libsrc/Release
${DCMTK_DIR}/dcmdata ${DCMTK_DIR}/${lib}/libsrc/Debug
${DCMTK_DIR}/dcmdata/include ${DCMTK_DIR}/${lib}/Release
) ${DCMTK_DIR}/${lib}/Debug
${DCMTK_DIR}/lib)
FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata
${DCMTK_DIR}/dcmdata/libsrc mark_as_advanced(DCMTK_${lib}_LIBRARY)
${DCMTK_DIR}/dcmdata/libsrc/Release
${DCMTK_DIR}/dcmdata/libsrc/Debug if(DCMTK_${lib}_LIBRARY)
${DCMTK_DIR}/dcmdata/Release list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY})
${DCMTK_DIR}/dcmdata/Debug endif()
${DCMTK_DIR}/lib
) endforeach()
FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h set(DCMTK_config_TEST_HEADER osconfig.h)
${DCMTK_DIR}/dcmimgle/include set(DCMTK_dcmdata_TEST_HEADER dctypes.h)
${DCMTK_DIR}/dcmimgle set(DCMTK_dcmimage_TEST_HEADER dicoimg.h)
${DCMTK_DIR}/include/dcmimgle set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h)
) set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h)
set(DCMTK_dcmnet_TEST_HEADER assoc.h)
FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h)
${DCMTK_DIR}/dcmimgle/libsrc set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h)
${DCMTK_DIR}/dcmimgle/libsrc/Release set(DCMTK_dcmsign_TEST_HEADER sicert.h)
${DCMTK_DIR}/dcmimgle/libsrc/Debug set(DCMTK_dcmsr_TEST_HEADER dsrtree.h)
${DCMTK_DIR}/dcmimgle/Release set(DCMTK_dcmtls_TEST_HEADER tlslayer.h)
${DCMTK_DIR}/dcmimgle/Debug set(DCMTK_ofstd_TEST_HEADER ofstdinc.h)
${DCMTK_DIR}/lib
) foreach(dir
config
# MM: I could not find this library on debian system / dcmtk 3.5.4 dcmdata
FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb dcmimage
${DCMTK_DIR}/imagectn/libsrc/Release dcmimgle
${DCMTK_DIR}/imagectn/libsrc/ dcmjpeg
${DCMTK_DIR}/imagectn/libsrc/Debug dcmnet
) dcmpstat
dcmqrdb
FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet dcmsign
${DCMTK_DIR}/dcmnet/libsrc/Release dcmsr
${DCMTK_DIR}/dcmnet/libsrc/Debug dcmtls
${DCMTK_DIR}/dcmnet/libsrc/ ofstd)
) find_path(DCMTK_${dir}_INCLUDE_DIR
${DCMTK_${dir}_TEST_HEADER}
PATHS
IF( DCMTK_config_INCLUDE_DIR ${DCMTK_DIR}/${dir}/include
AND DCMTK_ofstd_INCLUDE_DIR ${DCMTK_DIR}/${dir}
AND DCMTK_ofstd_LIBRARY ${DCMTK_DIR}/include/${dir})
AND DCMTK_dcmdata_INCLUDE_DIR
AND DCMTK_dcmdata_LIBRARY mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR)
AND DCMTK_dcmimgle_INCLUDE_DIR
AND DCMTK_dcmimgle_LIBRARY ) if(DCMTK_${dir}_INCLUDE_DIR)
list(APPEND
SET( DCMTK_FOUND "YES" ) DCMTK_INCLUDE_DIRS
SET( DCMTK_INCLUDE_DIR ${DCMTK_${dir}_INCLUDE_DIR})
${DCMTK_config_INCLUDE_DIR} endif()
endforeach()
if(WIN32)
list(APPEND DCMTK_LIBRARIES netapi32 wsock32)
endif()
if(DCMTK_ofstd_INCLUDE_DIR)
get_filename_component(DCMTK_dcmtk_INCLUDE_DIR
${DCMTK_ofstd_INCLUDE_DIR} ${DCMTK_ofstd_INCLUDE_DIR}
${DCMTK_dcmdata_INCLUDE_DIR} PATH
${DCMTK_dcmimgle_INCLUDE_DIR} CACHE)
) list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR})
mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR)
SET( DCMTK_LIBRARIES endif()
${DCMTK_dcmimgle_LIBRARY}
${DCMTK_dcmdata_LIBRARY} include(FindPackageHandleStandardArgs)
${DCMTK_ofstd_LIBRARY} find_package_handle_standard_args(DCMTK DEFAULT_MSG
${DCMTK_config_LIBRARY}
)
IF(DCMTK_imagedb_LIBRARY)
SET( DCMTK_LIBRARIES
${DCMTK_LIBRARIES}
${DCMTK_imagedb_LIBRARY}
)
ENDIF(DCMTK_imagedb_LIBRARY)
IF(DCMTK_dcmnet_LIBRARY)
SET( DCMTK_LIBRARIES
${DCMTK_LIBRARIES}
${DCMTK_dcmnet_LIBRARY}
)
ENDIF(DCMTK_dcmnet_LIBRARY)
IF( WIN32 )
SET( DCMTK_LIBRARIES ${DCMTK_LIBRARIES} netapi32 )
ENDIF( WIN32 )
ENDIF( DCMTK_config_INCLUDE_DIR
AND DCMTK_ofstd_INCLUDE_DIR
AND DCMTK_ofstd_LIBRARY
AND DCMTK_dcmdata_INCLUDE_DIR
AND DCMTK_dcmdata_LIBRARY
AND DCMTK_dcmimgle_INCLUDE_DIR
AND DCMTK_dcmimgle_LIBRARY )
FIND_PROGRAM(DCMTK_DCMDUMP_EXECUTABLE dcmdump
${DCMTK_DIR}/bin
)
FIND_PROGRAM(DCMTK_DCMDJPEG_EXECUTABLE dcmdjpeg
${DCMTK_DIR}/bin
)
FIND_PROGRAM(DCMTK_DCMDRLE_EXECUTABLE dcmdrle
${DCMTK_DIR}/bin
)
MARK_AS_ADVANCED(
DCMTK_DCMDUMP_EXECUTABLE
DCMTK_DCMDJPEG_EXECUTABLE
DCMTK_DCMDRLE_EXECUTABLE
DCMTK_config_INCLUDE_DIR DCMTK_config_INCLUDE_DIR
DCMTK_ofstd_INCLUDE_DIR
DCMTK_ofstd_LIBRARY
DCMTK_dcmdata_INCLUDE_DIR DCMTK_dcmdata_INCLUDE_DIR
DCMTK_dcmdata_LIBRARY DCMTK_dcmdata_LIBRARY
DCMTK_dcmimgle_INCLUDE_DIR DCMTK_dcmimgle_INCLUDE_DIR
DCMTK_dcmimgle_LIBRARY DCMTK_dcmimgle_LIBRARY)
DCMTK_imagedb_LIBRARY
DCMTK_dcmnet_LIBRARY # Compatibility: This variable is deprecated
DCMTK_ofstd_INCLUDE_DIR set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS})
DCMTK_ofstd_LIBRARY
)
foreach(executable dcmdump dcmdjpeg dcmdrle)
string(TOUPPER ${executable} EXECUTABLE)
find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin)
mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE)
endforeach()

@ -27,3 +27,10 @@ FIND_PATH(DART_ROOT README.INSTALL
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath]
DOC "If you have Dart installed, where is it located?" DOC "If you have Dart installed, where is it located?"
) )
# handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT)
MARK_AS_ADVANCED(DART_ROOT)

@ -33,9 +33,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT DEFAULT_MSG EXPAT_LIBRARY EXPAT_INCLUDE_
IF(EXPAT_FOUND) IF(EXPAT_FOUND)
SET(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) SET(EXPAT_LIBRARIES ${EXPAT_LIBRARY})
SET(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) SET(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})
ELSE(EXPAT_FOUND)
SET(EXPAT_LIBRARIES)
SET(EXPAT_INCLUDE_DIRS)
ENDIF(EXPAT_FOUND) ENDIF(EXPAT_FOUND)
MARK_AS_ADVANCED(EXPAT_INCLUDE_DIR EXPAT_LIBRARY) MARK_AS_ADVANCED(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)

@ -1,4 +1,7 @@
# - Find the GCC-XML front-end executable. # - Find the GCC-XML front-end executable.
#
# This module will define the following variables:
# GCCXML - the GCC-XML front-end executable.
#============================================================================= #=============================================================================
# Copyright 2001-2009 Kitware, Inc. # Copyright 2001-2009 Kitware, Inc.
@ -20,3 +23,5 @@ FIND_PROGRAM(GCCXML
"$ENV{ProgramFiles}/GCC_XML" "$ENV{ProgramFiles}/GCC_XML"
"C:/Program Files/GCC_XML" "C:/Program Files/GCC_XML"
) )
MARK_AS_ADVANCED(GCCXML)

@ -15,7 +15,9 @@
# Use of this file is deprecated, and is here for backwards compatibility with CMake 1.4 # Use of this file is deprecated, and is here for backwards compatibility with CMake 1.4
# GLU library is now found by FindOpenGL.cmake # GLU library is now found by FindOpenGL.cmake
# #
#
MESSAGE(STATUS
"WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead")
INCLUDE(FindOpenGL) INCLUDE(FindOpenGL)

@ -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)

@ -1,10 +1,14 @@
# - Try to find HSPELL # - Try to find Hspell
# Once done this will define # Once done this will define
# #
# HSPELL_FOUND - system has HSPELL # HSPELL_FOUND - system has Hspell
# HSPELL_INCLUDE_DIR - the HSPELL include directory # HSPELL_INCLUDE_DIR - the Hspell include directory
# HSPELL_LIBRARIES - The libraries needed to use HSPELL # HSPELL_LIBRARIES - The libraries needed to use Hspell
# HSPELL_DEFINITIONS - Compiler switches required for using HSPELL # HSPELL_DEFINITIONS - Compiler switches required for using Hspell
#
# HSPELL_VERSION_STRING - The version of Hspell found (x.y)
# HSPELL_MAJOR_VERSION - the major version of Hspell
# HSPELL_MINOR_VERSION - The minor version of Hspell
#============================================================================= #=============================================================================
# Copyright 2006-2009 Kitware, Inc. # Copyright 2006-2009 Kitware, Inc.
@ -20,21 +24,20 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
IF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
# Already in cache, be silent
SET(HSPELL_FIND_QUIETLY TRUE)
ENDIF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
FIND_PATH(HSPELL_INCLUDE_DIR hspell.h) FIND_PATH(HSPELL_INCLUDE_DIR hspell.h)
FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell) FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell)
IF (HSPELL_INCLUDE_DIR)
FILE(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H)
STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}")
STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}")
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL DEFAULT_MSG HSPELL_LIBRARIES HSPELL_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL DEFAULT_MSG HSPELL_LIBRARIES HSPELL_INCLUDE_DIR)
MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)

@ -21,19 +21,10 @@
FIND_PACKAGE(JPEG) FIND_PACKAGE(JPEG)
IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES)
# Already in cache, be silent
SET(Jasper_FIND_QUIETLY TRUE)
ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES)
FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h) FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h)
FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper) FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper)
IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
@ -43,4 +34,4 @@ IF (JASPER_FOUND)
SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} ) SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
ENDIF (JASPER_FOUND) ENDIF (JASPER_FOUND)
MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY) MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARY)

@ -24,9 +24,18 @@
# and # and
# Java_VERSION = 1.6.0 # Java_VERSION = 1.6.0
# #
# NOTE: At the moment this script will look for javac and jar component, # For these components the following variables are set:
# which means it will fail if javac or jar is not found.:w #
# See Bug #9840 # Java_FOUND - TRUE if all components are found.
# Java_INCLUDE_DIRS - Full paths to all include dirs.
# Java_LIBRARIES - Full paths to all libraries.
# Java_<component>_FOUND - TRUE if <component> is found.
#
# Example Usages:
# FIND_PACKAGE(Java)
# FIND_PACKAGE(Java COMPONENTS Runtime)
# FIND_PACKAGE(Java COMPONENTS Development)
#
#============================================================================= #=============================================================================
# Copyright 2002-2009 Kitware, Inc. # Copyright 2002-2009 Kitware, Inc.
@ -82,7 +91,11 @@ IF(Java_JAVA_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE) ERROR_STRIP_TRAILING_WHITESPACE)
IF( res ) IF( res )
IF(${Java_FIND_REQUIRED})
MESSAGE( FATAL_ERROR "Error executing java -version" ) MESSAGE( FATAL_ERROR "Error executing java -version" )
ELSE()
MESSAGE( STATUS "Warning, could not run java --version")
ENDIF()
ELSE() ELSE()
# extract major/minor version and patch level from "java -version" output # extract major/minor version and patch level from "java -version" output
# Tested on linux using # Tested on linux using
@ -148,12 +161,36 @@ FIND_PROGRAM(Java_JAVAC_EXECUTABLE
) )
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
if(Java_FIND_COMPONENTS)
foreach(component ${Java_FIND_COMPONENTS})
# User just want to execute some Java byte-compiled
if(component STREQUAL "Runtime")
find_package_handle_standard_args(Java DEFAULT_MSG
Java_JAVA_EXECUTABLE
_java_version_acceptable
)
elseif(component STREQUAL "Development")
find_package_handle_standard_args(Java DEFAULT_MSG
Java_JAVA_EXECUTABLE
Java_JAR_EXECUTABLE
Java_JAVAC_EXECUTABLE
_java_version_acceptable
)
else()
message(FATAL_ERROR "Comp: ${component} is not handled")
endif()
set(Java_${component}_FOUND TRUE)
endforeach(component)
else()
# Check for everything
find_package_handle_standard_args(Java DEFAULT_MSG find_package_handle_standard_args(Java DEFAULT_MSG
Java_JAVA_EXECUTABLE Java_JAVA_EXECUTABLE
Java_JAR_EXECUTABLE Java_JAR_EXECUTABLE
Java_JAVAC_EXECUTABLE Java_JAVAC_EXECUTABLE
_java_version_acceptable _java_version_acceptable
) )
endif()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
Java_JAVA_EXECUTABLE Java_JAVA_EXECUTABLE

@ -73,7 +73,7 @@ IF(NOT KDE4_DATA_DIR)
EXECUTE_PROCESS(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) EXECUTE_PROCESS(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR) FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
# then check the data dirs for FindKDE4Internal.cmake # then check the data dirs for FindKDE4Internal.cmake
FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake ${_data_DIR}) FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR})
ENDIF(KDE4_KDECONFIG_EXECUTABLE) ENDIF(KDE4_KDECONFIG_EXECUTABLE)
ENDIF(CMAKE_CROSSCOMPILING) ENDIF(CMAKE_CROSSCOMPILING)
ENDIF(NOT KDE4_DATA_DIR) ENDIF(NOT KDE4_DATA_DIR)

@ -24,7 +24,7 @@
# use pkg-config to get the directories and then use these values # use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls # in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig) FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) PKG_CHECK_MODULES(PC_LIBXML libxml-2.0 QUIET)
SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
@ -44,10 +44,9 @@ FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
# for backwards compat. with KDE 4.0.x: # for backwards compat. with KDE 4.0.x:
SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)

@ -26,7 +26,6 @@ FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_LIBXSLT libxslt) PKG_CHECK_MODULES(PC_LIBXSLT libxslt)
SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER}) SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER})
FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h
HINTS HINTS
${PC_LIBXSLT_INCLUDEDIR} ${PC_LIBXSLT_INCLUDEDIR}
@ -39,12 +38,10 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt
${PC_LIBXSLT_LIBRARY_DIRS} ${PC_LIBXSLT_LIBRARY_DIRS}
) )
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES) MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES)

@ -35,8 +35,10 @@ FIND_LIBRARY( MPEG_vo_LIBRARY vo
# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
IF(MPEG_FOUND) IF(MPEG_FOUND)
SET( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} ) SET( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} )
ENDIF(MPEG_FOUND) ENDIF(MPEG_FOUND)
MARK_AS_ADVANCED(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)

@ -95,8 +95,9 @@ FIND_LIBRARY(OPENAL_LIBRARY
) )
SET(OPENAL_FOUND "NO") # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
IF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) # all listed variables are TRUE
SET(OPENAL_FOUND "YES") INCLUDE(FindPackageHandleStandardArgs)
ENDIF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)

@ -33,7 +33,7 @@ if(ZLIB_FOUND)
/usr/local/include/libpng # OpenBSD /usr/local/include/libpng # OpenBSD
) )
set(PNG_NAMES ${PNG_NAMES} png libpng png12 libpng12) set(PNG_NAMES ${PNG_NAMES} png libpng png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
find_library(PNG_LIBRARY NAMES ${PNG_NAMES} ) find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)

@ -54,8 +54,8 @@ FIND_LIBRARY(PHYSFS_LIBRARY
/opt /opt
) )
SET(PHYSFS_FOUND "NO") # handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if
IF(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) # all listed variables are TRUE
SET(PHYSFS_FOUND "YES") INCLUDE(FindPackageHandleStandardArgs)
ENDIF(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)

@ -1,15 +1,17 @@
# - a pkg-config module for CMake # - a pkg-config module for CMake
# #
# Usage: # Usage:
# pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*) # pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
# checks for all the given modules # checks for all the given modules
# #
# pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*) # pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
# checks for given modules and uses the first working one # checks for given modules and uses the first working one
# #
# When the 'REQUIRED' argument was set, macros will fail with an error # When the 'REQUIRED' argument was set, macros will fail with an error
# when module(s) could not be found # when module(s) could not be found
# #
# When the 'QUIET' argument is set, no status messages will be printed.
#
# It sets the following variables: # It sets the following variables:
# PKG_CONFIG_FOUND ... true if pkg-config works on the system # PKG_CONFIG_FOUND ... true if pkg-config works on the system
# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program # PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
@ -138,17 +140,22 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
endmacro(_pkgconfig_invoke_dyn) endmacro(_pkgconfig_invoke_dyn)
# Splits given arguments into options and a package list # Splits given arguments into options and a package list
macro(_pkgconfig_parse_options _result _is_req) macro(_pkgconfig_parse_options _result _is_req _is_silent)
set(${_is_req} 0) set(${_is_req} 0)
set(${_is_silent} 0)
foreach(_pkg ${ARGN}) foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED") if (_pkg STREQUAL "REQUIRED")
set(${_is_req} 1) set(${_is_req} 1)
endif (_pkg STREQUAL "REQUIRED") endif (_pkg STREQUAL "REQUIRED")
if (_pkg STREQUAL "QUIET")
set(${_is_silent} 1)
endif (_pkg STREQUAL "QUIET")
endforeach(_pkg ${ARGN}) endforeach(_pkg ${ARGN})
set(${_result} ${ARGN}) set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED") list(REMOVE_ITEM ${_result} "REQUIRED")
list(REMOVE_ITEM ${_result} "QUIET")
endmacro(_pkgconfig_parse_options) endmacro(_pkgconfig_parse_options)
### ###
@ -279,7 +286,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir )
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir )
if (NOT ${_is_silent})
message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
endif (NOT ${_is_silent})
endforeach(_pkg_check_modules_pkg) endforeach(_pkg_check_modules_pkg)
# set variables which are combined for multiple modules # set variables which are combined for multiple modules
@ -307,8 +316,8 @@ endmacro(_pkg_check_modules_internal)
macro(pkg_check_modules _prefix _module0) macro(pkg_check_modules _prefix _module0)
# check cached value # check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
_pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN}) _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
_pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules}) _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
@ -319,9 +328,11 @@ macro(pkg_search_module _prefix _module0)
# check cached value # check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0) set(_pkg_modules_found 0)
_pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN}) _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
if (NOT ${_pkg_is_silent})
message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
endif (NOT ${_pkg_is_silent})
# iterate through all modules and stop at the first working one. # iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt}) foreach(_pkg_alt ${_pkg_modules_alt})

@ -89,22 +89,6 @@ MARK_AS_ADVANCED(
PYTHON_INCLUDE_DIR PYTHON_INCLUDE_DIR
) )
# Python Should be built and installed as a Framework on OSX
IF(Python_FRAMEWORKS)
# If a framework has been selected for the include path,
# make sure "-framework" is used to link it.
IF("${PYTHON_INCLUDE_DIR}" MATCHES "Python\\.framework")
SET(PYTHON_LIBRARY "")
SET(PYTHON_DEBUG_LIBRARY "")
ENDIF("${PYTHON_INCLUDE_DIR}" MATCHES "Python\\.framework")
IF(NOT PYTHON_LIBRARY)
SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
ENDIF(NOT PYTHON_LIBRARY)
IF(NOT PYTHON_DEBUG_LIBRARY)
SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE)
ENDIF(NOT PYTHON_DEBUG_LIBRARY)
ENDIF(Python_FRAMEWORKS)
# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the # We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the
# cache entries because they are meant to specify the location of a single # cache entries because they are meant to specify the location of a single
# library. We now set the variables listed by the documentation for this # library. We now set the variables listed by the documentation for this
@ -127,7 +111,12 @@ GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS
FUNCTION(PYTHON_ADD_MODULE _NAME ) FUNCTION(PYTHON_ADD_MODULE _NAME )
OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED
"Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
# Mark these options as advanced
MARK_AS_ADVANCED(PYTHON_ENABLE_MODULE_${_NAME}
PYTHON_MODULE_${_NAME}_BUILD_SHARED)
IF(PYTHON_ENABLE_MODULE_${_NAME}) IF(PYTHON_ENABLE_MODULE_${_NAME})
IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
@ -150,13 +139,13 @@ FUNCTION(PYTHON_WRITE_MODULES_HEADER _filename)
GET_FILENAME_COMPONENT(_name "${_filename}" NAME) GET_FILENAME_COMPONENT(_name "${_filename}" NAME)
STRING(REPLACE "." "_" _name "${_name}") STRING(REPLACE "." "_" _name "${_name}")
STRING(TOUPPER ${_name} _name) STRING(TOUPPER ${_name} _nameUpper)
SET(_filenameTmp "${_filename}.in") SET(_filenameTmp "${_filename}.in")
FILE(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n") FILE(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n")
FILE(APPEND ${_filenameTmp} FILE(APPEND ${_filenameTmp}
"#ifndef ${_name} "#ifndef ${_nameUpper}
#define ${_name} #define ${_nameUpper}
#include <Python.h> #include <Python.h>
@ -179,14 +168,15 @@ extern \"C\" {
FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filenameTmp} "int CMakeLoadPythonModule_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n") FILE(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n")
ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n") FILE(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n")
FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) FOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filenameTmp} " CMakeLoadPythonModule_${_currentModule}();\n") FILE(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n")
ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST})
FILE(APPEND ${_filenameTmp} "}\n#endif\n\n#endif\n") FILE(APPEND ${_filenameTmp} "}\n\n")
FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n")
# with CONFIGURE_FILE() cmake complains that you may not use a file created using FILE(WRITE) as input file for CONFIGURE_FILE() # with CONFIGURE_FILE() cmake complains that you may not use a file created using FILE(WRITE) as input file for CONFIGURE_FILE()
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET) EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)

@ -360,34 +360,6 @@ SET( QT_DEFINITIONS "")
SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) 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) GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
# check for qmake # check for qmake
# Debian uses qmake-qt4 # Debian uses qmake-qt4
@ -397,6 +369,7 @@ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
$ENV{QTDIR}/bin $ENV{QTDIR}/bin
DOC "The qmake executable for the Qt installation to use"
) )
IF (QT_QMAKE_EXECUTABLE) IF (QT_QMAKE_EXECUTABLE)
@ -418,6 +391,7 @@ IF (QT_QMAKE_EXECUTABLE)
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
$ENV{QTDIR}/bin $ENV{QTDIR}/bin
DOC "The qmake executable for the Qt installation to use"
) )
IF(QT_QMAKE_EXECUTABLE) IF(QT_QMAKE_EXECUTABLE)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}

@ -41,9 +41,7 @@ ELSE(APPLE)
) )
ENDIF(APPLE) ENDIF(APPLE)
SET(QUICKTIME_FOUND "NO") # handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if
IF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR) # all listed variables are TRUE
SET(QUICKTIME_FOUND "YES") INCLUDE(FindPackageHandleStandardArgs)
ENDIF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR)

@ -109,14 +109,5 @@ IF(Subversion_SVN_EXECUTABLE)
ENDIF(Subversion_SVN_EXECUTABLE) ENDIF(Subversion_SVN_EXECUTABLE)
IF(NOT Subversion_FOUND) INCLUDE(FindPackageHandleStandardArgs)
IF(NOT Subversion_FIND_QUIETLY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion DEFAULT_MSG Subversion_SVN_EXECUTABLE)
MESSAGE(STATUS "Subversion was not found.")
ELSE(NOT Subversion_FIND_QUIETLY)
IF(Subversion_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Subversion was not found.")
ENDIF(Subversion_FIND_REQUIRED)
ENDIF(NOT Subversion_FIND_QUIETLY)
ENDIF(NOT Subversion_FOUND)
# FindSubversion.cmake ends here.

@ -5,6 +5,8 @@
# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? # CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
# CMAKE_USE_PTHREADS_INIT - are we using pthreads # CMAKE_USE_PTHREADS_INIT - are we using pthreads
# CMAKE_HP_PTHREADS_INIT - are we using hp 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. # Copyright 2002-2009 Kitware, Inc.
@ -24,11 +26,11 @@ INCLUDE (CheckLibraryExists)
SET(Threads_FOUND FALSE) SET(Threads_FOUND FALSE)
# Do we have sproc? # 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) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
ENDIF() ENDIF()
IF(CMAKE_HAVE_SPROC_H) IF(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
# We have sproc # We have sproc
SET(CMAKE_USE_SPROC_INIT 1) SET(CMAKE_USE_SPROC_INIT 1)
ELSE() ELSE()

@ -22,6 +22,7 @@
# X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND # X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND
# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND # X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND # X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND
# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND # X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND
# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND # X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND
# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND # X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
@ -91,6 +92,7 @@ IF (UNIX)
FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH})
@ -120,6 +122,7 @@ IF (UNIX)
FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
@ -219,6 +222,11 @@ IF (UNIX)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH})
ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
IF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB)
SET(X11_Xi_FOUND TRUE)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH})
ENDIF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB)
IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB)
SET(X11_Xinerama_FOUND TRUE) SET(X11_Xinerama_FOUND TRUE)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH})
@ -396,6 +404,8 @@ IF (UNIX)
X11_Xxf86misc_LIB X11_Xxf86misc_LIB
X11_xf86misc_INCLUDE_PATH X11_xf86misc_INCLUDE_PATH
X11_xf86vmode_INCLUDE_PATH X11_xf86vmode_INCLUDE_PATH
X11_Xi_LIB
X11_Xi_INCLUDE_PATH
X11_Xinerama_LIB X11_Xinerama_LIB
X11_Xinerama_INCLUDE_PATH X11_Xinerama_INCLUDE_PATH
X11_XTest_LIB X11_XTest_LIB

@ -4,6 +4,11 @@
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. # ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found. # ZLIB_FOUND - True if zlib found.
#
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
# ZLIB_MAJOR_VERSION - the major version of zlib
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
#============================================================================= #=============================================================================
# Copyright 2001-2009 Kitware, Inc. # Copyright 2001-2009 Kitware, Inc.
@ -18,23 +23,31 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
IF (ZLIB_INCLUDE_DIR) FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
# Already in cache, be silent "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include"
SET(ZLIB_FIND_QUIETLY TRUE) )
ENDIF (ZLIB_INCLUDE_DIR)
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
SET(ZLIB_NAMES z zlib zdll) SET(ZLIB_NAMES z zlib zdll)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ) FIND_LIBRARY(ZLIB_LIBRARY
NAMES
${ZLIB_NAMES}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib"
)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
# Per-recommendation IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H)
SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}") STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}")
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_INCLUDE_DIR ZLIB_LIBRARY)
IF (ZLIB_FOUND)
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
ENDIF()

@ -18,6 +18,10 @@
# (e.g., C:/wxWidgets-2.6.3/lib/vc_lib). # (e.g., C:/wxWidgets-2.6.3/lib/vc_lib).
# wxWidgets_CONFIGURATION - Configuration to use # wxWidgets_CONFIGURATION - Configuration to use
# (e.g., msw, mswd, mswu, mswunivud, etc.) # (e.g., msw, mswd, mswu, mswunivud, etc.)
# wxWidgets_EXCLUDE_COMMON_LIBRARIES
# - Set to TRUE to exclude linking of
# commonly required libs (e.g., png tiff
# jpeg zlib regex expat).
# #
# For unix style it uses the wx-config utility. You can select between # For unix style it uses the wx-config utility. You can select between
# debug/release, unicode/ansi, universal/non-universal, and # debug/release, unicode/ansi, universal/non-universal, and
@ -213,8 +217,12 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
ENDIF(wxWidgets_USE_MONOLITHIC) ENDIF(wxWidgets_USE_MONOLITHIC)
ENDIF(NOT wxWidgets_FIND_COMPONENTS) ENDIF(NOT wxWidgets_FIND_COMPONENTS)
# Always add the common required libs. # Add the common (usually required libs) unless
LIST(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES}) # wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set.
IF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
LIST(APPEND wxWidgets_FIND_COMPONENTS
${wxWidgets_COMMON_LIBRARIES})
ENDIF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
#------------------------------------------------------------------- #-------------------------------------------------------------------
# WIN32: Helper MACROS # WIN32: Helper MACROS
@ -715,10 +723,13 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
# parse definitions from cxxflags; drop -D* from CXXFLAGS and the -D prefix # parse definitions from cxxflags;
# drop -D* from CXXFLAGS and the -D prefix
STRING(REGEX MATCHALL "-D[^;]+" STRING(REGEX MATCHALL "-D[^;]+"
wxWidgets_DEFINITIONS "${wxWidgets_CXX_FLAGS}") wxWidgets_DEFINITIONS "${wxWidgets_CXX_FLAGS}")
STRING(REGEX REPLACE "-D[^;]+;" "" STRING(REGEX REPLACE "-D[^;]+(;|$)" ""
wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")
STRING(REGEX REPLACE ";$" ""
wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}")
STRING(REPLACE "-D" "" STRING(REPLACE "-D" ""
wxWidgets_DEFINITIONS "${wxWidgets_DEFINITIONS}") wxWidgets_DEFINITIONS "${wxWidgets_DEFINITIONS}")

@ -16,6 +16,7 @@
# gp_resolve_item # gp_resolve_item
# (projects can override with gp_resolve_item_override) # (projects can override with gp_resolve_item_override)
# gp_resolved_file_type # gp_resolved_file_type
# (projects can override with gp_resolved_file_type_override)
# gp_file_type # gp_file_type
# get_prerequisites # get_prerequisites
# list_prerequisites # list_prerequisites
@ -345,6 +346,9 @@ endfunction(gp_resolve_item)
# embedded # embedded
# other # other
# #
# Override on a per-project basis by providing a project-specific
# gp_resolved_file_type_override function.
#
function(gp_resolved_file_type original_file file exepath dirs type_var) function(gp_resolved_file_type original_file file exepath dirs type_var)
#message(STATUS "**") #message(STATUS "**")
@ -428,6 +432,13 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
endif() endif()
endif() endif()
# Provide a hook so that projects can override the decision on whether a
# library belongs to the system or not by whatever logic they choose:
#
if(COMMAND gp_resolved_file_type_override)
gp_resolved_file_type_override("${resolved_file}" type)
endif()
set(${type_var} "${type}" PARENT_SCOPE) set(${type_var} "${type}" PARENT_SCOPE)
#message(STATUS "**") #message(STATUS "**")

@ -45,6 +45,7 @@ macro(__cygwin_compiler_gnu lang)
SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic")
ENDFOREACH(type) ENDFOREACH(type)
set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols")
# TODO: Is -Wl,--enable-auto-import now always default? # 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_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}") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}")

@ -9,3 +9,9 @@
# (embedded) targets without operating system usually don't support shared libraries # (embedded) targets without operating system usually don't support shared libraries
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
# To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH
# works at least for some simple cases:
SET(CMAKE_SYSTEM_INCLUDE_PATH /include )
SET(CMAKE_SYSTEM_LIBRARY_PATH /lib )
SET(CMAKE_SYSTEM_PROGRAM_PATH /bin )

@ -0,0 +1 @@
INCLUDE(Platform/Linux-GNU-C)

@ -0,0 +1 @@
INCLUDE(Platform/Linux-GNU-CXX)

@ -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") SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic")

@ -25,6 +25,7 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/...
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
# include the gcc flags # include the gcc flags

@ -1,2 +1,18 @@
INCLUDE(Platform/NetBSD) INCLUDE(Platform/NetBSD)
# On OpenBSD, the compile time linker does not share it's configuration with
# the runtime linker. This will extract the library search paths from the
# system's ld.so.hints file which will allow CMake to set the appropriate
# -rpath-link flags
IF(NOT CMAKE_PLATFORM_RUNTIME_PATH)
EXECUTE_PROCESS(COMMAND /sbin/ldconfig -r
OUTPUT_VARIABLE LDCONFIG_HINTS
ERROR_QUIET)
STRING(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1"
LDCONFIG_HINTS "${LDCONFIG_HINTS}")
STRING(REGEX REPLACE ":" ";"
CMAKE_PLATFORM_RUNTIME_PATH
"${LDCONFIG_HINTS}")
ENDIF()
SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)

@ -0,0 +1 @@
include(Platform/Windows-GNU-Fortran)

@ -1,2 +1,3 @@
include(Platform/Windows-GNU) include(Platform/Windows-GNU)
__windows_compiler_gnu(Fortran) __windows_compiler_gnu(Fortran)
set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0)

@ -68,6 +68,8 @@ macro(__windows_compiler_gnu lang)
endif() endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows 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. # Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE set(CMAKE_${lang}_CREATE_SHARED_MODULE

@ -23,10 +23,6 @@ ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_COMPILER_2005 1) SET(CMAKE_COMPILER_2005 1)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 9")
SET(CMAKE_COMPILER_2005 1)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9")
# make sure to enable languages after setting configuration types # make sure to enable languages after setting configuration types
ENABLE_LANGUAGE(RC) ENABLE_LANGUAGE(RC)
@ -87,25 +83,12 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
SET(MSVC80 1) SET(MSVC80 1)
SET(CMAKE_COMPILER_2005 1) SET(CMAKE_COMPILER_2005 1)
ENDIF("${compilerVersion}" EQUAL 1400) ENDIF("${compilerVersion}" EQUAL 1400)
IF("${compilerVersion}" GREATER 1400)
SET(MSVC80 1)
SET(CMAKE_COMPILER_2005 1)
ENDIF("${compilerVersion}" GREATER 1400)
IF("${compilerVersion}" GREATER 1400)
SET(MSVC80 1)
SET(CMAKE_COMPILER_2005 1)
ENDIF("${compilerVersion}" GREATER 1400)
IF("${compilerVersion}" EQUAL 1500) IF("${compilerVersion}" EQUAL 1500)
SET(MSVC90 1) SET(MSVC90 1)
SET(MSVC80 0)
ENDIF("${compilerVersion}" EQUAL 1500) ENDIF("${compilerVersion}" EQUAL 1500)
IF("${compilerVersion}" GREATER 1500)
SET(MSVC90 1)
SET(MSVC80 0)
ENDIF("${compilerVersion}" GREATER 1500)
IF("${compilerVersion}" EQUAL 1600) IF("${compilerVersion}" EQUAL 1600)
SET(MSVC10 1) SET(MSVC10 1)
ENDIF() ENDIF("${compilerVersion}" EQUAL 1600)
SET(MSVC_VERSION "${compilerVersion}") SET(MSVC_VERSION "${compilerVersion}")
ELSE(NOT CMAKE_COMPILER_RETURN) ELSE(NOT CMAKE_COMPILER_RETURN)
MESSAGE(STATUS "Check for CL compiler version - failed") MESSAGE(STATUS "Check for CL compiler version - failed")
@ -224,7 +207,7 @@ ENDIF(NOT _MACHINE_ARCH_FLAG)
SET (CMAKE_EXE_LINKER_FLAGS_INIT SET (CMAKE_EXE_LINKER_FLAGS_INIT
"${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
# on versions that support it # on versions that support it
SET( MSVC_INCREMENTAL_YES_FLAG "") SET( MSVC_INCREMENTAL_YES_FLAG "")
IF(NOT MSVC_INCREMENTAL_DEFAULT) IF(NOT MSVC_INCREMENTAL_DEFAULT)
@ -256,7 +239,6 @@ SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELW
SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
# save computed information for this platform # save computed information for this platform
IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake")
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
@ -267,4 +249,3 @@ IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE)
ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake")

@ -8,6 +8,7 @@ SET(MSVC70 @MSVC70@)
SET(MSVC71 @MSVC71@) SET(MSVC71 @MSVC71@)
SET(MSVC80 @MSVC80@) SET(MSVC80 @MSVC80@)
SET(MSVC90 @MSVC90@) SET(MSVC90 @MSVC90@)
SET(MSVC10 @MSVC10@)
SET(MSVC_IDE @MSVC_IDE@) SET(MSVC_IDE @MSVC_IDE@)
SET(MSVC_VERSION @MSVC_VERSION@) SET(MSVC_VERSION @MSVC_VERSION@)
SET(WIN32 1) SET(WIN32 1)

@ -31,7 +31,7 @@ SET(CMAKE_C_CREATE_IMPORT_LIBRARY
SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
SET(CMAKE_C_LINK_EXECUTABLE 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}) 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}") "<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 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 SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
${CMAKE_CXX_CREATE_SHARED_MODULE} ${CMAKE_CXX_CREATE_SHARED_MODULE}
${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) ${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}) SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE})
# create a C++ static library # 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 # create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})

@ -60,25 +60,13 @@ IF(WIN32 AND NOT QT_IS_STATIC)
SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL)
ENDIF(WIN32 AND NOT QT_IS_STATIC) ENDIF(WIN32 AND NOT QT_IS_STATIC)
IF(NOT QT_IS_STATIC)
RETURN()
ENDIF(NOT QT_IS_STATIC)
# QtOpenGL dependencies # QtOpenGL dependencies
QT_QUERY_QMAKE(QMAKE_LIBS_OPENGL "QMAKE_LIBS_OPENGL") find_package(OpenGL)
IF(Q_WS_MAC) SET (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
# On the Mac OpenGL is probably frameworks and QMAKE_LIBS_OPENGL can be
# e.g. "-framework OpenGL -framework AGL". The separate_arguments() call in
# the other branch makes "-framework;-OpenGL;-framework;-lAGL" appear in the
# linker command. So we need to protect the "-framework foo" as
# non-separatable strings. We do this by replacing the space after
# "-framework" with an underscore, then calling separate_arguments(), and
# then we replace the underscores again with spaces. So we get proper linker
# commands. Alex
STRING(REGEX REPLACE "-framework +" "-framework_" QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}")
SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL)
STRING(REGEX REPLACE "-framework_" "-framework " QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}")
ELSE(Q_WS_MAC)
SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL)
ENDIF(Q_WS_MAC)
SET (QT_QTOPENGL_LIB_DEPENDENCIES ${QT_QTOPENGL_LIB_DEPENDENCIES} ${QMAKE_LIBS_OPENGL})
## system png ## system png
@ -93,80 +81,63 @@ ENDIF(QT_QCONFIG MATCHES "system-png")
# for X11, get X11 library directory # for X11, get X11 library directory
IF(Q_WS_X11) IF(Q_WS_X11)
QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11") FIND_PACKAGE(X11)
ENDIF(Q_WS_X11) ENDIF(Q_WS_X11)
## X11 SM ## X11 SM
IF(QT_QCONFIG MATCHES "x11sm") IF(QT_QCONFIG MATCHES "x11sm")
# ask qmake where the x11 libs are IF(X11_SM_LIB AND X11_ICE_LIB)
FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_SM_LIB} ${X11_ICE_LIB})
FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) ENDIF(X11_SM_LIB AND X11_ICE_LIB)
MARK_AS_ADVANCED(QT_X11_SM_LIBRARY)
MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY)
IF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY})
ENDIF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "x11sm") ENDIF(QT_QCONFIG MATCHES "x11sm")
## Xi ## Xi
IF(QT_QCONFIG MATCHES "tablet") IF(QT_QCONFIG MATCHES "tablet")
FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) IF(X11_Xi_LIB)
MARK_AS_ADVANCED(QT_XI_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xi_LIB})
IF(QT_XI_LIBRARY) ENDIF(X11_Xi_LIB)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY})
ENDIF(QT_XI_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "tablet") ENDIF(QT_QCONFIG MATCHES "tablet")
## Xrender ## Xrender
IF(QT_QCONFIG MATCHES "xrender") IF(QT_QCONFIG MATCHES "xrender")
FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) IF(X11_Xrender_LIB)
MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrender_LIB})
IF(QT_XRENDER_LIBRARY) ENDIF(X11_Xrender_LIB)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY})
ENDIF(QT_XRENDER_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xrender") ENDIF(QT_QCONFIG MATCHES "xrender")
## Xrandr ## Xrandr
IF(QT_QCONFIG MATCHES "xrandr") IF(QT_QCONFIG MATCHES "xrandr")
FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) IF(X11_Xrandr_LIB)
MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrandr_LIB})
IF(QT_XRANDR_LIBRARY) ENDIF(X11_Xrandr_LIB)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY})
ENDIF(QT_XRANDR_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xrandr") ENDIF(QT_QCONFIG MATCHES "xrandr")
## Xcursor ## Xcursor
IF(QT_QCONFIG MATCHES "xcursor") IF(QT_QCONFIG MATCHES "xcursor")
FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) IF(X11_Xcursor_LIB)
MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xcursor_LIB})
IF(QT_XCURSOR_LIBRARY) ENDIF(X11_Xcursor_LIB)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY})
ENDIF(QT_XCURSOR_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xcursor") ENDIF(QT_QCONFIG MATCHES "xcursor")
## Xinerama ## Xinerama
IF(QT_QCONFIG MATCHES "xinerama") IF(QT_QCONFIG MATCHES "xinerama")
FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) IF(X11_Xinerama_LIB)
MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xinerama_LIB})
IF(QT_XINERAMA_LIBRARY) ENDIF(X11_Xinerama_LIB)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY})
ENDIF(QT_XINERAMA_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xinerama") ENDIF(QT_QCONFIG MATCHES "xinerama")
## Xfixes ## Xfixes
IF(QT_QCONFIG MATCHES "xfixes") IF(QT_QCONFIG MATCHES "xfixes")
FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11}) IF(X11_Xfixes_LIB)
MARK_AS_ADVANCED(QT_XFIXES_LIBRARY) SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xfixes_LIB})
IF(QT_XFIXES_LIBRARY) ENDIF(X11_Xfixes_LIB)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY})
ENDIF(QT_XFIXES_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xfixes") ENDIF(QT_QCONFIG MATCHES "xfixes")
@ -327,24 +298,16 @@ ENDIF(QT_QCONFIG MATCHES "clock-monotonic")
IF(Q_WS_X11) IF(Q_WS_X11)
# X11 libraries Qt absolutely depends on # X11 libraries Qt always depends on
QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11") SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB})
SEPARATE_ARGUMENTS(QT_LIBS_X11)
FOREACH(QT_X11_LIB ${QT_LIBS_X11}) set(CMAKE_THREAD_PREFER_PTHREADS 1)
STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") find_package(Threads)
SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") if(CMAKE_USE_PTHREADS_INIT)
FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})
MARK_AS_ADVANCED(${QT_TMP_STR}) endif(CMAKE_USE_PTHREADS_INIT)
IF(${QT_TMP_STR})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS})
ENDIF(${QT_TMP_STR})
ENDFOREACH(QT_X11_LIB)
QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD")
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD})
QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD")
SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD})
ENDIF(Q_WS_X11) ENDIF(Q_WS_X11)

@ -65,11 +65,12 @@ SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE) SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE) SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE)
SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTWEBKIT QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTXML QTOPENGL QTGUI QTNETWORK QTCORE) SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTWEBKIT QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTXML QTOPENGL QTGUI QTNETWORK QTCORE)
SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE)
# Qt modules (in order of dependence) # Qt modules (in order of dependence)
FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP
QTWEBKIT PHONON QTSCRIPTTOOLS QTGUI QTTEST QTDBUS QTXML QTSQL QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTGUI QTTEST QTDBUS QTXML QTSQL
QTXMLPATTERNS QTNETWORK QTCORE) QTXMLPATTERNS QTNETWORK QTCORE)
IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS) IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)

@ -111,6 +111,7 @@ ENDIF(CMAKE_USE_ELF_PARSER)
# Sources for CMakeLib # Sources for CMakeLib
# #
SET(SRCS SET(SRCS
cmStandardIncludes.cxx
cmBootstrapCommands.cxx cmBootstrapCommands.cxx
cmCacheManager.cxx cmCacheManager.cxx
cmCacheManager.h cmCacheManager.h
@ -366,6 +367,7 @@ SET(CTEST_SRCS cmCTest.cxx
CTest/cmCTestConfigureHandler.cxx CTest/cmCTestConfigureHandler.cxx
CTest/cmCTestCoverageCommand.cxx CTest/cmCTestCoverageCommand.cxx
CTest/cmCTestCoverageHandler.cxx CTest/cmCTestCoverageHandler.cxx
CTest/cmParsePHPCoverage.cxx
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
CTest/cmCTestGenericHandler.cxx CTest/cmCTestGenericHandler.cxx
CTest/cmCTestHandlerCommand.cxx CTest/cmCTestHandlerCommand.cxx
@ -410,6 +412,7 @@ TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_L
# Sources for CPack # Sources for CPack
# #
SET(CPACK_SRCS SET(CPACK_SRCS
CPack/cmCPackArchiveGenerator.cxx
CPack/cmCPackComponentGroup.cxx CPack/cmCPackComponentGroup.cxx
CPack/cmCPackGeneratorFactory.cxx CPack/cmCPackGeneratorFactory.cxx
CPack/cmCPackGenerator.cxx CPack/cmCPackGenerator.cxx
@ -501,4 +504,3 @@ IF(APPLE)
ENDIF(APPLE) ENDIF(APPLE)
INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h) INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h)

@ -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()

@ -0,0 +1,265 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmCPackArchiveGenerator.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include <errno.h>
#include <cmsys/SystemTools.hxx>
#include <cmlibarchive/libarchive/archive.h>
#include <cmlibarchive/libarchive/archive_entry.h>
//----------------------------------------------------------------------
cmCPackArchiveGenerator::cmCPackArchiveGenerator(CompressType t,
ArchiveType at)
{
this->Compress = t;
this->Archive = at;
}
//----------------------------------------------------------------------
cmCPackArchiveGenerator::~cmCPackArchiveGenerator()
{
}
static const size_t cmCPackTGZ_Data_BlockSize = 16384;
// make this an anonymous namespace so that archive.h does not
// have to be included in the .h file for this class
namespace
{
bool SetArchiveType(struct archive* a,
cmCPackArchiveGenerator::CompressType ct,
cmCPackArchiveGenerator::ArchiveType at)
{
int res = 0;
// pick the archive type
switch(at)
{
case cmCPackArchiveGenerator::TAR:
// maybe this:
res = archive_write_set_format_pax_restricted(a);
break;
case cmCPackArchiveGenerator::ZIP:
res = archive_write_set_format_zip(a);
break;
}
if(res != ARCHIVE_OK)
{
return false;
}
// pick a compression type
switch(ct)
{
case cmCPackArchiveGenerator::GZIP:
res = archive_write_set_compression_gzip(a);
break;
case cmCPackArchiveGenerator::BZIP2:
res = archive_write_set_compression_bzip2(a);
break;
case cmCPackArchiveGenerator::COMPRESS:
res = archive_write_set_compression_compress(a);
break;
case cmCPackArchiveGenerator::LZMA:
res = archive_write_set_compression_lzma(a);
break;
case cmCPackArchiveGenerator::NONE:
default:
res = archive_write_set_compression_none(a);
}
if(res != ARCHIVE_OK)
{
return false;
}
// do not pad the last block!!
res = archive_write_set_bytes_in_last_block(a, 1);
if(res != ARCHIVE_OK)
{
return false;
}
return true;
}
struct StreamData
{
StreamData(cmGeneratedFileStream* gfs,
cmCPackArchiveGenerator* ag)
{
this->GeneratedFileStream = gfs;
this->Generator = ag;
}
cmGeneratedFileStream* GeneratedFileStream;
cmCPackArchiveGenerator* Generator;
};
extern "C"
{
int OpenArchive(struct archive *, void *client_data)
{
struct StreamData *data = (StreamData*)client_data;
if(data->GeneratedFileStream &&
*data->GeneratedFileStream)
{
if(data->Generator->
GenerateHeader(data->GeneratedFileStream))
{
return ARCHIVE_OK;
}
}
return (ARCHIVE_FATAL);
}
__LA_SSIZE_T WriteArchive(struct archive *,
void *client_data,
const void *buff,
size_t n)
{
struct StreamData *data = (StreamData*)client_data;
data->GeneratedFileStream->
write(reinterpret_cast<const char*>(buff),n);
if(!data->GeneratedFileStream->bad())
{
return n;
}
return 0;
}
int CloseArchive(struct archive *, void *client_data)
{
struct StreamData *data = (StreamData*)client_data;
if(data->GeneratedFileStream->Close())
{
delete data->GeneratedFileStream;
return ARCHIVE_OK;
}
return ARCHIVE_FATAL;
}
} //extern C
} // anon name space
//----------------------------------------------------------------------
int cmCPackArchiveGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
return this->Superclass::InitializeInternal();
}
int cmCPackArchiveGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
int res = ARCHIVE_OK;
#define CHECK_ARCHIVE_ERROR(res, msg) \
if(res != ARCHIVE_OK) \
{\
cmCPackLogger(cmCPackLog::LOG_ERROR, msg \
<< archive_error_string(a) \
<< cmSystemTools::GetLastSystemError() \
<< " " << res \
<< "\n"); \
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< (toplevel ? toplevel : "(NULL)") << std::endl);
// create a new archive
struct archive* a = archive_write_new();
// Set the compress and archive types for the archive
SetArchiveType(a, this->Compress, this->Archive);
// Open binary stream
cmGeneratedFileStream* gf = new cmGeneratedFileStream;
gf->Open(outFileName, false, true);
StreamData data(gf, this);
// pass callbacks to archive_write_open to handle stream
res = archive_write_open(a,
&data,
OpenArchive,
WriteArchive,
CloseArchive);
CHECK_ARCHIVE_ERROR(res, "archive_write_open:");
// create a new disk struct
struct archive* disk = archive_read_disk_new();
#if !defined(_WIN32) || defined(__CYGWIN__)
res = archive_read_disk_set_standard_lookup(disk);
#endif
CHECK_ARCHIVE_ERROR(res, "archive_read_disk_set_standard_lookup:");
std::vector<std::string>::const_iterator fileIt;
std::string dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(toplevel);
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
// create a new entry for each file
struct archive_entry *entry = archive_entry_new();
// Get the relative path to the file
std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
// Set the name of the entry to the file name
archive_entry_set_pathname(entry, rp.c_str());
res = archive_read_disk_entry_from_file(disk, entry, -1, 0);
CHECK_ARCHIVE_ERROR(res, "archive_read_disk_entry_from_file:");
// write entry header
res = archive_write_header(a, entry);
CHECK_ARCHIVE_ERROR(res, "archive_write_header:");
// the entry size can be 0 if it is a symlink
if(archive_entry_size(entry) > 0)
{
// now copy contents of file into archive a
FILE* file = fopen(fileIt->c_str(), "rb");
if(!file)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with fopen(): "
<< fileIt->c_str()
<< strerror(errno)
<< std::endl);
return 0;
}
char buff[cmCPackTGZ_Data_BlockSize];
size_t len = fread(buff, 1, sizeof(buff), file);
while (len > 0)
{
size_t wlen = archive_write_data(a, buff, len);
if(wlen != len)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "archive_write_data(): "
<< "tried to write " << len << "\n"
<< "write " << wlen << "\n");
return 0;
}
len = fread(buff, 1, sizeof(buff), file);
}
// close the file and free the entry
fclose(file);
}
archive_entry_free(entry);
}
cmSystemTools::ChangeDirectory(dir.c_str());
// close the archive and finish the write
archive_write_close(a);
archive_write_finish(a);
archive_read_finish(disk);
return 1;
}
//----------------------------------------------------------------------
int cmCPackArchiveGenerator::GenerateHeader(std::ostream*)
{
return 1;
}

@ -0,0 +1,47 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmCPackArchiveGenerator_h
#define cmCPackArchiveGenerator_h
#include "cmCPackGenerator.h"
/** \class cmCPackArchiveGenerator
* \brief A generator base for libarchive generation
*
*/
class cmCPackArchiveGenerator : public cmCPackGenerator
{
public:
enum CompressType{ GZIP, BZIP2, COMPRESS, LZMA, NONE};
enum ArchiveType{ TAR, ZIP};
cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator);
/**
* Construct generator
*/
cmCPackArchiveGenerator(CompressType, ArchiveType);
virtual ~cmCPackArchiveGenerator();
// Used to add a header to the archive
virtual int GenerateHeader(std::ostream* os);
protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() = 0;
CompressType Compress;
ArchiveType Archive;
};
#endif

@ -25,7 +25,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator() cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
{ {
this->Compress = false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -38,18 +37,6 @@ int cmCPackCygwinBinaryGenerator::InitializeInternal()
{ {
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0"); this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
std::vector<std::string> path;
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
if ( pkgPath.empty() )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
return 0;
}
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
<< pkgPath.c_str()
<< std::endl);
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();
} }
@ -85,6 +72,7 @@ int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
// add the manifest file to the list of all files // add the manifest file to the list of all files
std::vector<std::string> filesWithManifest = files; std::vector<std::string> filesWithManifest = files;
filesWithManifest.push_back(manifestFile); filesWithManifest.push_back(manifestFile);
// create the bzip2 tar file // create the bzip2 tar file
return this->Superclass::CompressFiles(outFileName, toplevel, return this->Superclass::CompressFiles(outFileName, toplevel,
filesWithManifest); filesWithManifest);

@ -33,7 +33,6 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator() cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator()
{ {
this->Compress = false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -45,18 +44,6 @@ cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator()
int cmCPackCygwinSourceGenerator::InitializeInternal() int cmCPackCygwinSourceGenerator::InitializeInternal()
{ {
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0"); this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
std::vector<std::string> path;
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
if ( pkgPath.empty() )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
return 0;
}
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
<< pkgPath.c_str()
<< std::endl);
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();
} }
@ -67,26 +54,22 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
// Create a tar file of the sources // Create a tar file of the sources
std::string packageDirFileName std::string packageDirFileName
= this->GetOption("CPACK_TEMPORARY_DIRECTORY"); = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packageDirFileName += ".tar"; packageDirFileName += ".tar.bz2";
std::string output; std::string output;
// skip one parent up to the cmCPackTGZGenerator to create tar file // skip one parent up to the cmCPackTarBZip2Generator
this->Compress = false; // just create tar not tar.gz // to create tar.bz2 file with the list of source
if ( !this->cmCPackTGZGenerator::CompressFiles(packageDirFileName.c_str(), // files
this->Compress = BZIP2;
if ( !this->cmCPackTarBZip2Generator::
CompressFiles(packageDirFileName.c_str(),
toplevel, files) ) toplevel, files) )
{ {
return 0; return 0;
} }
// Now bzip2 the source tar file
if(!this->BZip2File(packageDirFileName.c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 on file: "
<< packageDirFileName.c_str());
return 0;
}
// Now create a tar file that contains the above .tar.bz2 file // Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files // files
std::string compressOutFile = packageDirFileName + ".bz2"; std::string compressOutFile = packageDirFileName;
// at this point compressOutFile is the full path to // at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2 // _CPack_Package/.../package-2.5.0.tar.bz2
// we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2 // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2
@ -95,7 +78,17 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
// _CPack_Package/.../package-2.5.0-1.sh // _CPack_Package/.../package-2.5.0-1.sh
// _CPack_Package/.../package-2.5.0.tar.bz2 // _CPack_Package/.../package-2.5.0.tar.bz2
// the -1 is CPACK_CYGWIN_PATCH_NUMBER // the -1 is CPACK_CYGWIN_PATCH_NUMBER
// first copy the patch file and the .sh file
// to the toplevel cpack temp dir
// copy the patch file into place // copy the patch file into place
if(!this->GetOption("CPACK_CYGWIN_PATCH_FILE"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"No patch file specified for cygwin sources.");
return 0;
}
if(!cmSystemTools::CopyFileAlways( if(!cmSystemTools::CopyFileAlways(
this->GetOption("CPACK_CYGWIN_PATCH_FILE"), this->GetOption("CPACK_CYGWIN_PATCH_FILE"),
this->GetOption("CPACK_TOPLEVEL_DIRECTORY"))) this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
@ -105,6 +98,12 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
<< this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n"); << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
return 0; return 0;
} }
if(!this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"No build script specified for cygwin sources.");
return 0;
}
// copy the build script into place // copy the build script into place
if(!cmSystemTools::CopyFileAlways( if(!cmSystemTools::CopyFileAlways(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"), this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"),
@ -115,7 +114,6 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
<< this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n"); << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
return 0; return 0;
} }
// create the tar file
std::string outerTarFile std::string outerTarFile
= this->GetOption("CPACK_TEMPORARY_DIRECTORY"); = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
outerTarFile += "-"; outerTarFile += "-";
@ -127,44 +125,34 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
patch = "1"; patch = "1";
} }
outerTarFile += patch; outerTarFile += patch;
outerTarFile += "-src.tar"; outerTarFile += "-src.tar.bz2";
std::string buildScript = cmSystemTools::GetFilenameName( std::string tmpDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string buildScript = tmpDir;
buildScript += "/";
buildScript += cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")); this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"));
std::string patchFile = cmSystemTools::GetFilenameName( std::string patchFile = tmpDir;
patchFile += "/";
patchFile += cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_PATCH_FILE")); this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
std::vector<cmStdString> outerFiles; std::vector<std::string> outerFiles;
std::string file = cmSystemTools::GetFilenameName(compressOutFile); std::string file = cmSystemTools::GetFilenameName(compressOutFile);
std::string path = cmSystemTools::GetFilenamePath(compressOutFile); std::string sourceTar = cmSystemTools::GetFilenamePath(compressOutFile);
sourceTar += "/";
sourceTar += file;
// a source release in cygwin should have the build script used // a source release in cygwin should have the build script used
// to build the package, the patch file that is different from the // to build the package, the patch file that is different from the
// regular upstream version of the sources, and a bziped tar file // regular upstream version of the sources, and a bziped tar file
// of the original sources // of the original sources
outerFiles.push_back(buildScript); outerFiles.push_back(buildScript);
outerFiles.push_back(patchFile); outerFiles.push_back(patchFile);
outerFiles.push_back(file); outerFiles.push_back(sourceTar);
std::string saveDir= cmSystemTools::GetCurrentWorkingDirectory(); if ( !this->cmCPackTarBZip2Generator::
cmSystemTools::ChangeDirectory(path.c_str()); CompressFiles(outerTarFile.c_str(),
cmSystemTools::CreateTar(outerTarFile.c_str(), tmpDir.c_str(), outerFiles) )
outerFiles, false, false);
cmSystemTools::ChangeDirectory(saveDir.c_str());
// now compress the outer tar file
if(!this->BZip2File(outerTarFile.c_str()))
{ {
return 0; return 0;
} }
compressOutFile = outerTarFile;
compressOutFile += ".bz2";
// now rename the file to its final name
if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
{
if ( !this->RenameFile(compressOutFile.c_str(), outFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \""
<< compressOutFile.c_str() << "\" to \""
<< (outFileName ? outFileName : "(NULL)") << std::endl);
return 0;
}
}
return 1; return 1;
} }

@ -789,7 +789,7 @@ int cmCPackGenerator::DoPackage()
cmCPackLogger(cmCPackLog::LOG_VERBOSE, cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Remove toplevel directory: " "Remove toplevel directory: "
<< toplevelDirectory << std::endl); << toplevelDirectory << std::endl);
if ( !cmSystemTools::RemoveADirectory(toplevelDirectory) ) if ( !cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory) )
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem removing toplevel directory: " "Problem removing toplevel directory: "
@ -1084,7 +1084,7 @@ int cmCPackGenerator::CleanTemporaryDirectory()
cmCPackLogger(cmCPackLog::LOG_OUTPUT, cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Clean temporary : " "- Clean temporary : "
<< tempInstallDirectory << std::endl); << tempInstallDirectory << std::endl);
if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory)) if(!cmSystemTools::RepeatedRemoveDirectory(tempInstallDirectory))
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem removing temporary directory: " << "Problem removing temporary directory: " <<

@ -12,34 +12,11 @@
#include "cmCPackTGZGenerator.h" #include "cmCPackTGZGenerator.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include <cmsys/SystemTools.hxx>
#include <cm_zlib.h>
#include <libtar/libtar.h>
#include <fcntl.h>
#include <errno.h>
//----------------------------------------------------------------------
class cmCPackTGZGeneratorForward
{
public:
static int GenerateHeader(cmCPackTGZGenerator* gg, std::ostream* os)
{
return gg->GenerateHeader(os);
}
};
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackTGZGenerator::cmCPackTGZGenerator() cmCPackTGZGenerator::cmCPackTGZGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::GZIP,
cmCPackArchiveGenerator::TAR)
{ {
this->Compress = true;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -47,248 +24,3 @@ cmCPackTGZGenerator::~cmCPackTGZGenerator()
{ {
} }
static const size_t cmCPackTGZ_Data_BlockSize = 16384;
//----------------------------------------------------------------------
class cmCPackTGZ_Data
{
public:
cmCPackTGZ_Data(cmCPackTGZGenerator* gen, bool compress) :
OutputStream(0), Generator(gen),
CompressionLevel(Z_DEFAULT_COMPRESSION),
Compress(compress) {}
std::ostream* OutputStream;
cmCPackTGZGenerator* Generator;
char CompressedBuffer[cmCPackTGZ_Data_BlockSize];
int CompressionLevel;
z_stream ZLibStream;
uLong CRC;
bool Compress;
};
//----------------------------------------------------------------------
extern "C" {
int cmCPackTGZ_Data_Open(void *client_data, const char* name, int oflags,
mode_t mode);
ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n);
int cmCPackTGZ_Data_Close(void *client_data);
}
//----------------------------------------------------------------------
int cmCPackTGZ_Data_Open(void *client_data, const char* pathname,
int, mode_t)
{
cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data;
if ( mydata->Compress )
{
mydata->ZLibStream.zalloc = Z_NULL;
mydata->ZLibStream.zfree = Z_NULL;
mydata->ZLibStream.opaque = Z_NULL;
int strategy = Z_DEFAULT_STRATEGY;
if ( deflateInit2(&mydata->ZLibStream, mydata->CompressionLevel,
Z_DEFLATED, -MAX_WBITS, 8, strategy) != Z_OK )
{
return -1;
}
}
cmGeneratedFileStream* gf = new cmGeneratedFileStream;
// Open binary
gf->Open(pathname, false, true);
mydata->OutputStream = gf;
if ( !*mydata->OutputStream )
{
return -1;
}
if ( !cmCPackTGZGeneratorForward::GenerateHeader(mydata->Generator,gf))
{
return -1;
}
if ( mydata->Compress )
{
mydata->CRC = crc32(0L, Z_NULL, 0);
}
return 0;
}
//----------------------------------------------------------------------
ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n)
{
cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data;
if ( mydata->Compress )
{
mydata->ZLibStream.avail_in = static_cast<uInt>(n);
mydata->ZLibStream.next_in = reinterpret_cast<Bytef*>(buff);
do {
mydata->ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize;
mydata->ZLibStream.next_out
= reinterpret_cast<Bytef*>(mydata->CompressedBuffer);
// no bad return value
int ret = deflate(&mydata->ZLibStream, (n?Z_NO_FLUSH:Z_FINISH));
if(ret == Z_STREAM_ERROR)
{
return 0;
}
size_t compressedSize
= cmCPackTGZ_Data_BlockSize - mydata->ZLibStream.avail_out;
mydata->OutputStream->write(
reinterpret_cast<const char*>(mydata->CompressedBuffer),
compressedSize);
} while ( mydata->ZLibStream.avail_out == 0 );
if ( !*mydata->OutputStream )
{
return 0;
}
if ( n )
{
mydata->CRC = crc32(mydata->CRC, reinterpret_cast<Bytef *>(buff),
static_cast<uInt>(n));
}
}
else
{
mydata->OutputStream->write(reinterpret_cast<char*>(buff), n);
}
return n;
}
//----------------------------------------------------------------------
int cmCPackTGZ_Data_Close(void *client_data)
{
cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data;
if ( mydata->Compress )
{
cmCPackTGZ_Data_Write(client_data, 0, 0);
char buffer[8];
int n;
uLong x = mydata->CRC;
for (n = 0; n < 4; n++) {
buffer[n] = static_cast<char>(x & 0xff);
x >>= 8;
}
x = mydata->ZLibStream.total_in;
for (n = 0; n < 4; n++) {
buffer[n+4] = static_cast<char>(x & 0xff);
x >>= 8;
}
mydata->OutputStream->write(buffer, 8);
(void)deflateEnd(&mydata->ZLibStream);
}
delete mydata->OutputStream;
mydata->OutputStream = 0;
return (0);
}
//----------------------------------------------------------------------
int cmCPackTGZGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
return this->Superclass::InitializeInternal();
}
//----------------------------------------------------------------------
int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< (toplevel ? toplevel : "(NULL)") << std::endl);
cmCPackTGZ_Data mydata(this, this->Compress);
TAR *t;
char buf[TAR_MAXPATHLEN];
char pathname[TAR_MAXPATHLEN];
tartype_t gztype = {
(openfunc_t)cmCPackTGZ_Data_Open,
(closefunc_t)cmCPackTGZ_Data_Close,
(readfunc_t)0,
(writefunc_t)cmCPackTGZ_Data_Write,
&mydata
};
// This libtar is not const safe. Make a non-const copy of outFileName
char* realName = new char[ strlen(outFileName) + 1 ];
strcpy(realName, outFileName);
int flags = O_WRONLY | O_CREAT;
int options = 0;
if(this->GeneratorVerbose)
{
options |= TAR_VERBOSE;
}
#ifdef __CYGWIN__
options |= TAR_GNU;
#endif
if (tar_open(&t, realName,
&gztype,
flags, 0644,
options) == -1)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
<< strerror(errno) << std::endl);
delete [] realName;
return 0;
}
delete [] realName;
std::vector<std::string>::const_iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
strncpy(pathname, fileIt->c_str(), sizeof(pathname));
pathname[sizeof(pathname)-1] = 0;
strncpy(buf, rp.c_str(), sizeof(buf));
buf[sizeof(buf)-1] = 0;
if (tar_append_tree(t, pathname, buf) != 0)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem with tar_append_tree(\"" << buf << "\", \""
<< pathname << "\"): "
<< strerror(errno) << std::endl);
tar_close(t);
return 0;
}
}
if (tar_append_eof(t) != 0)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): "
<< strerror(errno) << std::endl);
tar_close(t);
return 0;
}
if (tar_close(t) != 0)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): "
<< strerror(errno) << std::endl);
return 0;
}
return 1;
}
//----------------------------------------------------------------------
int cmCPackTGZGenerator::GenerateHeader(std::ostream* os)
{
if ( this->Compress )
{
const int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
char header[11];
sprintf(header, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/,
3 /* zlib os code for UNIX, not really used anyway */);
os->write(header, 10);
}
return 1;
}

@ -13,35 +13,23 @@
#ifndef cmCPackTGZGenerator_h #ifndef cmCPackTGZGenerator_h
#define cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h
#include "cmCPackGenerator.h" #include "cmCPackArchiveGenerator.h"
class cmCPackTGZGeneratorForward;
/** \class cmCPackTGZGenerator /** \class cmCPackTGZGenerator
* \brief A generator for TGZ files * \brief A generator for TGZ files
* *
* http://people.freebsd.org/~kientzle/libarchive/
*/ */
class cmCPackTGZGenerator : public cmCPackGenerator class cmCPackTGZGenerator : public cmCPackArchiveGenerator
{ {
public: public:
friend class cmCPackTGZGeneratorForward; cmCPackTypeMacro(cmCPackTGZGenerator, cmCPackArchiveGenerator);
cmCPackTypeMacro(cmCPackTGZGenerator, cmCPackGenerator);
/** /**
* Construct generator * Construct generator
*/ */
cmCPackTGZGenerator(); cmCPackTGZGenerator();
virtual ~cmCPackTGZGenerator(); virtual ~cmCPackTGZGenerator();
protected: protected:
virtual int InitializeInternal();
virtual int GenerateHeader(std::ostream* os);
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return ".tar.gz"; } virtual const char* GetOutputExtension() { return ".tar.gz"; }
bool Compress;
}; };
#endif #endif

@ -11,29 +11,11 @@
============================================================================*/ ============================================================================*/
#include "cmCPackTarBZip2Generator.h" #include "cmCPackTarBZip2Generator.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include <cmsys/SystemTools.hxx>
// Includes needed for implementation of RenameFile. This is not in
// system tools because it is not implemented robustly enough to move
// files across directories.
#ifdef _WIN32
# include <windows.h>
# include <sys/stat.h>
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() cmCPackTarBZip2Generator::cmCPackTarBZip2Generator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::BZIP2,
cmCPackArchiveGenerator::TAR)
{ {
this->Compress = false;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -41,135 +23,3 @@ cmCPackTarBZip2Generator::~cmCPackTarBZip2Generator()
{ {
} }
//----------------------------------------------------------------------
int cmCPackTarBZip2Generator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
std::vector<std::string> path;
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
if ( pkgPath.empty() )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
return 0;
}
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
<< pkgPath.c_str()
<< std::endl);
return this->Superclass::InitializeInternal();
}
//----------------------------------------------------------------------
int cmCPackTarBZip2Generator::BZip2File(const char* packageDirFileName)
{
int retVal = 0;
cmOStringStream dmgCmd1;
dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" \"" << packageDirFileName
<< "\"";
retVal = -1;
std::string output;
int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
&retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressBZip2.log";
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << dmgCmd1.str().c_str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 command: "
<< dmgCmd1.str().c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
return 1;
}
//----------------------------------------------------------------------
int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
std::string packageDirFileName
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packageDirFileName += ".tar";
std::string output;
if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
toplevel, files) )
{
return 0;
}
if(!this->BZip2File(packageDirFileName.c_str()))
{
return 0;
}
std::string compressOutFile = packageDirFileName + ".bz2";
if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
{
if ( !this->RenameFile(compressOutFile.c_str(), outFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \""
<< compressOutFile.c_str() << "\" to \""
<< (outFileName ? outFileName : "(NULL)") << std::endl);
return 0;
}
}
return 1;
}
//----------------------------------------------------------------------------
int cmCPackTarBZip2Generator::RenameFile(const char* oldname,
const char* newname)
{
#ifdef _WIN32
/* On Windows the move functions will not replace existing files.
Check if the destination exists. */
struct stat newFile;
if(stat(newname, &newFile) == 0)
{
/* The destination exists. We have to replace it carefully. The
MoveFileEx function does what we need but is not available on
Win9x. */
OSVERSIONINFO osv;
DWORD attrs;
/* Make sure the destination is not read only. */
attrs = GetFileAttributes(newname);
if(attrs & FILE_ATTRIBUTE_READONLY)
{
SetFileAttributes(newname, attrs & ~FILE_ATTRIBUTE_READONLY);
}
/* Check the windows version number. */
osv.dwOSVersionInfoSize = sizeof(osv);
GetVersionEx(&osv);
if(osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
/* This is Win9x. There is no MoveFileEx implementation. We
cannot quite rename the file atomically. Just delete the
destination and then move the file. */
DeleteFile(newname);
return MoveFile(oldname, newname);
}
else
{
/* This is not Win9x. Use the MoveFileEx implementation. */
return MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING);
}
}
else
{
/* The destination does not exist. Just move the file. */
return MoveFile(oldname, newname);
}
#else
/* On UNIX we have an OS-provided call to do this atomically. */
return rename(oldname, newname) == 0;
#endif
}

@ -13,30 +13,22 @@
#ifndef cmCPackTarBZip2Generator_h #ifndef cmCPackTarBZip2Generator_h
#define cmCPackTarBZip2Generator_h #define cmCPackTarBZip2Generator_h
#include "cmCPackTGZGenerator.h" #include "cmCPackArchiveGenerator.h"
/** \class cmCPackTarBZip2Generator /** \class cmCPackTarBZip2Generator
* \brief A generator for TarBZip2 files * \brief A generator for TarBZip2 files
*/ */
class cmCPackTarBZip2Generator : public cmCPackTGZGenerator class cmCPackTarBZip2Generator : public cmCPackArchiveGenerator
{ {
public: public:
friend class cmCPackTarBZip2GeneratorForward; cmCPackTypeMacro(cmCPackTarBZip2Generator, cmCPackArchiveGenerator);
cmCPackTypeMacro(cmCPackTarBZip2Generator, cmCPackTGZGenerator);
/** /**
* Construct generator * Construct generator
*/ */
cmCPackTarBZip2Generator(); cmCPackTarBZip2Generator();
virtual ~cmCPackTarBZip2Generator(); virtual ~cmCPackTarBZip2Generator();
protected: protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return ".tar.bz2"; } virtual const char* GetOutputExtension() { return ".tar.bz2"; }
int BZip2File(const char* filename);
int RenameFile(const char* oldname, const char* newname);
}; };
#endif #endif

@ -12,32 +12,10 @@
#include "cmCPackTarCompressGenerator.h" #include "cmCPackTarCompressGenerator.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include <cmsys/SystemTools.hxx>
#include <cmcompress/cmcompress.h>
#include <libtar/libtar.h>
#include <fcntl.h>
#include <errno.h>
//----------------------------------------------------------------------
class cmCPackTarCompressGeneratorForward
{
public:
static int GenerateHeader(cmCPackTarCompressGenerator* gg, std::ostream* os)
{
return gg->GenerateHeader(os);
}
};
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::COMPRESS,
cmCPackArchiveGenerator::TAR)
{ {
} }
@ -46,206 +24,3 @@ cmCPackTarCompressGenerator::~cmCPackTarCompressGenerator()
{ {
} }
//----------------------------------------------------------------------
class cmCPackTarCompress_Data
{
public:
cmCPackTarCompress_Data(cmCPackTarCompressGenerator* gen) :
OutputStream(0), Generator(gen) {}
std::ostream* OutputStream;
cmCPackTarCompressGenerator* Generator;
cmcompress_stream CMCompressStream;
};
//----------------------------------------------------------------------
extern "C" {
// For cmTar
int cmCPackTarCompress_Data_Open(void *client_data, const char* name,
int oflags, mode_t mode);
ssize_t cmCPackTarCompress_Data_Write(void *client_data, void *buff,
size_t n);
int cmCPackTarCompress_Data_Close(void *client_data);
// For cmCompress
int cmCPackTarCompress_Compress_Output(void* cdata, const char* data,
int len);
}
//----------------------------------------------------------------------
int cmCPackTarCompress_Data_Open(void *client_data, const char* pathname,
int, mode_t)
{
cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data;
if ( !cmcompress_compress_initialize(&mydata->CMCompressStream) )
{
return -1;
}
mydata->CMCompressStream.client_data = mydata;
mydata->CMCompressStream.output_stream = cmCPackTarCompress_Compress_Output;
cmGeneratedFileStream* gf = new cmGeneratedFileStream;
// Open binary
gf->Open(pathname, false, true);
mydata->OutputStream = gf;
if ( !*mydata->OutputStream )
{
return -1;
}
if ( !cmcompress_compress_start(&mydata->CMCompressStream) )
{
return -1;
}
if ( !cmCPackTarCompressGeneratorForward::GenerateHeader(
mydata->Generator,gf))
{
return -1;
}
return 0;
}
//----------------------------------------------------------------------
ssize_t cmCPackTarCompress_Data_Write(void *client_data, void *buff, size_t n)
{
cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data;
if ( !cmcompress_compress(&mydata->CMCompressStream, buff, n) )
{
return 0;
}
return n;
}
//----------------------------------------------------------------------
int cmCPackTarCompress_Data_Close(void *client_data)
{
cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data;
if ( !cmcompress_compress_finalize(&mydata->CMCompressStream) )
{
delete mydata->OutputStream;
return -1;
}
delete mydata->OutputStream;
mydata->OutputStream = 0;
return (0);
}
//----------------------------------------------------------------------
int cmCPackTarCompressGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
return this->Superclass::InitializeInternal();
}
//----------------------------------------------------------------------
int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< (toplevel ? toplevel : "(NULL)") << std::endl);
cmCPackTarCompress_Data mydata(this);
TAR *t;
char buf[TAR_MAXPATHLEN];
char pathname[TAR_MAXPATHLEN];
tartype_t compressType = {
(openfunc_t)cmCPackTarCompress_Data_Open,
(closefunc_t)cmCPackTarCompress_Data_Close,
(readfunc_t)0,
(writefunc_t)cmCPackTarCompress_Data_Write,
&mydata
};
// This libtar is not const safe. Make a non-const copy of outFileName
char* realName = new char[ strlen(outFileName) + 1 ];
strcpy(realName, outFileName);
int flags = O_WRONLY | O_CREAT;
int options = 0;
if(this->GeneratorVerbose)
{
options |= TAR_VERBOSE;
}
#ifdef __CYGWIN__
options |= TAR_GNU;
#endif
if (tar_open(&t, realName,
&compressType,
flags, 0644,
options) == -1)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
<< strerror(errno) << std::endl);
delete [] realName;
return 0;
}
delete [] realName;
std::vector<std::string>::const_iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
strncpy(pathname, fileIt->c_str(), sizeof(pathname));
pathname[sizeof(pathname)-1] = 0;
strncpy(buf, rp.c_str(), sizeof(buf));
buf[sizeof(buf)-1] = 0;
if (tar_append_tree(t, pathname, buf) != 0)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem with tar_append_tree(\"" << buf << "\", \""
<< pathname << "\"): "
<< strerror(errno) << std::endl);
tar_close(t);
return 0;
}
}
if (tar_append_eof(t) != 0)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): "
<< strerror(errno) << std::endl);
tar_close(t);
return 0;
}
if (tar_close(t) != 0)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): "
<< strerror(errno) << std::endl);
return 0;
}
return 1;
}
//----------------------------------------------------------------------
int cmCPackTarCompress_Compress_Output(void* client_data,
const char* data, int data_length)
{
if(!client_data)
{
return 0;
}
cmcompress_stream *cstream = static_cast<cmcompress_stream*>(client_data);
cmCPackTarCompress_Data *mydata
= static_cast<cmCPackTarCompress_Data*>(cstream->client_data);
if ( !mydata->OutputStream )
{
return 0;
}
mydata->OutputStream->write(data, data_length);
return data_length;
}
//----------------------------------------------------------------------
int cmCPackTarCompressGenerator::GenerateHeader(std::ostream* os)
{
(void)os;
return 1;
}

@ -18,12 +18,10 @@
/** \class cmCPackTarCompressGenerator /** \class cmCPackTarCompressGenerator
* \brief A generator for TarCompress files * \brief A generator for TarCompress files
*/ */
class cmCPackTarCompressGenerator : public cmCPackTGZGenerator class cmCPackTarCompressGenerator : public cmCPackArchiveGenerator
{ {
public: public:
friend class cmCPackTarCompressGeneratorForward; cmCPackTypeMacro(cmCPackTarCompressGenerator, cmCPackArchiveGenerator);
cmCPackTypeMacro(cmCPackTarCompressGenerator, cmCPackTGZGenerator);
/** /**
* Construct generator * Construct generator
*/ */
@ -31,13 +29,7 @@ public:
virtual ~cmCPackTarCompressGenerator(); virtual ~cmCPackTarCompressGenerator();
protected: protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return ".tar.Z"; } virtual const char* GetOutputExtension() { return ".tar.Z"; }
int RenameFile(const char* oldname, const char* newname);
int GenerateHeader(std::ostream* os);
}; };
#endif #endif

@ -12,14 +12,10 @@
#include "cmCPackZIPGenerator.h" #include "cmCPackZIPGenerator.h"
#include "cmSystemTools.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackLog.h"
#include <cmsys/SystemTools.hxx>
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackZIPGenerator::cmCPackZIPGenerator() cmCPackZIPGenerator::cmCPackZIPGenerator()
:cmCPackArchiveGenerator(cmCPackArchiveGenerator::NONE,
cmCPackArchiveGenerator::ZIP)
{ {
} }
@ -28,71 +24,3 @@ cmCPackZIPGenerator::~cmCPackZIPGenerator()
{ {
} }
//----------------------------------------------------------------------
int cmCPackZIPGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
this->ReadListFile("CPackZIP.cmake");
if ((!this->IsSet("ZIP_EXECUTABLE"))
|| (!this->IsSet("CPACK_ZIP_COMMAND")))
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find a suitable ZIP program"
<< std::endl);
return 0;
}
return this->Superclass::InitializeInternal();
}
//----------------------------------------------------------------------
int cmCPackZIPGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
std::string tempFileName;
tempFileName = toplevel;
tempFileName += "/winZip.filelist";
bool needQuotesInFile = cmSystemTools::IsOn(
this->GetOption("CPACK_ZIP_NEED_QUOTES"));
std::string cmd = this->GetOption("CPACK_ZIP_COMMAND");
cmsys::SystemTools::ReplaceString(cmd, "<ARCHIVE>", outFileName);
cmsys::SystemTools::ReplaceString(cmd, "<FILELIST>", "winZip.filelist");
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(tempFileName.c_str());
std::vector<std::string>::const_iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
if ( needQuotesInFile )
{
out << "\"";
}
out << cmSystemTools::RelativePath(toplevel, fileIt->c_str());
if ( needQuotesInFile )
{
out << "\"";
}
out << std::endl;
}
}
std::string output;
int retVal = -1;
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
&retVal, toplevel, this->GeneratorVerbose, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressZip.log";
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << cmd.c_str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: "
<< cmd.c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
return 1;
}

@ -13,18 +13,15 @@
#ifndef cmCPackZIPGenerator_h #ifndef cmCPackZIPGenerator_h
#define cmCPackZIPGenerator_h #define cmCPackZIPGenerator_h
#include "cmCPackGenerator.h" #include "cmCPackArchiveGenerator.h"
class cmCPackZIPGeneratorForward;
/** \class cmCPackZIPGenerator /** \class cmCPackZIPGenerator
* \brief A generator for ZIP files * \brief A generator for ZIP files
*/ */
class cmCPackZIPGenerator : public cmCPackGenerator class cmCPackZIPGenerator : public cmCPackArchiveGenerator
{ {
public: public:
friend class cmCPackZIPGeneratorForward; cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackArchiveGenerator);
cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackGenerator);
/** /**
* Construct generator * Construct generator
@ -33,12 +30,7 @@ public:
virtual ~cmCPackZIPGenerator(); virtual ~cmCPackZIPGenerator();
protected: protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return ".zip"; } virtual const char* GetOutputExtension() { return ".zip"; }
int ZipStyle;
}; };
#endif #endif

@ -292,7 +292,7 @@ private:
if(this->EmailRegex.find(this->Rev.Author)) if(this->EmailRegex.find(this->Rev.Author))
{ {
this->Rev.Author = this->EmailRegex.match(1); this->Rev.Author = this->EmailRegex.match(1);
//email = email_regex.match(2); this->Rev.EMail = this->EmailRegex.match(2);
} }
} }
else if(strcmp(name, "timestamp") == 0 && !this->CData.empty()) else if(strcmp(name, "timestamp") == 0 && !this->CData.empty())

@ -60,10 +60,12 @@ public:
virtual const char* GetFullDocumentation() virtual const char* GetFullDocumentation()
{ {
return return
" ctest_build([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" " ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res]\n"
" [NUMBER_ERRORS val] [NUMBER_WARNINGS val])\n" " [APPEND][NUMBER_ERRORS val] [NUMBER_WARNINGS val])\n"
"Builds the given build directory and stores results in Build.xml. " "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 " "The RETURN_VALUE option specifies a variable in which to store the "
"return value of the native build tool. " "return value of the native build tool. "
"The NUMBER_ERRORS and NUMBER_WARNINGS options specify variables in " "The NUMBER_ERRORS and NUMBER_WARNINGS options specify variables in "

@ -551,6 +551,7 @@ class cmCTestBuildHandler::FragmentCompare
{ {
public: public:
FragmentCompare(cmFileTimeComparison* ftc): FTC(ftc) {} FragmentCompare(cmFileTimeComparison* ftc): FTC(ftc) {}
FragmentCompare(): FTC(0) {}
bool operator()(std::string const& l, std::string const& r) bool operator()(std::string const& l, std::string const& r)
{ {
// Order files by modification time. Use lexicographic order // Order files by modification time. Use lexicographic order

@ -10,6 +10,7 @@
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "cmCTestCoverageHandler.h" #include "cmCTestCoverageHandler.h"
#include "cmParsePHPCoverage.h"
#include "cmCTest.h" #include "cmCTest.h"
#include "cmake.h" #include "cmake.h"
#include "cmMakefile.h" #include "cmMakefile.h"
@ -125,20 +126,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;
};
//**********************************************************************
//---------------------------------------------------------------------- //----------------------------------------------------------------------
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -380,7 +367,6 @@ int cmCTestCoverageHandler::ProcessHandler()
cmsys::RegularExpression(rexIt->c_str())); cmsys::RegularExpression(rexIt->c_str()));
} }
if(this->HandleBullseyeCoverage(&cont)) if(this->HandleBullseyeCoverage(&cont))
{ {
return cont.Error; return cont.Error;
@ -392,12 +378,18 @@ int cmCTestCoverageHandler::ProcessHandler()
return error; return error;
} }
file_count += this->HandleTracePyCoverage(&cont); file_count += this->HandleTracePyCoverage(&cont);
if ( file_count < 0 )
{
return error;
}
file_count += this->HandlePHPCoverage(&cont);
if ( file_count < 0 ) if ( file_count < 0 )
{ {
return error; return error;
} }
error = cont.Error; error = cont.Error;
std::set<std::string> uncovered = this->FindUncoveredFiles(&cont);
if ( file_count == 0 ) if ( file_count == 0 )
{ {
@ -524,7 +516,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{ {
cmOStringStream ostr; cmOStringStream ostr;
ostr << "Problem reading source file: " << fullFileName.c_str() ostr << "Problem reading source file: " << fullFileName.c_str()
<< " line:" << cc; << " line:" << cc << " out total: " << fcov.size()-1;
errorsWhileAccumulating.push_back(ostr.str()); errorsWhileAccumulating.push_back(ostr.str());
error ++; error ++;
break; break;
@ -577,13 +569,58 @@ int cmCTestCoverageHandler::ProcessHandler()
this->WriteXMLLabels(covSumFile, shortFileName); this->WriteXMLLabels(covSumFile, shortFileName);
covSumFile << "\t</File>" << std::endl; covSumFile << "\t</File>" << std::endl;
} }
//Handle all the files in the extra coverage globs that have no cov data
for(std::set<std::string>::iterator i = uncovered.begin();
i != uncovered.end(); ++i)
{
std::string fileName = cmSystemTools::GetFilenameName(*i);
std::string fullPath = cont.SourceDir + "/" + *i;
covLogFile << "\t<File Name=\"" << cmXMLSafe(fileName)
<< "\" FullPath=\"" << cmXMLSafe(*i) << "\">\n"
<< "\t\t<Report>" << std::endl;
std::ifstream ifs(fullPath.c_str());
if (!ifs)
{
cmOStringStream ostr;
ostr << "Cannot open source file: " << fullPath.c_str();
errorsWhileAccumulating.push_back(ostr.str());
error ++;
continue;
}
int untested = 0;
std::string line;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Actually perfoming coverage for: " << i->c_str() << std::endl);
while (cmSystemTools::GetLineFromStream(ifs, line))
{
covLogFile << "\t\t<Line Number=\"" << untested << "\" Count=\"0\">"
<< cmXMLSafe(line) << "</Line>" << std::endl;
untested ++;
}
covLogFile << "\t\t</Report>\n\t</File>" << std::endl;
total_untested += untested;
covSumFile << "\t<File Name=\"" << cmXMLSafe(fileName)
<< "\" FullPath=\"" << cmXMLSafe(i->c_str())
<< "\" Covered=\"true\">\n"
<< "\t\t<LOCTested>0</LOCTested>\n"
<< "\t\t<LOCUnTested>" << untested << "</LOCUnTested>\n"
<< "\t\t<PercentCoverage>0</PercentCoverage>\n"
<< "\t\t<CoverageMetric>0</CoverageMetric>\n";
this->WriteXMLLabels(covSumFile, *i);
covSumFile << "\t</File>" << std::endl;
}
this->EndCoverageLogFile(covLogFile, logFileCount); this->EndCoverageLogFile(covLogFile, logFileCount);
if ( errorsWhileAccumulating.size() > 0 ) if ( errorsWhileAccumulating.size() > 0 )
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl);
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error(s) while acumulating results:" << std::endl); "Error(s) while accumulating results:" << std::endl);
std::vector<std::string>::iterator erIt; std::vector<std::string>::iterator erIt;
for ( erIt = errorsWhileAccumulating.begin(); for ( erIt = errorsWhileAccumulating.begin();
erIt != errorsWhileAccumulating.end(); erIt != errorsWhileAccumulating.end();
@ -654,6 +691,8 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
" Add coverage exclude regular expressions." << std::endl); " Add coverage exclude regular expressions." << std::endl);
this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE", this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
this->CustomCoverageExclude); this->CustomCoverageExclude);
this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB",
this->ExtraCoverageGlobs);
std::vector<cmStdString>::iterator it; std::vector<cmStdString>::iterator it;
for ( it = this->CustomCoverageExclude.begin(); for ( it = this->CustomCoverageExclude.begin();
it != this->CustomCoverageExclude.end(); it != this->CustomCoverageExclude.end();
@ -662,6 +701,12 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: "
<< it->c_str() << std::endl); << it->c_str() << std::endl);
} }
for ( it = this->ExtraCoverageGlobs.begin();
it != this->ExtraCoverageGlobs.end(); ++it)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: "
<< it->c_str() << std::endl);
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -694,6 +739,18 @@ bool IsFileInDir(const std::string &infile, const std::string &indir)
return false; return false;
} }
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandlePHPCoverage(
cmCTestCoverageHandlerContainer* cont)
{
cmParsePHPCoverage cov(*cont, this->CTest);
std::string coverageDir = this->CTest->GetBinaryDir() + "/xdebugCoverage";
if(cmSystemTools::FileIsDirectory(coverageDir.c_str()))
{
cov.ReadPHPCoverageDirectory(coverageDir.c_str());
}
return static_cast<int>(cont->TotalCoverage.size());
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage( int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont) cmCTestCoverageHandlerContainer* cont)
@ -1703,6 +1760,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
<< "</ElapsedMinutes>" << "</ElapsedMinutes>"
<< "</Coverage>" << std::endl; << "</Coverage>" << std::endl;
this->CTest->EndXML(covSumFile); this->CTest->EndXML(covSumFile);
// Now create the coverage information for each file // Now create the coverage information for each file
return this->RunBullseyeCoverageBranch(cont, return this->RunBullseyeCoverageBranch(cont,
coveredFileNames, coveredFileNames,
@ -1961,3 +2019,43 @@ bool cmCTestCoverageHandler::IsFilteredOut(std::string const& source)
} }
return true; return true;
} }
//----------------------------------------------------------------------
std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
cmCTestCoverageHandlerContainer* cont)
{
std::set<std::string> extraMatches;
for(std::vector<cmStdString>::iterator i = this->ExtraCoverageGlobs.begin();
i != this->ExtraCoverageGlobs.end(); ++i)
{
cmsys::Glob gl;
gl.RecurseOn();
gl.RecurseThroughSymlinksOff();
std::string glob = cont->SourceDir + "/" + *i;
gl.FindFiles(glob);
std::vector<std::string> files = gl.GetFiles();
for(std::vector<std::string>::iterator f = files.begin();
f != files.end(); ++f)
{
if(this->ShouldIDoCoverage(f->c_str(),
cont->SourceDir.c_str(), cont->BinaryDir.c_str()))
{
extraMatches.insert(this->CTest->GetShortPathToFile(
f->c_str()));
}
}
}
if(extraMatches.size())
{
for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i =
cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i)
{
std::string shortPath = this->CTest->GetShortPathToFile(
i->first.c_str());
extraMatches.erase(shortPath);
}
}
return extraMatches;
}

@ -20,8 +20,17 @@
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
class cmGeneratedFileStream; 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 /** \class cmCTestCoverageHandler
* \brief A class that handles coverage computaiton for ctest * \brief A class that handles coverage computaiton for ctest
* *
@ -59,6 +68,9 @@ private:
int HandleGCovCoverage(cmCTestCoverageHandlerContainer* cont); int HandleGCovCoverage(cmCTestCoverageHandlerContainer* cont);
void FindGCovFiles(std::vector<std::string>& files); void FindGCovFiles(std::vector<std::string>& files);
//! Handle coverage using xdebug php coverage
int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont);
//! Handle coverage using Bullseye //! Handle coverage using Bullseye
int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont);
int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont);
@ -66,6 +78,7 @@ private:
std::set<cmStdString>& coveredFileNames, std::set<cmStdString>& coveredFileNames,
std::vector<std::string>& files, std::vector<std::string>& files,
std::vector<std::string>& filesFullPath); std::vector<std::string>& filesFullPath);
int RunBullseyeCommand( int RunBullseyeCommand(
cmCTestCoverageHandlerContainer* cont, cmCTestCoverageHandlerContainer* cont,
const char* cmd, const char* cmd,
@ -91,52 +104,12 @@ private:
std::string FindFile(cmCTestCoverageHandlerContainer* cont, std::string FindFile(cmCTestCoverageHandlerContainer* cont,
std::string fileName); std::string fileName);
struct cmCTestCoverage std::set<std::string> FindUncoveredFiles(
{ cmCTestCoverageHandlerContainer* cont);
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<cmStdString> CustomCoverageExclude;
std::vector<cmsys::RegularExpression> CustomCoverageExcludeRegex; std::vector<cmsys::RegularExpression> CustomCoverageExcludeRegex;
std::vector<cmStdString> ExtraCoverageGlobs;
typedef std::map<std::string, cmCTestCoverage> CoverageMap;
// Map from source file to label ids. // Map from source file to label ids.
class LabelSet: public std::set<int> {}; class LabelSet: public std::set<int> {};

@ -85,14 +85,14 @@ void cmCTestGIT::NoteNewRevision()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmCTestGIT::UpdateImpl() bool cmCTestGIT::UpdateByFetchAndReset()
{ {
// Use "git pull" to update the working tree. const char* git = this->CommandLineTool.c_str();
std::vector<char const*> git_pull;
git_pull.push_back(this->CommandLineTool.c_str());
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. // Add user-specified update options.
std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions"); std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions");
@ -104,15 +104,88 @@ bool cmCTestGIT::UpdateImpl()
for(std::vector<cmStdString>::const_iterator ai = args.begin(); for(std::vector<cmStdString>::const_iterator ai = args.begin();
ai != args.end(); ++ai) ai != args.end(); ++ai)
{ {
git_pull.push_back(ai->c_str()); git_fetch.push_back(ai->c_str());
} }
// Sentinel argument. // 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);
}
}
}
}
// 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)
{
git_custom.push_back(i->c_str());
}
git_custom.push_back(0);
OutputLogger custom_out(this->Log, "custom-out> ");
OutputLogger custom_err(this->Log, "custom-err> ");
return this->RunUpdateCommand(&git_custom[0], &custom_out, &custom_err);
}
OutputLogger out(this->Log, "pull-out> "); //----------------------------------------------------------------------------
OutputLogger err(this->Log, "pull-err> "); bool cmCTestGIT::UpdateInternal()
return this->RunUpdateCommand(&git_pull[0], &out, &err); {
std::string custom = this->CTest->GetCTestConfiguration("GITUpdateCustom");
if(!custom.empty())
{
return this->UpdateByCustom(custom);
}
return this->UpdateByFetchAndReset();
}
//----------------------------------------------------------------------------
bool cmCTestGIT::UpdateImpl()
{
if(!this->UpdateInternal())
{
return false;
}
const char* git = this->CommandLineTool.c_str();
char const* git_submodule[] = {git, "submodule", "update", 0};
OutputLogger submodule_out(this->Log, "submodule-out> ");
OutputLogger submodule_err(this->Log, "submodule-err> ");
return this->RunChild(git_submodule, &submodule_out, &submodule_err);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -338,6 +411,7 @@ private:
Person author; Person author;
this->ParsePerson(this->Line.c_str()+7, author); this->ParsePerson(this->Line.c_str()+7, author);
this->Rev.Author = author.Name; this->Rev.Author = author.Name;
this->Rev.EMail = author.EMail;
// Convert the time to a human-readable format that is also easy // Convert the time to a human-readable format that is also easy
// to machine-parse: "CCYY-MM-DD hh:mm:ss". // to machine-parse: "CCYY-MM-DD hh:mm:ss".

@ -32,9 +32,14 @@ private:
virtual void NoteNewRevision(); virtual void NoteNewRevision();
virtual bool UpdateImpl(); virtual bool UpdateImpl();
bool UpdateByFetchAndReset();
bool UpdateByCustom(std::string const& custom);
bool UpdateInternal();
void LoadRevisions(); void LoadRevisions();
void LoadModifications(); void LoadModifications();
public: // needed by older Sun compilers
// Parsing helper classes. // Parsing helper classes.
class OneLineParser; class OneLineParser;
class DiffParser; class DiffParser;

@ -220,7 +220,7 @@ private:
} }
else if ( strcmp(name, "email") == 0 && !this->CData.empty()) else if ( strcmp(name, "email") == 0 && !this->CData.empty())
{ {
// this->Rev.Email.assign(&this->CData[0], this->CData.size()); this->Rev.EMail.assign(&this->CData[0], this->CData.size());
} }
else if(strcmp(name, "date") == 0 && !this->CData.empty()) else if(strcmp(name, "date") == 0 && !this->CData.empty())
{ {

@ -16,12 +16,14 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include <stdlib.h> #include <stdlib.h>
#include <stack> #include <stack>
#include <float.h>
cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
{ {
this->ParallelLevel = 1; this->ParallelLevel = 1;
this->Completed = 0; this->Completed = 0;
this->RunningCount = 0; this->RunningCount = 0;
this->StopTimePassed = false;
} }
cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler()
@ -68,6 +70,10 @@ void cmCTestMultiProcessHandler::RunTests()
this->StartNextTests(); this->StartNextTests();
while(this->Tests.size() != 0) while(this->Tests.size() != 0)
{ {
if(this->StopTimePassed)
{
return;
}
this->CheckOutput(); this->CheckOutput();
this->StartNextTests(); this->StartNextTests();
} }
@ -76,6 +82,7 @@ void cmCTestMultiProcessHandler::RunTests()
{ {
} }
this->MarkFinished(); this->MarkFinished();
this->UpdateCostData();
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -93,12 +100,22 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(this->Properties[test]->Directory.c_str()); cmSystemTools::ChangeDirectory(this->Properties[test]->Directory.c_str());
// Lock the resources we'll be using
this->LockResources(test);
if(testRun->StartTest(this->Total)) if(testRun->StartTest(this->Total))
{ {
this->RunningTests.insert(testRun); this->RunningTests.insert(testRun);
} }
else if(testRun->IsStopTimePassed())
{
this->StopTimePassed = true;
delete testRun;
return;
}
else else
{ {
this->UnlockResources(test);
this->Completed++; this->Completed++;
this->TestFinishMap[test] = true; this->TestFinishMap[test] = true;
this->TestRunningMap[test] = false; this->TestRunningMap[test] = false;
@ -110,6 +127,28 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
cmSystemTools::ChangeDirectory(current_dir.c_str()); cmSystemTools::ChangeDirectory(current_dir.c_str());
} }
//---------------------------------------------------------
void cmCTestMultiProcessHandler::LockResources(int index)
{
for(std::set<std::string>::iterator i =
this->Properties[index]->LockedResources.begin();
i != this->Properties[index]->LockedResources.end(); ++i)
{
this->LockedResources.insert(*i);
}
}
//---------------------------------------------------------
void cmCTestMultiProcessHandler::UnlockResources(int index)
{
for(std::set<std::string>::iterator i =
this->Properties[index]->LockedResources.begin();
i != this->Properties[index]->LockedResources.end(); ++i)
{
this->LockedResources.erase(*i);
}
}
//--------------------------------------------------------- //---------------------------------------------------------
void cmCTestMultiProcessHandler::EraseTest(int test) void cmCTestMultiProcessHandler::EraseTest(int test)
{ {
@ -144,6 +183,17 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test)
//--------------------------------------------------------- //---------------------------------------------------------
bool cmCTestMultiProcessHandler::StartTest(int test) bool cmCTestMultiProcessHandler::StartTest(int test)
{ {
//Check for locked resources
for(std::set<std::string>::iterator i =
this->Properties[test]->LockedResources.begin();
i != this->Properties[test]->LockedResources.end(); ++i)
{
if(this->LockedResources.find(*i) != this->LockedResources.end())
{
return false;
}
}
// copy the depend tests locally because when // copy the depend tests locally because when
// a test is finished it will be removed from the depend list // a test is finished it will be removed from the depend list
// and we don't want to be iterating a list while removing from it // and we don't want to be iterating a list while removing from it
@ -212,6 +262,10 @@ void cmCTestMultiProcessHandler::StartNextTests()
} }
if(this->StartTest(*test)) if(this->StartTest(*test))
{ {
if(this->StopTimePassed)
{
return;
}
numToStart -= processors; numToStart -= processors;
this->RunningCount += processors; this->RunningCount += processors;
} }
@ -272,41 +326,140 @@ bool cmCTestMultiProcessHandler::CheckOutput()
this->TestRunningMap[test] = false; this->TestRunningMap[test] = false;
this->RunningTests.erase(p); this->RunningTests.erase(p);
this->WriteCheckpoint(test); this->WriteCheckpoint(test);
this->WriteCostData(test, static_cast<float>( this->UnlockResources(test);
p->GetTestResults().ExecutionTime));
this->RunningCount -= GetProcessorsUsed(test); this->RunningCount -= GetProcessorsUsed(test);
delete p; delete p;
} }
return true; return true;
} }
//---------------------------------------------------------
void cmCTestMultiProcessHandler::UpdateCostData()
{
std::string fname = this->CTest->GetCostDataFile();
std::string tmpout = fname + ".tmp";
std::fstream fout;
fout.open(tmpout.c_str(), std::ios::out);
PropertiesMap temp = this->Properties;
if(cmSystemTools::FileExists(fname.c_str()))
{
std::ifstream fin;
fin.open(fname.c_str());
std::string line;
while(std::getline(fin, line))
{
if(line == "---") break;
std::vector<cmsys::String> parts =
cmSystemTools::SplitString(line.c_str(), ' ');
//Format: <name> <previous_runs> <avg_cost>
if(parts.size() < 3) break;
std::string name = parts[0];
int prev = atoi(parts[1].c_str());
float cost = static_cast<float>(atof(parts[2].c_str()));
int index = this->SearchByName(name);
if(index == -1)
{
// This test is not in memory. We just rewrite the entry
fout << name << " " << prev << " " << cost << "\n";
}
else
{
// Update with our new average cost
fout << name << " " << this->Properties[index]->PreviousRuns << " "
<< this->Properties[index]->Cost << "\n";
temp.erase(index);
}
}
fin.close();
cmSystemTools::RemoveFile(fname.c_str());
}
// Add all tests not previously listed in the file
for(PropertiesMap::iterator i = temp.begin(); i != temp.end(); ++i)
{
fout << i->second->Name << " " << i->second->PreviousRuns << " "
<< i->second->Cost << "\n";
}
// Write list of failed tests
fout << "---\n";
for(std::vector<cmStdString>::iterator i = this->Failed->begin();
i != this->Failed->end(); ++i)
{
fout << i->c_str() << "\n";
}
fout.close();
cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str());
}
//--------------------------------------------------------- //---------------------------------------------------------
void cmCTestMultiProcessHandler::ReadCostData() void cmCTestMultiProcessHandler::ReadCostData()
{ {
std::string fname = this->CTest->GetBinaryDir() std::string fname = this->CTest->GetCostDataFile();
+ "/Testing/Temporary/CTestCostData.txt";
if(cmSystemTools::FileExists(fname.c_str(), true) if(cmSystemTools::FileExists(fname.c_str(), true))
&& this->ParallelLevel > 1)
{ {
std::ifstream fin; std::ifstream fin;
fin.open(fname.c_str()); fin.open(fname.c_str());
std::string line; std::string line;
while(std::getline(fin, line)) while(std::getline(fin, line))
{ {
if(line == "---") break;
std::vector<cmsys::String> parts = std::vector<cmsys::String> parts =
cmSystemTools::SplitString(line.c_str(), ' '); cmSystemTools::SplitString(line.c_str(), ' ');
int index = atoi(parts[0].c_str()); // Probably an older version of the file, will be fixed next run
float cost = static_cast<float>(atof(parts[1].c_str())); if(parts.size() < 3)
{
fin.close();
return;
}
std::string name = parts[0];
int prev = atoi(parts[1].c_str());
float cost = static_cast<float>(atof(parts[2].c_str()));
int index = this->SearchByName(name);
if(index == -1) continue;
this->Properties[index]->PreviousRuns = prev;
if(this->Properties[index] && this->Properties[index]->Cost == 0) if(this->Properties[index] && this->Properties[index]->Cost == 0)
{ {
this->Properties[index]->Cost = cost; this->Properties[index]->Cost = cost;
} }
} }
// Next part of the file is the failed tests
while(std::getline(fin, line))
{
if(line != "")
{
this->LastTestsFailed.push_back(line);
}
}
fin.close(); fin.close();
} }
cmSystemTools::RemoveFile(fname.c_str()); }
//---------------------------------------------------------
int cmCTestMultiProcessHandler::SearchByName(std::string name)
{
int index = -1;
for(PropertiesMap::iterator i = this->Properties.begin();
i != this->Properties.end(); ++i)
{
if(i->second->Name == name)
{
index = i->first;
}
}
return index;
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -315,19 +468,26 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
for(TestMap::iterator i = this->Tests.begin(); for(TestMap::iterator i = this->Tests.begin();
i != this->Tests.end(); ++i) i != this->Tests.end(); ++i)
{ {
//We only want to schedule them by cost in a parallel situation
if(this->ParallelLevel > 1)
{
std::string name = this->Properties[i->first]->Name;
if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(),
name) != this->LastTestsFailed.end())
{
this->TestCosts[FLT_MAX].insert(i->first);
}
else
{
this->TestCosts[this->Properties[i->first]->Cost].insert(i->first); this->TestCosts[this->Properties[i->first]->Cost].insert(i->first);
} }
} }
else //we ignore their cost
//---------------------------------------------------------
void cmCTestMultiProcessHandler::WriteCostData(int index, float cost)
{ {
std::string fname = this->CTest->GetBinaryDir() this->TestCosts[this->Tests.size()
+ "/Testing/Temporary/CTestCostData.txt"; - this->Properties[i->first]->Index].insert(i->first);
std::fstream fout; }
fout.open(fname.c_str(), std::ios::out | std::ios::app); }
fout << index << " " << cost << "\n";
fout.close();
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -336,7 +496,7 @@ void cmCTestMultiProcessHandler::WriteCheckpoint(int index)
std::string fname = this->CTest->GetBinaryDir() std::string fname = this->CTest->GetBinaryDir()
+ "/Testing/Temporary/CTestCheckpoint.txt"; + "/Testing/Temporary/CTestCheckpoint.txt";
std::fstream fout; std::fstream fout;
fout.open(fname.c_str(), std::ios::app); fout.open(fname.c_str(), std::ios::app | std::ios::out);
fout << index << "\n"; fout << index << "\n";
fout.close(); fout.close();
} }

@ -56,7 +56,6 @@ public:
cmCTestTestHandler * GetTestHandler() cmCTestTestHandler * GetTestHandler()
{ return this->TestHandler; } { return this->TestHandler; }
protected: protected:
cmCTest* CTest;
// Start the next test or tests as many as are allowed by // Start the next test or tests as many as are allowed by
// ParallelLevel // ParallelLevel
void StartNextTests(); void StartNextTests();
@ -64,8 +63,12 @@ protected:
bool StartTest(int test); bool StartTest(int test);
// Mark the checkpoint for the given test // Mark the checkpoint for the given test
void WriteCheckpoint(int index); void WriteCheckpoint(int index);
void WriteCostData(int index, float cost);
void UpdateCostData();
void ReadCostData(); void ReadCostData();
// Return index of a test based on its name
int SearchByName(std::string name);
void CreateTestCostList(); void CreateTestCostList();
// Removes the checkpoint file // Removes the checkpoint file
void MarkFinished(); void MarkFinished();
@ -80,6 +83,9 @@ protected:
bool CheckCycles(); bool CheckCycles();
int FindMaxIndex(); int FindMaxIndex();
inline size_t GetProcessorsUsed(int index); inline size_t GetProcessorsUsed(int index);
void LockResources(int index);
void UnlockResources(int index);
// map from test number to set of depend tests // map from test number to set of depend tests
TestMap Tests; TestMap Tests;
TestCostMap TestCosts; TestCostMap TestCosts;
@ -88,6 +94,7 @@ protected:
//Number of tests that are complete //Number of tests that are complete
size_t Completed; size_t Completed;
size_t RunningCount; size_t RunningCount;
bool StopTimePassed;
//list of test properties (indices concurrent to the test map) //list of test properties (indices concurrent to the test map)
PropertiesMap Properties; PropertiesMap Properties;
std::map<int, bool> TestRunningMap; std::map<int, bool> TestRunningMap;
@ -95,10 +102,13 @@ protected:
std::map<int, cmStdString> TestOutput; std::map<int, cmStdString> TestOutput;
std::vector<cmStdString>* Passed; std::vector<cmStdString>* Passed;
std::vector<cmStdString>* Failed; std::vector<cmStdString>* Failed;
std::vector<std::string> LastTestsFailed;
std::set<std::string> LockedResources;
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults; std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
size_t ParallelLevel; // max number of process that can be run at once size_t ParallelLevel; // max number of process that can be run at once
std::set<cmCTestRunTest*> RunningTests; // current running tests std::set<cmCTestRunTest*> RunningTests; // current running tests
cmCTestTestHandler * TestHandler; cmCTestTestHandler * TestHandler;
cmCTest* CTest;
}; };
#endif #endif

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save