summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--CMakeLists.txt6
-rw-r--r--Copyright.txt2
-rw-r--r--Modules/AutomocInfo.cmake.in2
-rw-r--r--Modules/CMakeCCompilerId.c.in3
-rw-r--r--Modules/CMakeCInformation.cmake6
-rw-r--r--Modules/CMakeCXXInformation.cmake6
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake2
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake4
-rw-r--r--Modules/CMakeFortranCompilerABI.F5
-rw-r--r--Modules/CMakeFortranInformation.cmake6
-rw-r--r--Modules/CMakeTestCCompiler.cmake6
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake6
-rw-r--r--Modules/CMakeTestFortranCompiler.cmake6
-rw-r--r--Modules/CPackRPM.cmake99
-rw-r--r--Modules/Compiler/TinyCC-C.cmake8
-rw-r--r--Modules/DeployQt4.cmake8
-rw-r--r--Modules/FindBISON.cmake13
-rw-r--r--Modules/FindBoost.cmake10
-rw-r--r--Modules/FindCUDA.cmake124
-rw-r--r--Modules/FindCUDA/make2cmake.cmake18
-rw-r--r--Modules/FindCUDA/run_nvcc.cmake30
-rw-r--r--Modules/FindGettext.cmake15
-rw-r--r--Modules/FindLAPACK.cmake12
-rw-r--r--Modules/FindPNG.cmake17
-rw-r--r--Modules/FindX11.cmake9
-rw-r--r--Modules/FindZLIB.cmake35
-rw-r--r--Modules/FortranCInterface.cmake8
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake96
-rw-r--r--Modules/Platform/GNUtoMS_lib.bat.in3
-rw-r--r--Modules/Platform/GNUtoMS_lib.cmake10
-rw-r--r--Modules/Platform/Linux-TinyCC-C.cmake4
-rw-r--r--Modules/Platform/Windows-GNU-C-ABI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-CXX-ABI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-Fortran-ABI.cmake1
-rw-r--r--Modules/Platform/Windows-GNU-Fortran.cmake3
-rw-r--r--Modules/Platform/Windows-GNU.cmake54
-rw-r--r--Modules/Qt4Macros.cmake18
-rw-r--r--Modules/UseQt4.cmake6
-rw-r--r--Source/.gitattributes2
-rw-r--r--Source/CMakeLists.txt7
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx12
-rw-r--r--Source/QtDialog/AddCacheEntry.h3
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx25
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h10
-rw-r--r--Source/cmCTest.cxx65
-rw-r--r--Source/cmCTest.h4
-rw-r--r--Source/cmConfigureFileCommand.cxx15
-rw-r--r--Source/cmConfigureFileCommand.h11
-rw-r--r--Source/cmCryptoHash.cxx130
-rw-r--r--Source/cmCryptoHash.h65
-rw-r--r--Source/cmDocumentLocationUndefined.h24
-rw-r--r--Source/cmDocumentVariables.cxx25
-rw-r--r--Source/cmExportBuildFileGenerator.cxx2
-rw-r--r--Source/cmExportCommand.h2
-rw-r--r--Source/cmExportFileGenerator.cxx63
-rw-r--r--Source/cmExportFileGenerator.h5
-rw-r--r--Source/cmExportInstallFileGenerator.cxx30
-rw-r--r--Source/cmExportInstallFileGenerator.h4
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx31
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h5
-rw-r--r--Source/cmFileCommand.cxx46
-rw-r--r--Source/cmFileCommand.h4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmInstallTargetGenerator.cxx26
-rw-r--r--Source/cmLocalGenerator.cxx146
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx14
-rw-r--r--Source/cmMakefile.cxx18
-rw-r--r--Source/cmMakefile.h5
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx10
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx9
-rw-r--r--Source/cmMakefileTargetGenerator.cxx17
-rw-r--r--Source/cmMakefileTargetGenerator.h3
-rw-r--r--Source/cmNewLineStyle.cxx95
-rw-r--r--Source/cmNewLineStyle.h46
-rw-r--r--Source/cmQtAutomoc.cxx410
-rw-r--r--Source/cmQtAutomoc.h14
-rw-r--r--Source/cmStandardIncludes.h5
-rw-r--r--Source/cmStringCommand.cxx39
-rw-r--r--Source/cmStringCommand.h5
-rw-r--r--Source/cmSystemTools.cxx57
-rw-r--r--Source/cmTarget.cxx151
-rw-r--r--Source/cmTarget.h15
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx50
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h33
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx73
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h1
-rw-r--r--Source/cm_sha2.c1613
-rw-r--r--Source/cm_sha2.h140
-rw-r--r--Source/cm_sha2_mangle.h51
-rw-r--r--Source/kwsys/SystemTools.cxx265
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt58
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depA.cpp7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depA.h7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depB.cpp11
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depB.h7
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depC.cpp13
-rw-r--r--Tests/CMakeCommands/target_link_libraries/depC.h12
-rw-r--r--Tests/CMakeCommands/target_link_libraries/targetA.cpp12
-rw-r--r--Tests/CMakeLists.txt57
-rw-r--r--Tests/CMakeTests/.gitattributes1
-rw-r--r--Tests/CMakeTests/CheckCMakeTest.cmake2
-rw-r--r--Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake3
-rw-r--r--Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake3
-rw-r--r--Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake17
-rw-r--r--Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake3
-rw-r--r--Tests/CMakeTests/ConfigureFileTest.cmake.in12
-rw-r--r--Tests/CMakeTests/File-HASH-Input.txt1
-rw-r--r--Tests/CMakeTests/File-MD5-BadArg1.cmake1
-rw-r--r--Tests/CMakeTests/File-MD5-BadArg2.cmake1
-rw-r--r--Tests/CMakeTests/File-MD5-BadArg4.cmake1
-rw-r--r--Tests/CMakeTests/File-MD5-NoFile.cmake1
-rw-r--r--Tests/CMakeTests/File-MD5-Works.cmake2
-rw-r--r--Tests/CMakeTests/File-SHA1-Works.cmake2
-rw-r--r--Tests/CMakeTests/File-SHA224-Works.cmake2
-rw-r--r--Tests/CMakeTests/File-SHA256-Works.cmake2
-rw-r--r--Tests/CMakeTests/File-SHA384-Works.cmake2
-rw-r--r--Tests/CMakeTests/File-SHA512-Works.cmake2
-rw-r--r--Tests/CMakeTests/FileTest.cmake.in30
-rw-r--r--Tests/CMakeTests/String-MD5-BadArg1.cmake1
-rw-r--r--Tests/CMakeTests/String-MD5-BadArg2.cmake1
-rw-r--r--Tests/CMakeTests/String-MD5-BadArg4.cmake1
-rw-r--r--Tests/CMakeTests/String-MD5-Works.cmake2
-rw-r--r--Tests/CMakeTests/String-SHA1-Works.cmake2
-rw-r--r--Tests/CMakeTests/String-SHA224-Works.cmake2
-rw-r--r--Tests/CMakeTests/String-SHA256-Works.cmake2
-rw-r--r--Tests/CMakeTests/String-SHA384-Works.cmake2
-rw-r--r--Tests/CMakeTests/String-SHA512-Works.cmake2
-rw-r--r--Tests/CMakeTests/StringTest.cmake.in32
-rw-r--r--Tests/ExportImport/CMakeLists.txt5
-rw-r--r--Tests/ExportImport/InitialCache.cmake.in1
-rw-r--r--Tests/ExternalProject/CMakeLists.txt7
-rw-r--r--Tests/ExternalProject/Example/CMakeLists.txt2
-rw-r--r--Tests/MFC/CMakeLists.txt61
-rw-r--r--Tests/MFC/CMakeLists.txt.in62
-rw-r--r--Tests/MFC/ValidateBuild.cmake.in68
-rw-r--r--Tests/MFC/mfc1/.gitattributes6
-rw-r--r--Tests/MFC/mfc1/ChildFrm.cpp59
-rw-r--r--Tests/MFC/mfc1/ChildFrm.h34
-rw-r--r--Tests/MFC/mfc1/MainFrm.cpp98
-rw-r--r--Tests/MFC/mfc1/MainFrm.h38
-rw-r--r--Tests/MFC/mfc1/ReadMe.txt135
-rw-r--r--Tests/MFC/mfc1/Resource.h20
-rw-r--r--Tests/MFC/mfc1/mfc1.cpp144
-rw-r--r--Tests/MFC/mfc1/mfc1.h31
-rw-r--r--Tests/MFC/mfc1/mfc1.rc393
-rw-r--r--Tests/MFC/mfc1/mfc1.reg13
-rw-r--r--Tests/MFC/mfc1/mfc1.sln21
-rw-r--r--Tests/MFC/mfc1/mfc1.vcproj216
-rw-r--r--Tests/MFC/mfc1/mfc1Doc.cpp78
-rw-r--r--Tests/MFC/mfc1/mfc1Doc.h37
-rw-r--r--Tests/MFC/mfc1/mfc1View.cpp99
-rw-r--r--Tests/MFC/mfc1/mfc1View.h48
-rw-r--r--Tests/MFC/mfc1/res/Toolbar.bmpbin0 -> 1078 bytes
-rw-r--r--Tests/MFC/mfc1/res/mfc1.icobin0 -> 21630 bytes
-rw-r--r--Tests/MFC/mfc1/res/mfc1.manifest22
-rw-r--r--Tests/MFC/mfc1/res/mfc1.rc213
-rw-r--r--Tests/MFC/mfc1/res/mfc1Doc.icobin0 -> 1078 bytes
-rw-r--r--Tests/MFC/mfc1/stdafx.cpp5
-rw-r--r--Tests/MFC/mfc1/stdafx.h56
-rw-r--r--Tests/QtAutomoc/CMakeLists.txt2
-rw-r--r--Tests/QtAutomoc/abc.cpp49
-rw-r--r--Tests/QtAutomoc/abc.h28
-rw-r--r--Tests/QtAutomoc/abc_p.h30
-rw-r--r--Tests/QtAutomoc/bar.cpp28
-rw-r--r--Tests/QtAutomoc/blub.cpp40
-rw-r--r--Tests/QtAutomoc/blub.h26
-rw-r--r--Tests/QtAutomoc/main.cpp20
-rw-r--r--Tests/QtAutomoc/private_slot.cpp21
-rw-r--r--Tests/QtAutomoc/private_slot.h20
-rw-r--r--Tests/QtAutomoc/sub/bar.h28
-rw-r--r--Tests/QtAutomoc/xyz.cpp28
-rw-r--r--Tests/QtAutomoc/xyz.h28
-rw-r--r--Tests/QtAutomoc/yaf.cpp32
-rw-r--r--Tests/QtAutomoc/yaf.h25
-rw-r--r--Tests/QtAutomoc/yaf_p.h30
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt11
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt11
-rw-r--r--Utilities/KWIML/ABI.h.in466
-rw-r--r--Utilities/KWIML/CMakeLists.txt79
-rw-r--r--Utilities/KWIML/Copyright.txt30
-rw-r--r--Utilities/KWIML/INT.h.in736
-rw-r--r--Utilities/KWIML/README.txt29
-rw-r--r--Utilities/KWIML/test/CMakeLists.txt70
-rw-r--r--Utilities/KWIML/test/test.c39
-rw-r--r--Utilities/KWIML/test/test.cxx12
-rw-r--r--Utilities/KWIML/test/test.h37
-rw-r--r--Utilities/KWIML/test/test_ABI_C.c22
-rw-r--r--Utilities/KWIML/test/test_ABI_CXX.cxx22
-rw-r--r--Utilities/KWIML/test/test_ABI_endian.h.in47
-rw-r--r--Utilities/KWIML/test/test_INT_C.c22
-rw-r--r--Utilities/KWIML/test/test_INT_CXX.cxx22
-rw-r--r--Utilities/KWIML/test/test_INT_format.h.in188
-rw-r--r--Utilities/KWIML/test/test_include_C.c22
-rw-r--r--Utilities/KWIML/test/test_include_CXX.cxx28
-rw-r--r--Utilities/Release/dash2win64_cygwin.cmake1
-rwxr-xr-xbootstrap1
198 files changed, 8361 insertions, 632 deletions
diff --git a/.gitattributes b/.gitattributes
index d9d64d6..d21f1dd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -8,6 +8,7 @@ configure crlf=input
*.sh.in crlf=input
*.bat -crlf
+*.bat.in -crlf
*.dsp -crlf
*.dsptemplate -crlf
*.dsw -crlf
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a586764..5705e6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -214,6 +214,12 @@ ENDMACRO(CMAKE_SET_TARGET_FOLDER)
#-----------------------------------------------------------------------
MACRO (CMAKE_BUILD_UTILITIES)
#---------------------------------------------------------------------
+ # Create the KWIML library for CMake.
+ SET(KWIML cmIML)
+ SET(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
+ ADD_SUBDIRECTORY(Utilities/KWIML)
+
+ #---------------------------------------------------------------------
# Create the kwsys library for CMake.
SET(KWSYS_NAMESPACE cmsys)
SET(KWSYS_USE_SystemTools 1)
diff --git a/Copyright.txt b/Copyright.txt
index 35f7e4b..83a2482 100644
--- a/Copyright.txt
+++ b/Copyright.txt
@@ -1,5 +1,5 @@
CMake - Cross Platform Makefile Generator
-Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in
index 9c71952..44f2da2 100644
--- a/Modules/AutomocInfo.cmake.in
+++ b/Modules/AutomocInfo.cmake.in
@@ -11,4 +11,6 @@ set(AM_QT_MOC_EXECUTABLE "@QT_MOC_EXECUTABLE@")
set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
+set(AM_Qt5Core_VERSION_MAJOR "@Qt5Core_VERSION_MAJOR@" )
set(AM_TARGET_NAME "@_moc_target_name@")
+set(AM_STRICT_MODE "@_moc_strict_mode@")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index c91553a..4cc690a 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -48,6 +48,9 @@
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI_DSP"
+#elif defined(__TINYC__)
+# define COMPILER_ID "TinyCC"
+
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 9285fef..6b5efba 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -68,6 +68,12 @@ IF (NOT _INCLUDED_FILE)
INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
ENDIF (NOT _INCLUDED_FILE)
+IF(CMAKE_C_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_C_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_C_ABI_FILES)
+ENDIF()
# This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 620de63..b97a69c 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -67,6 +67,12 @@ IF (NOT _INCLUDED_FILE)
INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
ENDIF (NOT _INCLUDED_FILE)
+IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_CXX_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_CXX_ABI_FILES)
+ENDIF()
# This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index a808a28..1c9899e 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -57,6 +57,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
IF(ABI_SIZEOF_DPTR)
SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
+ ELSEIF(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
+ SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
ENDIF(ABI_SIZEOF_DPTR)
IF(ABI_NAME)
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index f7a6e29..dd06128 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -70,8 +70,8 @@ ENDIF()
SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
# This variable is used by the Eclipse generator in out-of-source builds only.
-SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
-MARK_AS_ADVANCED(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT)
+SET(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
+MARK_AS_ADVANCED(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT)
# Determine builtin macros and include dirs:
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake)
diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F
index b8efb42..7e24553 100644
--- a/Modules/CMakeFortranCompilerABI.F
+++ b/Modules/CMakeFortranCompilerABI.F
@@ -15,6 +15,11 @@
PRINT *, 'INFO:sizeof_dptr[4]'
#elif defined(_M_IX86)
PRINT *, 'INFO:sizeof_dptr[4]'
+
+#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8
+ PRINT *, 'INFO:sizeof_dptr[8]'
+#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4
+ PRINT *, 'INFO:sizeof_dptr[4]'
#endif
#if 0
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index dc15e55..aed1fd2 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -44,6 +44,12 @@ IF (NOT _INCLUDED_FILE)
INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
ENDIF (NOT _INCLUDED_FILE)
+IF(CMAKE_Fortran_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_Fortran_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_Fortran_ABI_FILES)
+ENDIF()
# This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 038c2fd..4d4e35f 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -76,5 +76,11 @@ ELSE(NOT CMAKE_C_COMPILER_WORKS)
)
INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake)
ENDIF(CMAKE_C_COMPILER_FORCED)
+ IF(CMAKE_C_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_C_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_C_ABI_FILES)
+ ENDIF()
ENDIF(NOT CMAKE_C_COMPILER_WORKS)
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index c1a3b3a..494add3 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -69,4 +69,10 @@ ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
)
INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake)
ENDIF(CMAKE_CXX_COMPILER_FORCED)
+ IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_CXX_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_CXX_ABI_FILES)
+ ENDIF()
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake
index 33f62eb..b4dcea6 100644
--- a/Modules/CMakeTestFortranCompiler.cmake
+++ b/Modules/CMakeTestFortranCompiler.cmake
@@ -92,4 +92,10 @@ ELSE(NOT CMAKE_Fortran_COMPILER_WORKS)
)
INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake)
ENDIF(CMAKE_Fortran_COMPILER_FORCED)
+ IF(CMAKE_Fortran_SIZEOF_DATA_PTR)
+ FOREACH(f ${CMAKE_Fortran_ABI_FILES})
+ INCLUDE(${f})
+ ENDFOREACH()
+ UNSET(CMAKE_Fortran_ABI_FILES)
+ ENDIF()
ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS)
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index bb1021b..bf476ad 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -161,6 +161,15 @@
# CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE
# One may verify which scriptlet has been included with
# rpm -qp --scripts package.rpm
+# CPACK_RPM_USER_FILELIST
+# CPACK_RPM_<COMPONENT>_USER_FILELIST
+# Mandatory : NO
+# Default : -
+# May be used to explicitely specify %(<directive>) file line
+# in the spec file. Like %config(noreplace) or any other directive
+# that be found in the %files section. Since CPackRPM is generating
+# the list of files (and directories) the user specified files of
+# the CPACK_RPM_<COMPONENT>_USER_FILELIST list will be removed from the generated list.
# CPACK_RPM_CHANGELOG_FILE
# Mandatory : NO
# Default : -
@@ -594,23 +603,89 @@ EXECUTE_PROCESS(COMMAND find . -type f -o -type l -o (-type d -a -not -name ".")
WORKING_DIRECTORY "${WDIR}"
OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
-# In component case, replace CPACK_ABSOLUTE_DESTINATION_FILES
-# with the content of CPACK_ABSOLUTE_DESTINATION_FILES_<COMPONENT>
-# This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES handling
+# In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_<COMPONENT>
+# into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
+# otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES
+# This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling
if(CPACK_RPM_PACKAGE_COMPONENT)
if(CPACK_ABSOLUTE_DESTINATION_FILES)
set(COMPONENT_FILES_TAG "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}")
- set(CPACK_ABSOLUTE_DESTINATION_FILES "${${COMPONENT_FILES_TAG}}")
+ set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}")
if(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Handling Absolute Destination Files ${CPACK_ABSOLUTE_DESTINATION_FILES}")
+ message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>")
message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}")
endif(CPACK_RPM_PACKAGE_DEBUG)
endif()
+else()
+ if(CPACK_ABSOLUTE_DESTINATION_FILES)
+ set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}")
+ endif()
+endif()
+
+# In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM_<COMPONENT>_USER_FILELIST.
+if(CPACK_RPM_PACKAGE_COMPONENT)
+ if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST)
+ set(CPACK_RPM_USER_FILELIST_INTERNAL ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST})
+ if(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>")
+ message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}")
+ endif(CPACK_RPM_PACKAGE_DEBUG)
+ else()
+ set(CPACK_RPM_USER_FILELIST_INTERNAL "")
+ endif()
+else()
+ if(CPACK_RPM_USER_FILELIST)
+ set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}")
+ else()
+ set(CPACK_RPM_USER_FILELIST_INTERNAL "")
+ endif()
+endif()
+
+# Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL
+# Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
+# or CPACK_RPM_INSTALL_FILES,
+# hence it must be done before these auto-generated lists are processed.
+if(CPACK_RPM_USER_FILELIST_INTERNAL)
+ IF(CPACK_RPM_PACKAGE_DEBUG)
+ message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>")
+ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+
+ # Create CMake list from CPACK_RPM_INSTALL_FILES
+ string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
+ string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST
+ "${CPACK_RPM_INSTALL_FILES_LIST}")
+ string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST
+ "${CPACK_RPM_INSTALL_FILES_LIST}")
+
+ set(CPACK_RPM_USER_INSTALL_FILES "")
+ foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL)
+ string(REGEX REPLACE "%[A-Za-z\(\)]* " "" F_PATH ${F})
+ string(REGEX MATCH "%[A-Za-z\(\)]*" F_PREFIX ${F})
+
+ if(F_PREFIX)
+ set(F_PREFIX "${F_PREFIX} ")
+ endif()
+ # Rebuild the user list file
+ set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n")
+
+ # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL
+ list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH})
+ list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH})
+
+ endforeach()
+
+ # Rebuild CPACK_RPM_INSTALL_FILES
+ set(CPACK_RPM_INSTALL_FILES "")
+ foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
+ set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n")
+ endforeach(F)
+else()
+ set(CPACK_RPM_USER_INSTALL_FILES "")
endif()
-if (CPACK_ABSOLUTE_DESTINATION_FILES)
+if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
IF(CPACK_RPM_PACKAGE_DEBUG)
- message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES}")
+ message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
# Remove trailing space
string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST)
@@ -619,7 +694,7 @@ if (CPACK_ABSOLUTE_DESTINATION_FILES)
# Remove unecessary quotes
string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}")
# Remove ABSOLUTE install file from INSTALL FILE LIST
- list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES})
+ list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL})
# Rebuild INSTALL_FILES
set(CPACK_RPM_INSTALL_FILES "")
foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST)
@@ -627,14 +702,17 @@ if (CPACK_ABSOLUTE_DESTINATION_FILES)
endforeach(F)
# Build ABSOLUTE_INSTALL_FILES
set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
- foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES)
+ foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n")
endforeach(F)
IF(CPACK_RPM_PACKAGE_DEBUG)
message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}")
message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
-endif(CPACK_ABSOLUTE_DESTINATION_FILES)
+else()
+ # reset vars in order to avoid leakage of value(s) from one component to another
+ set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "")
+endif(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL)
# The name of the final spec file to be used by rpmbuild
SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec")
@@ -724,6 +802,7 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
%defattr(-,root,root,-)
${CPACK_RPM_INSTALL_FILES}
${CPACK_RPM_ABSOLUTE_INSTALL_FILES}
+${CPACK_RPM_USER_INSTALL_FILES}
%changelog
\@CPACK_RPM_SPEC_CHANGELOG\@
diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake
new file mode 100644
index 0000000..4a48c0a
--- /dev/null
+++ b/Modules/Compiler/TinyCC-C.cmake
@@ -0,0 +1,8 @@
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
+
+# no optimization in tcc:
+SET (CMAKE_C_FLAGS_INIT "")
+SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
+SET (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g")
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 4bf1b6c..80a13d4 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -204,6 +204,8 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va
else()
if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))
set(configurations CONFIGURATIONS ${configurations})
+ else()
+ unset(configurations)
endif()
if(component)
set(component COMPONENT ${component})
@@ -250,7 +252,11 @@ function(install_qt4_executable executable)
endif()
get_filename_component(executable_absolute "${executable}" ABSOLUTE)
- gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY}" qtcore_type)
+ if(EXISTS "${QT_QTCORE_LIBRARY_RELEASE}")
+ gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY_RELEASE}" qtcore_type)
+ elseif(EXISTS "${QT_QTCORE_LIBRARY_DEBUG}")
+ gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY_DEBUG}" qtcore_type)
+ endif()
if(qtcore_type STREQUAL "system")
set(qt_plugins_dir "")
endif()
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index e855a27..edde9eb 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -67,8 +67,17 @@ IF(BISON_EXECUTABLE)
IF(NOT ${BISON_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
ELSE()
- STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
- BISON_VERSION "${BISON_version_output}")
+ # Bison++
+ IF("${BISON_version_output}" MATCHES "^bison\\+\\+")
+ STRING(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
+ BISON_VERSION "${BISON_version_output}")
+ # GNU Bison
+ ELSEIF("${BISON_version_output}" MATCHES "^bison[^+]")
+ STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
+ BISON_VERSION "${BISON_version_output}")
+ ELSE()
+ SET(BISON_VERSION "unknown")
+ ENDIF()
ENDIF()
# internal macro
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 5ccbd6b..ea60354 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -65,7 +65,7 @@
# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0,
-# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1
+# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0
#
# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
# add both 1.x and 1.x.0 as shown above. Official Boost include directories
@@ -449,7 +449,7 @@ else(Boost_FIND_VERSION_EXACT)
# The user has not requested an exact version. Among known
# versions, find those that are acceptable to the user request.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.46.1"
+ "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
"1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42"
"1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37"
"1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
@@ -750,10 +750,12 @@ else(_boost_IN_CACHE)
else()
set (_boost_COMPILER "-il")
endif()
- elseif (MSVC90)
- set(_boost_COMPILER "-vc90")
+ elseif (MSVC11)
+ set(_boost_COMPILER "-vc110")
elseif (MSVC10)
set(_boost_COMPILER "-vc100")
+ elseif (MSVC90)
+ set(_boost_COMPILER "-vc90")
elseif (MSVC80)
set(_boost_COMPILER "-vc80")
elseif (MSVC71)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index d5ef430..18f7442 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -266,17 +266,17 @@ macro(CUDA_FIND_HELPER_FILE _name _extension)
# processed. Using this variable, we can pull out the current path, and
# provide a way to get access to the other files we need local to here.
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
- find_file(CUDA_${_name} ${_full_name} PATHS ${CMAKE_CURRENT_LIST_DIR}/FindCUDA NO_DEFAULT_PATH)
- if(NOT CUDA_${_name})
- set(error_message "${_full_name} not found in CMAKE_MODULE_PATH")
+ set(CUDA_${_name} "${CMAKE_CURRENT_LIST_DIR}/FindCUDA/${_full_name}")
+ if(NOT EXISTS "${CUDA_${_name}}")
+ set(error_message "${_full_name} not found in ${CMAKE_CURRENT_LIST_DIR}/FindCUDA")
if(CUDA_FIND_REQUIRED)
message(FATAL_ERROR "${error_message}")
- else(CUDA_FIND_REQUIRED)
+ else()
if(NOT CUDA_FIND_QUIETLY)
message(STATUS "${error_message}")
- endif(NOT CUDA_FIND_QUIETLY)
- endif(CUDA_FIND_REQUIRED)
- endif(NOT CUDA_${_name})
+ endif()
+ endif()
+ endif()
# Set this variable as internal, so the user isn't bugged with it.
set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE)
endmacro(CUDA_FIND_HELPER_FILE)
@@ -320,9 +320,9 @@ macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file)
# message("CUDA_NVCC_DEPEND NOT set")
# endif()
if(CUDA_NVCC_DEPEND)
- #message("CUDA_NVCC_DEPEND true")
+ #message("CUDA_NVCC_DEPEND found")
foreach(f ${CUDA_NVCC_DEPEND})
- #message("searching for ${f}")
+ # message("searching for ${f}")
if(NOT EXISTS ${f})
#message("file ${f} not found")
set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
@@ -339,6 +339,8 @@ macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file)
# output depend on the dependency file itself, which should cause the
# rule to re-run.
if(CUDA_NVCC_DEPEND_REGENERATE)
+ set(CUDA_NVCC_DEPEND ${dependency_file})
+ #message("Generating an empty dependency_file: ${dependency_file}")
file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
endif(CUDA_NVCC_DEPEND_REGENERATE)
@@ -415,13 +417,14 @@ endforeach()
# if they have then clear the cache variables, so that will be detected again.
if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
unset(CUDA_NVCC_EXECUTABLE CACHE)
- unset(CUDA_VERSION CACHE)
unset(CUDA_TOOLKIT_INCLUDE CACHE)
unset(CUDA_CUDART_LIBRARY CACHE)
+ # Make sure you run this before you unset CUDA_VERSION.
if(CUDA_VERSION VERSION_EQUAL "3.0")
# This only existed in the 3.0 version of the CUDA toolkit
unset(CUDA_CUDARTEMU_LIBRARY CACHE)
endif()
+ unset(CUDA_VERSION CACHE)
unset(CUDA_CUDA_LIBRARY CACHE)
unset(CUDA_cublas_LIBRARY CACHE)
unset(CUDA_cublasemu_LIBRARY CACHE)
@@ -443,7 +446,10 @@ if(NOT CUDA_TOOLKIT_ROOT_DIR)
# Search in the CUDA_BIN_PATH first.
find_path(CUDA_TOOLKIT_ROOT_DIR
NAMES nvcc nvcc.exe
- PATHS ENV CUDA_BIN_PATH
+ PATHS
+ ENV CUDA_PATH
+ ENV CUDA_BIN_PATH
+ PATH_SUFFIXES bin bin64
DOC "Toolkit location."
NO_DEFAULT_PATH
)
@@ -472,9 +478,10 @@ endif (NOT CUDA_TOOLKIT_ROOT_DIR)
# CUDA_NVCC_EXECUTABLE
find_program(CUDA_NVCC_EXECUTABLE
NAMES nvcc
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin"
- "${CUDA_TOOLKIT_ROOT_DIR}/bin64"
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ ENV CUDA_PATH
ENV CUDA_BIN_PATH
+ PATH_SUFFIXES bin bin64
NO_DEFAULT_PATH
)
# Search default search paths, after we search our own set of paths.
@@ -500,8 +507,10 @@ set(CUDA_VERSION_STRING "${CUDA_VERSION}")
# CUDA_TOOLKIT_INCLUDE
find_path(CUDA_TOOLKIT_INCLUDE
device_functions.h # Header included in toolkit
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}/include"
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ ENV CUDA_PATH
ENV CUDA_INC_PATH
+ PATH_SUFFIXES include
NO_DEFAULT_PATH
)
# Search default search paths, after we search our own set of paths.
@@ -516,19 +525,16 @@ macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# CUDA 3.2+ on Windows moved the library directoryies, so we need the new
# and old paths.
- set(_cuda_64bit_lib_dir
- "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64"
- "${CUDA_TOOLKIT_ROOT_DIR}/lib64"
- )
+ set(_cuda_64bit_lib_dir "lib/x64" "lib64" )
endif()
# CUDA 3.2+ on Windows moved the library directories, so we need to new
# (lib/Win32) and the old path (lib).
find_library(${_var}
NAMES ${_names}
- PATHS ${_cuda_64bit_lib_dir}
- "${CUDA_TOOLKIT_ROOT_DIR}/lib/Win32"
- "${CUDA_TOOLKIT_ROOT_DIR}/lib"
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+ ENV CUDA_PATH
ENV CUDA_LIB_PATH
+ PATH_SUFFIXES ${_cuda_64bit_lib_dir} "lib/Win32" "lib"
DOC ${_doc}
NO_DEFAULT_PATH
)
@@ -707,7 +713,7 @@ find_package_handle_standard_args(CUDA
# Add include directories to pass to the nvcc command.
macro(CUDA_INCLUDE_DIRECTORIES)
foreach(dir ${ARGN})
- list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER "-I${dir}")
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER -I${dir})
endforeach(dir ${ARGN})
endmacro(CUDA_INCLUDE_DIRECTORIES)
@@ -736,13 +742,13 @@ macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options)
arg STREQUAL "SHARED" OR
arg STREQUAL "MODULE"
)
- list(APPEND ${_cmake_options} "${arg}")
+ list(APPEND ${_cmake_options} ${arg})
else()
if ( _found_options )
- list(APPEND ${_options} "${arg}")
+ list(APPEND ${_options} ${arg})
else()
# Assume this is a file
- list(APPEND ${_sources} "${arg}")
+ list(APPEND ${_sources} ${arg})
endif()
endif()
endforeach()
@@ -809,6 +815,43 @@ function(CUDA_BUILD_SHARED_LIBRARY shared_flag)
endfunction()
##############################################################################
+# Helper to avoid clashes of files with the same basename but different paths.
+# This doesn't attempt to do exactly what CMake internals do, which is to only
+# add this path when there is a conflict, since by the time a second collision
+# in names is detected it's already too late to fix the first one. For
+# consistency sake the relative path will be added to all files.
+function(CUDA_COMPUTE_BUILD_PATH path build_path)
+ #message("CUDA_COMPUTE_BUILD_PATH([${path}] ${build_path})")
+ # Only deal with CMake style paths from here on out
+ file(TO_CMAKE_PATH "${path}" bpath)
+ if (IS_ABSOLUTE "${bpath}")
+ # Absolute paths are generally unnessary, especially if something like
+ # FILE(GLOB_RECURSE) is used to pick up the files.
+ file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}")
+ endif()
+
+ # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
+ # CMake source.
+
+ # Remove leading /
+ string(REGEX REPLACE "^[/]+" "" bpath "${bpath}")
+ # Avoid absolute paths by removing ':'
+ string(REPLACE ":" "_" bpath "${bpath}")
+ # Avoid relative paths that go up the tree
+ string(REPLACE "../" "__/" bpath "${bpath}")
+ # Avoid spaces
+ string(REPLACE " " "_" bpath "${bpath}")
+
+ # Strip off the filename. I wait until here to do it, since removin the
+ # basename can make a path that looked like path/../basename turn into
+ # path/.. (notice the trailing slash).
+ get_filename_component(bpath "${bpath}" PATH)
+
+ set(${build_path} "${bpath}" PARENT_SCOPE)
+ #message("${build_path} = ${bpath}")
+endfunction()
+
+##############################################################################
# This helper macro populates the following variables and setups up custom
# commands and targets to invoke the nvcc compiler to generate C or PTX source
# dependent upon the format parameter. The compiler is invoked once with -M
@@ -890,7 +933,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
if(CUDA_NVCC_INCLUDE_DIRECTORIES)
foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES})
- list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}")
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir})
endforeach()
endif()
@@ -956,7 +999,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# Note that if we ever want CUDA_NVCC_FLAGS_<CONFIG> to be string (instead of a list
# like it is currently), we can remove the quotes around the
# ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_<CONFIG> variable.
- set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} \"${CUDA_NVCC_FLAGS_${config_upper}};;${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}}\")")
+ set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})")
endforeach()
if(compile_to_ptx)
@@ -977,13 +1020,6 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS")
endif()
- # Determine output directory
- if(CUDA_GENERATED_OUTPUT_DIR)
- set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
- else()
- set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
- endif()
-
# Reset the output variable
set(_cuda_wrap_generated_files "")
@@ -994,6 +1030,19 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
if(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
+ # Determine output directory
+ cuda_compute_build_path("${file}" cuda_build_path)
+ set(cuda_compile_intermediate_directory "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${cuda_target}.dir/${cuda_build_path}")
+ if(CUDA_GENERATED_OUTPUT_DIR)
+ set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
+ else()
+ if ( compile_to_ptx )
+ set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
+ else()
+ set(cuda_compile_output_dir "${cuda_compile_intermediate_directory}")
+ endif()
+ endif()
+
# Add a custom target to generate a c or ptx file. ######################
get_filename_component( basename ${file} NAME )
@@ -1013,10 +1062,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# argument, so that the ${CMAKE_CFG_INTDIR} gets expanded at run time
# instead of configure time.
set(generated_file "${generated_file_path}/${generated_file_basename}")
- set(cmake_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.depend")
- set(NVCC_generated_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.NVCC-depend")
+ set(cmake_dependency_file "${cuda_compile_intermediate_directory}/${generated_file_basename}.depend")
+ set(NVCC_generated_dependency_file "${cuda_compile_intermediate_directory}/${generated_file_basename}.NVCC-depend")
set(generated_cubin_file "${generated_file_path}/${generated_file_basename}.cubin.txt")
- set(custom_target_script "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.cmake")
+ set(custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake")
# Setup properties for obj files:
if( NOT compile_to_ptx )
@@ -1096,6 +1145,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
-D "generated_file:STRING=${generated_file}"
-D "generated_cubin_file:STRING=${generated_cubin_file}"
-P "${custom_target_script}"
+ WORKING_DIRECTORY "${cuda_compile_intermediate_directory}"
COMMENT "${cuda_build_comment_string}"
)
diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake
index 7fce167..d41b72d 100644
--- a/Modules/FindCUDA/make2cmake.cmake
+++ b/Modules/FindCUDA/make2cmake.cmake
@@ -54,13 +54,27 @@ if (${depend_text} MATCHES ".+")
string(REGEX REPLACE "^ +" "" file ${file})
- if(NOT IS_DIRECTORY ${file})
+ # OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
+ # instead of '//'. Here we will test to see if the file exists, if it doesn't then
+ # try to prepend another '/' to the path and test again. If it still fails remove the
+ # path.
+
+ if(NOT EXISTS "${file}")
+ if (EXISTS "/${file}")
+ set(file "/${file}")
+ else()
+ message(WARNING " Removing non-existant dependency file: ${file}")
+ set(file "")
+ endif()
+ endif()
+
+ if(NOT IS_DIRECTORY "${file}")
# If softlinks start to matter, we should change this to REALPATH. For now we need
# to flatten paths, because nvcc can generate stuff like /bin/../include instead of
# just /include.
get_filename_component(file_absolute "${file}" ABSOLUTE)
list(APPEND dependency_list "${file_absolute}")
- endif(NOT IS_DIRECTORY ${file})
+ endif()
endforeach(file)
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index 7349da3..b31011c 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -55,25 +55,25 @@ if(NOT generated_file)
endif()
# Set these up as variables to make reading the generated file easier
-set(CMAKE_COMMAND "@CMAKE_COMMAND@")
-set(source_file "@source_file@")
-set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@")
-set(cmake_dependency_file "@cmake_dependency_file@")
-set(CUDA_make2cmake "@CUDA_make2cmake@")
-set(CUDA_parse_cubin "@CUDA_parse_cubin@")
-set(build_cubin @build_cubin@)
+set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
+set(source_file "@source_file@") # path
+set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@") # path
+set(cmake_dependency_file "@cmake_dependency_file@") # path
+set(CUDA_make2cmake "@CUDA_make2cmake@") # path
+set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
+set(build_cubin @build_cubin@) # bool
# We won't actually use these variables for now, but we need to set this, in
# order to force this file to be run again if it changes.
-set(generated_file_path "@generated_file_path@")
-set(generated_file_internal "@generated_file@")
-set(generated_cubin_file_internal "@generated_cubin_file@")
+set(generated_file_path "@generated_file_path@") # path
+set(generated_file_internal "@generated_file@") # path
+set(generated_cubin_file_internal "@generated_cubin_file@") # path
-set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@")
-set(CUDA_NVCC_FLAGS "@CUDA_NVCC_FLAGS@;;@CUDA_WRAP_OPTION_NVCC_FLAGS@")
+set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
+set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
@CUDA_NVCC_FLAGS_CONFIG@
-set(nvcc_flags "@nvcc_flags@")
-set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@")
-set(format_flag "@format_flag@")
+set(nvcc_flags @nvcc_flags@) # list
+set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@") # list (needs to be in quotes to handle spaces properly).
+set(format_flag "@format_flag@") # string
if(build_cubin AND NOT generated_cubin_file)
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 0f11234..c44adb4 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -1,5 +1,5 @@
# - Find GNU gettext tools
-# This module looks for the GNU gettext tools. This module defines the
+# This module looks for the GNU gettext tools. This module defines the
# following values:
# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
@@ -7,8 +7,8 @@
#
# Additionally it provides the following macros:
# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
-# This will create a target "translations" which will convert the
-# given input po files into the binary output mo file. If the
+# This will create a target "translations" which will convert the
+# given input po files into the binary output mo file. If the
# ALL option is used, the translations will also be created when
# building the default target.
# GETTEXT_PROCESS_POT( <potfile> [ALL] [INSTALL_DESTINATION <destdir>] LANGUAGES <lang1> <lang2> ... )
@@ -52,7 +52,8 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
SET(_firstPoFile "${_firstPoFileArg}")
SET(_gmoFiles)
- GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
+ GET_FILENAME_COMPONENT(_potName ${_potFile} NAME)
+ STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
SET(_addToAll)
@@ -92,7 +93,8 @@ FUNCTION(GETTEXT_PROCESS_POT_FILE _potFile)
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
- GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
+ GET_FILENAME_COMPONENT(_potName ${_potFile} NAME)
+ STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
FOREACH (_lang ${_parsedArguments_LANGUAGES})
@@ -134,7 +136,8 @@ FUNCTION(GETTEXT_PROCESS_PO_FILES _lang)
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
FOREACH(_current_PO_FILE ${_parsedArguments_PO_FILES})
- GET_FILENAME_COMPONENT(_basename ${_current_PO_FILE} NAME_WE)
+ GET_FILENAME_COMPONENT(_name ${_current_PO_FILE} NAME)
+ STRING(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
ADD_CUSTOM_COMMAND(OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index bccf789..884266f 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -80,17 +80,17 @@ foreach(_library ${_list})
if(_libraries_work)
if (BLA_STATIC)
if (WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ( WIN32 )
if (APPLE)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else (APPLE)
- set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif (APPLE)
else (BLA_STATIC)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and liblapack3gf packages
- set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRRAY_SUFFIXES} .so.3gf)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif ()
endif (BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
@@ -106,7 +106,7 @@ endforeach(_library ${_list})
if(_libraries_work)
# Test this combination of libraries.
if(UNIX AND BLA_STATIC)
- set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group ${${LIBRARIES}} ${_blas};-Wl,--end-group" ${_threads})
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads})
else(UNIX AND BLA_STATIC)
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
endif(UNIX AND BLA_STATIC)
@@ -123,7 +123,7 @@ if(_libraries_work)
endif(_libraries_work)
if(_libraries_work)
- set(${LIBRARIES} ${${LIBRARIES}} ${_blas})
+ set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads})
else(_libraries_work)
set(${LIBRARIES} FALSE)
endif(_libraries_work)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index f607dc6..f616973 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -1,14 +1,18 @@
# - Find the native PNG includes and library
#
-# This module defines
-# PNG_INCLUDE_DIR, where to find png.h, etc.
+# This module searches libpng, the library for working with PNG images.
+#
+# It defines the following variables
+# PNG_INCLUDE_DIRS, where to find png.h, etc.
# PNG_LIBRARIES, the libraries to link against to use PNG.
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
# PNG_FOUND, If false, do not try to use PNG.
-# also defined, but not for general use are
+# Also defined, but not for general use are
# PNG_LIBRARY, where to find the PNG library.
-# None of the above will be defined unles zlib can be found.
-# PNG depends on Zlib
+# For backward compatiblity the variable PNG_INCLUDE_DIR is also set. It has the same value as PNG_INCLUDE_DIRS.
+#
+# Since PNG depends on the ZLib compression library, none of the above will be
+# defined unless ZLib can be found.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
@@ -38,7 +42,8 @@ if(ZLIB_FOUND)
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
- SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+ SET(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+ SET(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatiblity
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
if (CYGWIN)
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 9df3f01..04646c0 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -108,6 +108,7 @@ IF (UNIX)
FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH})
+ FIND_PATH(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH})
FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
@@ -136,6 +137,7 @@ IF (UNIX)
FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
+ FIND_LIBRARY(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH})
FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH})
@@ -250,6 +252,11 @@ IF (UNIX)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH})
ENDIF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
+ IF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB)
+ SET(X11_XRes_FOUND TRUE)
+ SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH})
+ ENDIF (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB)
+
IF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB)
SET(X11_Xrandr_FOUND TRUE)
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
@@ -424,6 +431,8 @@ IF (UNIX)
X11_Xdamage_INCLUDE_PATH
X11_Xrender_LIB
X11_Xrender_INCLUDE_PATH
+ X11_XRes_LIB
+ X11_XRes_INCLUDE_PATH
X11_Xxf86misc_LIB
X11_xf86misc_INCLUDE_PATH
X11_xf86vmode_INCLUDE_PATH
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 77f9fda..166e291 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -17,9 +17,12 @@
# ZLIB_MAJOR_VERSION - The major version of zlib
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
+#
+# An includer may set ZLIB_ROOT to a zlib installation root to tell
+# this module where to look.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -31,17 +34,29 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include"
-)
+SET(_ZLIB_SEARCHES)
+
+# Search ZLIB_ROOT first if it is set.
+IF(ZLIB_ROOT)
+ SET(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH)
+ LIST(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
+ENDIF()
+
+# Normal search.
+SET(_ZLIB_SEARCH_NORMAL
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
+ "$ENV{PROGRAMFILES}/zlib"
+ )
+LIST(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1)
-FIND_LIBRARY(ZLIB_LIBRARY
- NAMES
- ${ZLIB_NAMES}
- PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib"
-)
+
+# Try each search configuration.
+FOREACH(search ${_ZLIB_SEARCHES})
+ FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
+ FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
+ENDFOREACH()
+
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
IF(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 90ef59b..2455c5f 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -116,6 +116,14 @@ endforeach()
#-----------------------------------------------------------------------------
set(FortranCInterface_SOURCE_DIR ${CMAKE_ROOT}/Modules/FortranCInterface)
+# MinGW's make tool does not always like () in the path
+if("${CMAKE_GENERATOR}" MATCHES "MinGW" AND
+ "${FortranCInterface_SOURCE_DIR}" MATCHES "[()]")
+ file(COPY ${FortranCInterface_SOURCE_DIR}/
+ DESTINATION ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterfaceMinGW)
+ set(FortranCInterface_SOURCE_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterfaceMinGW)
+endif()
+
# Create the interface detection project if it does not exist.
if(NOT FortranCInterface_BINARY_DIR)
set(FortranCInterface_BINARY_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/FortranCInterface)
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index b6735c1..65d254a 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -141,36 +141,46 @@ IF(MSVC)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
ENDIF(MSVC90)
- IF(MSVC10)
+ MACRO(MSVCRT_FILES_FOR_VERSION version)
+ SET(v "${version}")
+
# Find the runtime library redistribution directory.
GET_FILENAME_COMPONENT(msvc_install_dir
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]" ABSOLUTE)
- FIND_PATH(MSVC10_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\${v}.0;InstallDir]" ABSOLUTE)
+ FIND_PATH(MSVC${v}_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT
PATHS
"${msvc_install_dir}/../../VC/redist"
"${base_dir}/VC/redist"
- "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/VC/redist"
- "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio 10.0/VC/redist"
+ "$ENV{ProgramFiles}/Microsoft Visual Studio ${v}.0/VC/redist"
+ "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio ${v}.0/VC/redist"
)
- MARK_AS_ADVANCED(MSVC10_REDIST_DIR)
- SET(MSVC10_CRT_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT")
+ MARK_AS_ADVANCED(MSVC${v}_REDIST_DIR)
+ SET(MSVC${v}_CRT_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.CRT")
IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
SET(__install__libs
- "${MSVC10_CRT_DIR}/msvcp100.dll"
- "${MSVC10_CRT_DIR}/msvcr100.dll"
+ "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll"
+ "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll"
)
ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
- SET(MSVC10_CRT_DIR
- "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugCRT")
+ SET(MSVC${v}_CRT_DIR
+ "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT")
SET(__install__libs ${__install__libs}
- "${MSVC10_CRT_DIR}/msvcp100d.dll"
- "${MSVC10_CRT_DIR}/msvcr100d.dll"
+ "${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll"
+ "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll"
)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
- ENDIF(MSVC10)
+ ENDMACRO()
+
+ IF(MSVC10)
+ MSVCRT_FILES_FOR_VERSION(10)
+ ENDIF()
+
+ IF(MSVC11)
+ MSVCRT_FILES_FOR_VERSION(11)
+ ENDIF()
IF(CMAKE_INSTALL_MFC_LIBRARIES)
IF(MSVC70)
@@ -273,42 +283,52 @@ IF(MSVC)
)
ENDIF(MSVC90)
- IF(MSVC10)
+ MACRO(MFC_FILES_FOR_VERSION version)
+ SET(v "${version}")
+
IF(CMAKE_INSTALL_DEBUG_LIBRARIES)
- SET(MSVC10_MFC_DIR
- "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugMFC")
+ SET(MSVC${v}_MFC_DIR
+ "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugMFC")
SET(__install__libs ${__install__libs}
- "${MSVC10_MFC_DIR}/mfc100d.dll"
- "${MSVC10_MFC_DIR}/mfc100ud.dll"
- "${MSVC10_MFC_DIR}/mfcm100d.dll"
- "${MSVC10_MFC_DIR}/mfcm100ud.dll"
+ "${MSVC${v}_MFC_DIR}/mfc${v}0d.dll"
+ "${MSVC${v}_MFC_DIR}/mfc${v}0ud.dll"
+ "${MSVC${v}_MFC_DIR}/mfcm${v}0d.dll"
+ "${MSVC${v}_MFC_DIR}/mfcm${v}0ud.dll"
)
ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES)
- SET(MSVC10_MFC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFC")
+ SET(MSVC${v}_MFC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFC")
IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
SET(__install__libs ${__install__libs}
- "${MSVC10_MFC_DIR}/mfc100.dll"
- "${MSVC10_MFC_DIR}/mfc100u.dll"
- "${MSVC10_MFC_DIR}/mfcm100.dll"
- "${MSVC10_MFC_DIR}/mfcm100u.dll"
+ "${MSVC${v}_MFC_DIR}/mfc${v}0.dll"
+ "${MSVC${v}_MFC_DIR}/mfc${v}0u.dll"
+ "${MSVC${v}_MFC_DIR}/mfcm${v}0.dll"
+ "${MSVC${v}_MFC_DIR}/mfcm${v}0u.dll"
)
ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
- # include the language dll's for vs10 as well as the actuall dll's
- SET(MSVC10_MFCLOC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFCLOC")
+ # include the language dll's as well as the actuall dll's
+ SET(MSVC${v}_MFCLOC_DIR "${MSVC${v}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.MFCLOC")
SET(__install__libs ${__install__libs}
- "${MSVC10_MFCLOC_DIR}/mfc100chs.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100cht.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100enu.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100esp.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100deu.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100fra.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100ita.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100jpn.dll"
- "${MSVC10_MFCLOC_DIR}/mfc100kor.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0chs.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0cht.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0enu.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0esp.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0deu.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0fra.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0ita.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0jpn.dll"
+ "${MSVC${v}_MFCLOC_DIR}/mfc${v}0kor.dll"
)
- ENDIF(MSVC10)
+ ENDMACRO()
+
+ IF(MSVC10)
+ MFC_FILES_FOR_VERSION(10)
+ ENDIF()
+
+ IF(MSVC11)
+ MFC_FILES_FOR_VERSION(11)
+ ENDIF()
ENDIF(CMAKE_INSTALL_MFC_LIBRARIES)
FOREACH(lib
diff --git a/Modules/Platform/GNUtoMS_lib.bat.in b/Modules/Platform/GNUtoMS_lib.bat.in
new file mode 100644
index 0000000..2da920a
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.bat.in
@@ -0,0 +1,3 @@
+@echo off
+call "@CMAKE_GNUtoMS_BAT@"
+lib /machine:"@CMAKE_GNUtoMS_ARCH@" %*
diff --git a/Modules/Platform/GNUtoMS_lib.cmake b/Modules/Platform/GNUtoMS_lib.cmake
new file mode 100644
index 0000000..ca9b0f8
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.cmake
@@ -0,0 +1,10 @@
+# Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P GNUtoMS_lib.cmake
+get_filename_component(name ${dll} NAME) # .dll file name
+string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib
+execute_process(
+ COMMAND ${lib} /def:${def} /name:${name} /out:${out}
+ RESULT_VARIABLE res
+ )
+if(res)
+ message(FATAL_ERROR "lib failed: ${res}")
+endif()
diff --git a/Modules/Platform/Linux-TinyCC-C.cmake b/Modules/Platform/Linux-TinyCC-C.cmake
new file mode 100644
index 0000000..b753268
--- /dev/null
+++ b/Modules/Platform/Linux-TinyCC-C.cmake
@@ -0,0 +1,4 @@
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "")
+SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "")
+SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-soname ")
diff --git a/Modules/Platform/Windows-GNU-C-ABI.cmake b/Modules/Platform/Windows-GNU-C-ABI.cmake
new file mode 100644
index 0000000..1189263
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-C-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(C)
diff --git a/Modules/Platform/Windows-GNU-CXX-ABI.cmake b/Modules/Platform/Windows-GNU-CXX-ABI.cmake
new file mode 100644
index 0000000..f3c701c
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-CXX-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(CXX)
diff --git a/Modules/Platform/Windows-GNU-Fortran-ABI.cmake b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake
new file mode 100644
index 0000000..179280b
--- /dev/null
+++ b/Modules/Platform/Windows-GNU-Fortran-ABI.cmake
@@ -0,0 +1 @@
+__windows_compiler_gnu_abi(Fortran)
diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake
index c66feed..b81b796 100644
--- a/Modules/Platform/Windows-GNU-Fortran.cmake
+++ b/Modules/Platform/Windows-GNU-Fortran.cmake
@@ -1,2 +1,5 @@
include(Platform/Windows-GNU)
__windows_compiler_gnu(Fortran)
+
+# gfortran on 64-bit MinGW defines __SIZEOF_POINTER__
+set(CMAKE_Fortran_SIZEOF_DATA_PTR_DEFAULT 4)
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 1d3e4b5..c255d6b 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -108,6 +108,8 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
+ list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI")
+
# Support very long lists of object files.
if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@")
foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE)
@@ -125,3 +127,55 @@ macro(__windows_compiler_gnu lang)
endforeach()
endif()
endmacro()
+
+macro(__windows_compiler_gnu_abi lang)
+ if(CMAKE_NO_GNUtoMS)
+ set(CMAKE_GNUtoMS 0)
+ else()
+ option(CMAKE_GNUtoMS "Convert GNU import libraries to MS format (requires Visual Studio)" OFF)
+ endif()
+
+ if(CMAKE_GNUtoMS AND NOT CMAKE_GNUtoMS_LIB)
+ # Find MS development environment setup script for this architecture.
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
+ find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvars32.bat
+ DOC "Visual Studio vcvars32.bat"
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC;ProductDir]/bin"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++;ProductDir]/bin"
+ )
+ set(CMAKE_GNUtoMS_ARCH x86)
+ elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+ find_program(CMAKE_GNUtoMS_VCVARS NAMES vcvarsamd64.bat
+ DOC "Visual Studio vcvarsamd64.bat"
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VC;ProductDir]/bin/amd64"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VC;ProductDir]/bin/amd64"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC;ProductDir]/bin/amd64"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/bin/amd64"
+ )
+ set(CMAKE_GNUtoMS_ARCH amd64)
+ endif()
+ set_property(CACHE CMAKE_GNUtoMS_VCVARS PROPERTY ADVANCED 1)
+ if(CMAKE_GNUtoMS_VCVARS)
+ # Create helper script to run lib.exe from MS environment.
+ string(REPLACE "/" "\\" CMAKE_GNUtoMS_BAT "${CMAKE_GNUtoMS_VCVARS}")
+ set(CMAKE_GNUtoMS_LIB ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeGNUtoMS_lib.bat)
+ configure_file(${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.bat.in ${CMAKE_GNUtoMS_LIB})
+ else()
+ message(WARNING "Disabling CMAKE_GNUtoMS option because CMAKE_GNUtoMS_VCVARS is not set.")
+ set(CMAKE_GNUtoMS 0)
+ endif()
+ endif()
+
+ if(CMAKE_GNUtoMS)
+ # Teach CMake how to create a MS import library at link time.
+ set(CMAKE_${lang}_GNUtoMS_RULE " -Wl,--output-def,<TARGET_NAME>.def"
+ "<CMAKE_COMMAND> -Dlib=\"${CMAKE_GNUtoMS_LIB}\" -Ddef=\"<TARGET_NAME>.def\" -Ddll=\"<TARGET>\" -Dimp=\"<TARGET_IMPLIB>\" -P \"${CMAKE_ROOT}/Modules/Platform/GNUtoMS_lib.cmake\""
+ )
+ endif()
+endmacro()
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 630a0ba..4da1a3f 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -118,7 +118,7 @@ MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
COMMAND ${QT_MOC_EXECUTABLE}
ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
- DEPENDS ${infile})
+ DEPENDS ${infile} VERBATIM)
ENDIF (WIN32)
ENDMACRO (QT4_CREATE_MOC_COMMAND)
@@ -165,7 +165,7 @@ MACRO (QT4_WRAP_UI outfiles )
ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
COMMAND ${QT_UIC_EXECUTABLE}
ARGS ${ui_options} -o ${outfile} ${infile}
- MAIN_DEPENDENCY ${infile})
+ MAIN_DEPENDENCY ${infile} VERBATIM)
SET(${outfiles} ${${outfiles}} ${outfile})
ENDFOREACH (it)
@@ -203,7 +203,7 @@ MACRO (QT4_ADD_RESOURCES outfiles )
COMMAND ${QT_RCC_EXECUTABLE}
ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile}
- DEPENDS ${_RC_DEPENDS} "${out_depends}")
+ DEPENDS ${_RC_DEPENDS} "${out_depends}" VERBATIM)
SET(${outfiles} ${${outfiles}} ${outfile})
ENDFOREACH (it)
@@ -235,7 +235,7 @@ MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile}
- DEPENDS ${_infile})
+ DEPENDS ${_infile} VERBATIM)
SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
@@ -280,7 +280,7 @@ MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options
ADD_CUSTOM_COMMAND(OUTPUT ${_target}
COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target}
- DEPENDS ${_in_file}
+ DEPENDS ${_in_file} VERBATIM
)
ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
@@ -304,12 +304,12 @@ MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optional
IF(_optionalClassName)
ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
- DEPENDS ${_infile}
+ DEPENDS ${_infile} VERBATIM
)
ELSE(_optionalClassName)
ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
- DEPENDS ${_infile}
+ DEPENDS ${_infile} VERBATIM
)
ENDIF(_optionalClassName)
@@ -398,7 +398,7 @@ MACRO(QT4_CREATE_TRANSLATION _qm_files)
ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file}
COMMAND ${QT_LUPDATE_EXECUTABLE}
ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file}
- DEPENDS ${_my_sources} ${_ts_pro})
+ DEPENDS ${_my_sources} ${_ts_pro} VERBATIM)
ENDFOREACH(_ts_file)
QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles})
ENDMACRO(QT4_CREATE_TRANSLATION)
@@ -419,7 +419,7 @@ MACRO(QT4_ADD_TRANSLATION _qm_files)
ADD_CUSTOM_COMMAND(OUTPUT ${qm}
COMMAND ${QT_LRELEASE_EXECUTABLE}
ARGS ${_abs_FILE} -qm ${qm}
- DEPENDS ${_abs_FILE}
+ DEPENDS ${_abs_FILE} VERBATIM
)
SET(${_qm_files} ${${_qm_files}} ${qm})
ENDFOREACH (_current_FILE)
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index b824392..027504f 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -68,7 +68,7 @@ SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE)
-SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTWEBKIT QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTXML QTOPENGL QTGUI QTNETWORK QTCORE)
+SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE)
SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTSCRIPT_MODULE_DEPENDS QTCORE)
@@ -81,8 +81,8 @@ SET(QT_QTNETWORK_MODULE_DEPENDS QTCORE)
# Qt modules (in order of dependence)
FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP
- QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTGUI QTTEST QTDBUS QTXML QTSQL
- QTXMLPATTERNS QTNETWORK QTCORE)
+ QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST
+ QTDBUS QTXML QTSQL QTNETWORK QTCORE)
IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
IF (QT_${module}_FOUND)
diff --git a/Source/.gitattributes b/Source/.gitattributes
new file mode 100644
index 0000000..cf4dabd
--- /dev/null
+++ b/Source/.gitattributes
@@ -0,0 +1,2 @@
+# Preserve upstream indentation style.
+cm_sha2.* whitespace=indent-with-non-tab
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ba41d98..b5115b7 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -129,6 +129,8 @@ SET(SRCS
cmComputeLinkInformation.h
cmComputeTargetDepends.h
cmComputeTargetDepends.cxx
+ cmCryptoHash.cxx
+ cmCryptoHash.h
cmCustomCommand.cxx
cmCustomCommand.h
cmCustomCommandGenerator.cxx
@@ -160,6 +162,7 @@ SET(SRCS
cmDocumentationSection.cxx
cmDocumentCompileDefinitions.h
cmDocumentGeneratorExpressions.h
+ cmDocumentLocationUndefined.h
cmDocumentVariables.cxx
cmDynamicLoader.cxx
cmDynamicLoader.h
@@ -214,6 +217,8 @@ SET(SRCS
cmMakefileExecutableTargetGenerator.cxx
cmMakefileLibraryTargetGenerator.cxx
cmMakefileUtilityTargetGenerator.cxx
+ cmNewLineStyle.h
+ cmNewLineStyle.cxx
cmOrderDirectories.cxx
cmOrderDirectories.h
cmPolicies.h
@@ -259,6 +264,8 @@ SET(SRCS
cmakewizard.cxx
cmakewizard.h
+ cm_sha2.h
+ cm_sha2.c
cm_utf8.h
cm_utf8.c
)
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index b4d9191..00aaf69 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -12,15 +12,16 @@
#include "AddCacheEntry.h"
#include <QMetaProperty>
+#include <QCompleter>
static const int NumTypes = 4;
-static const QString TypeStrings[NumTypes] =
+static const QString TypeStrings[NumTypes] =
{ "BOOL", "PATH", "FILEPATH", "STRING" };
-static const QCMakeProperty::PropertyType Types[NumTypes] =
- { QCMakeProperty::BOOL, QCMakeProperty::PATH,
- QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
+static const QCMakeProperty::PropertyType Types[NumTypes] =
+ { QCMakeProperty::BOOL, QCMakeProperty::PATH,
+ QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
-AddCacheEntry::AddCacheEntry(QWidget* p)
+AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions)
: QWidget(p)
{
this->setupUi(this);
@@ -42,6 +43,7 @@ AddCacheEntry::AddCacheEntry(QWidget* p)
this->setTabOrder(path, filepath);
this->setTabOrder(filepath, string);
this->setTabOrder(string, this->Description);
+ this->Name->setCompleter(new QCompleter(completions, this));
}
QString AddCacheEntry::name() const
diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h
index db6baf9..e219d4e 100644
--- a/Source/QtDialog/AddCacheEntry.h
+++ b/Source/QtDialog/AddCacheEntry.h
@@ -15,6 +15,7 @@
#include <QWidget>
#include <QCheckBox>
+#include <QStringList>
#include "QCMake.h"
#include "ui_AddCacheEntry.h"
@@ -23,7 +24,7 @@ class AddCacheEntry : public QWidget, public Ui::AddCacheEntry
{
Q_OBJECT
public:
- AddCacheEntry(QWidget* p);
+ AddCacheEntry(QWidget* p, const QStringList& completions);
QString name() const;
QVariant value() const;
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index c8c4bfa..1c058d3 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -68,6 +68,9 @@ CMakeSetupDialog::CMakeSetupDialog()
int w = settings.value("Width", 700).toInt();
this->resize(w, h);
+ this->AddVariableCompletions = settings.value("AddVariableCompletionEntries",
+ QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
+
QWidget* cont = new QWidget(this);
this->setupUi(cont);
this->Splitter->setStretchFactor(0, 3);
@@ -1008,7 +1011,7 @@ void CMakeSetupDialog::addCacheEntry()
dialog.resize(400, 200);
dialog.setWindowTitle(tr("Add Cache Entry"));
QVBoxLayout* l = new QVBoxLayout(&dialog);
- AddCacheEntry* w = new AddCacheEntry(&dialog);
+ AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableCompletions);
QDialogButtonBox* btns = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, &dialog);
@@ -1021,6 +1024,26 @@ void CMakeSetupDialog::addCacheEntry()
{
QCMakeCacheModel* m = this->CacheValues->cacheModel();
m->insertProperty(w->type(), w->name(), w->description(), w->value(), false);
+
+ // only add variable names to the completion which are new
+ if (!this->AddVariableCompletions.contains(w->name()))
+ {
+ this->AddVariableCompletions << w->name();
+ // limit to at most 100 completion items
+ if (this->AddVariableCompletions.size() > 100)
+ {
+ this->AddVariableCompletions.removeFirst();
+ }
+ // make sure CMAKE_INSTALL_PREFIX is always there
+ if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX"))
+ {
+ this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX");
+ }
+ QSettings settings;
+ settings.beginGroup("Settings/StartPath");
+ settings.setValue("AddVariableCompletionEntries",
+ this->AddVariableCompletions);
+ }
}
}
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index 5121759..2599675 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -36,7 +36,7 @@ public slots:
void setBinaryDirectory(const QString& dir);
void setSourceDirectory(const QString& dir);
-protected slots:
+protected slots:
void initialize();
void doConfigure();
void doGenerate();
@@ -46,7 +46,7 @@ protected slots:
void doInterrupt();
void error(const QString& message);
void message(const QString& message);
-
+
void doSourceBrowse();
void doBinaryBrowse();
void doReloadCache();
@@ -105,6 +105,8 @@ protected:
QTextCharFormat ErrorFormat;
QTextCharFormat MessageFormat;
+ QStringList AddVariableCompletions;
+
QEventLoop LocalLoop;
float ProgressOffset;
@@ -118,8 +120,8 @@ class QCMakeThread : public QThread
public:
QCMakeThread(QObject* p);
QCMake* cmakeInstance() const;
-
-signals:
+
+signals:
void cmakeInitialized();
protected:
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 7bb8b27..3f7fdc7 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -440,8 +440,12 @@ std::string cmCTest::GetCDashVersion()
std::string cdashUri = this->GetCTestConfiguration("DropLocation");
cdashUri = cdashUri.substr(0, cdashUri.find("/submit.php"));
- url += cdashUri + "/api/getversion.php";
- int res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response, "", "", 3);
+ int res = 1;
+ if ( ! cdashUri.empty() )
+ {
+ url += cdashUri + "/api/getversion.php";
+ res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response, "", "", 3);
+ }
return res ? this->GetCTestConfiguration("CDashVersion") : response;
#else
@@ -1441,6 +1445,43 @@ int cmCTest::RunTest(std::vector<const char*> argv,
}
//----------------------------------------------------------------------
+std::string cmCTest::SafeBuildIdField(const std::string& value)
+{
+ std::string safevalue(value);
+
+ if (safevalue != "")
+ {
+ // Disallow non-filename and non-space whitespace characters.
+ // If they occur, replace them with ""
+ //
+ const char *disallowed = "\\/:*?\"<>|\n\r\t\f\v";
+
+ if (safevalue.find_first_of(disallowed) != value.npos)
+ {
+ std::string::size_type i = 0;
+ std::string::size_type n = strlen(disallowed);
+ char replace[2];
+ replace[1] = 0;
+
+ for (i= 0; i<n; ++i)
+ {
+ replace[0] = disallowed[i];
+ cmSystemTools::ReplaceString(safevalue, replace, "");
+ }
+ }
+
+ safevalue = cmXMLSafe(safevalue).str();
+ }
+
+ if (safevalue == "")
+ {
+ safevalue = "(empty)";
+ }
+
+ return safevalue;
+}
+
+//----------------------------------------------------------------------
void cmCTest::StartXML(std::ostream& ostr, bool append)
{
if(this->CurrentTag.empty())
@@ -1450,19 +1491,27 @@ void cmCTest::StartXML(std::ostream& ostr, bool append)
" NightlStartTime was not set correctly." << std::endl);
cmSystemTools::SetFatalErrorOccured();
}
+
// find out about the system
cmsys::SystemInformation info;
info.RunCPUCheck();
info.RunOSCheck();
info.RunMemoryCheck();
+
+ std::string buildname = cmCTest::SafeBuildIdField(
+ this->GetCTestConfiguration("BuildName"));
+ std::string stamp = cmCTest::SafeBuildIdField(
+ this->CurrentTag + "-" + this->GetTestModelString());
+ std::string site = cmCTest::SafeBuildIdField(
+ this->GetCTestConfiguration("Site"));
+
ostr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- << "<Site BuildName=\"" << this->GetCTestConfiguration("BuildName")
- << "\"\n\tBuildStamp=\"" << this->CurrentTag << "-"
- << this->GetTestModelString() << "\"\n\tName=\""
- << this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest-"
- << cmVersion::GetCMakeVersion() << "\"\n"
+ << "<Site BuildName=\"" << buildname << "\"\n"
+ << "\tBuildStamp=\"" << stamp << "\"\n"
+ << "\tName=\"" << site << "\"\n"
+ << "\tGenerator=\"ctest-" << cmVersion::GetCMakeVersion() << "\"\n"
<< (append? "\tAppend=\"true\"\n":"")
- << "\tCompilerName=\"" << this->GetCTestConfiguration("Compiler")
+ << "\tCompilerName=\"" << this->GetCTestConfiguration("Compiler")
<< "\"\n"
#ifdef _COMPILER_VERSION
<< "\tCompilerVersion=\"_COMPILER_VERSION\"\n"
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 44a5349..7c71b00 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -259,6 +259,10 @@ public:
std::string* stdOut, std::string* stdErr,
int* retVal = 0, const char* dir = 0, double timeout = 0.0);
+ //! Clean/make safe for xml the given value such that it may be used as
+ // one of the key fields by CDash when computing the buildid.
+ static std::string SafeBuildIdField(const std::string& value);
+
//! Start CTest XML output file
void StartXML(std::ostream& ostr, bool append);
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index c1327fb..ea98326 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -65,6 +65,12 @@ bool cmConfigureFileCommand
cmSystemTools::SetFatalErrorOccured();
return false;
}
+ std::string errorMessage;
+ if (!this->NewLineStyle.ReadFromArguments(args, errorMessage))
+ {
+ this->SetError(errorMessage.c_str());
+ return false;
+ }
this->CopyOnly = false;
this->EscapeQuotes = false;
@@ -78,6 +84,12 @@ bool cmConfigureFileCommand
if(args[i] == "COPYONLY")
{
this->CopyOnly = true;
+ if (this->NewLineStyle.IsValid())
+ {
+ this->SetError("COPYONLY could not be used in combination "
+ "with NEWLINE_STYLE");
+ return false;
+ }
}
else if(args[i] == "ESCAPE_QUOTES")
{
@@ -122,7 +134,8 @@ int cmConfigureFileCommand::ConfigureFile()
this->OutputFile.c_str(),
this->CopyOnly,
this->AtOnly,
- this->EscapeQuotes);
+ this->EscapeQuotes,
+ this->NewLineStyle);
}
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 844a23c..be33569 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -56,7 +56,8 @@ public:
{
return
" configure_file(<input> <output>\n"
- " [COPYONLY] [ESCAPE_QUOTES] [@ONLY])\n"
+ " [COPYONLY] [ESCAPE_QUOTES] [@ONLY] \n"
+ " [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])\n"
"Copies a file <input> to file <output> and substitutes variable "
"values referenced in the file content. "
"If <input> is a relative path it is evaluated with respect to "
@@ -81,14 +82,20 @@ public:
"either #define VAR or /* #undef VAR */ depending on "
"the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR "
"will be replaced with either #define VAR 1 or #define VAR 0 "
- "depending on whether VAR evaluates to TRUE or FALSE in CMake";
+ "depending on whether VAR evaluates to TRUE or FALSE in CMake.\n"
+ "With NEWLINE_STYLE the line ending could be adjusted: \n"
+ " 'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n"
+ "COPYONLY must not be used with NEWLINE_STYLE.\n";
}
virtual void FinalPass();
virtual bool HasFinalPass() const { return !this->Immediate; }
+
private:
int ConfigureFile();
+ cmNewLineStyle NewLineStyle;
+
std::string InputFile;
std::string OutputFile;
bool CopyOnly;
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
new file mode 100644
index 0000000..a1505bd
--- /dev/null
+++ b/Source/cmCryptoHash.cxx
@@ -0,0 +1,130 @@
+/*============================================================================
+ 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 "cmCryptoHash.h"
+
+#include <cmsys/MD5.h>
+#include "cm_sha2.h"
+
+//----------------------------------------------------------------------------
+cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo)
+{
+ if(strcmp(algo,"MD5") == 0)
+ { return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashMD5); }
+ else if(strcmp(algo,"SHA1") == 0)
+ { return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA1); }
+ else if(strcmp(algo,"SHA224") == 0)
+ { return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA224); }
+ else if(strcmp(algo,"SHA256") == 0)
+ { return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA256); }
+ else if(strcmp(algo,"SHA384") == 0)
+ { return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA384); }
+ else if(strcmp(algo,"SHA512") == 0)
+ { return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA512); }
+ else
+ { return cmsys::auto_ptr<cmCryptoHash>(0); }
+}
+
+//----------------------------------------------------------------------------
+std::string cmCryptoHash::HashString(const char* input)
+{
+ this->Initialize();
+ this->Append(reinterpret_cast<unsigned char const*>(input),
+ static_cast<int>(strlen(input)));
+ return this->Finalize();
+}
+
+//----------------------------------------------------------------------------
+std::string cmCryptoHash::HashFile(const char* file)
+{
+ std::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ if(!fin)
+ {
+ return "";
+ }
+
+ this->Initialize();
+
+ // Should be efficient enough on most system:
+ const int bufferSize = 4096;
+ char buffer[bufferSize];
+ unsigned char const* buffer_uc =
+ reinterpret_cast<unsigned char const*>(buffer);
+ // This copy loop is very sensitive on certain platforms with
+ // slightly broken stream libraries (like HPUX). Normally, it is
+ // incorrect to not check the error condition on the fin.read()
+ // before using the data, but the fin.gcount() will be zero if an
+ // error occurred. Therefore, the loop should be safe everywhere.
+ while(fin)
+ {
+ fin.read(buffer, bufferSize);
+ if(int gcount = static_cast<int>(fin.gcount()))
+ {
+ this->Append(buffer_uc, gcount);
+ }
+ }
+ if(fin.eof())
+ {
+ return this->Finalize();
+ }
+ return "";
+}
+
+//----------------------------------------------------------------------------
+cmCryptoHashMD5::cmCryptoHashMD5(): MD5(cmsysMD5_New())
+{
+}
+
+//----------------------------------------------------------------------------
+cmCryptoHashMD5::~cmCryptoHashMD5()
+{
+ cmsysMD5_Delete(this->MD5);
+}
+
+//----------------------------------------------------------------------------
+void cmCryptoHashMD5::Initialize()
+{
+ cmsysMD5_Initialize(this->MD5);
+}
+
+//----------------------------------------------------------------------------
+void cmCryptoHashMD5::Append(unsigned char const* buf, int sz)
+{
+ cmsysMD5_Append(this->MD5, buf, sz);
+}
+
+//----------------------------------------------------------------------------
+std::string cmCryptoHashMD5::Finalize()
+{
+ char md5out[32];
+ cmsysMD5_FinalizeHex(this->MD5, md5out);
+ return std::string(md5out, 32);
+}
+
+
+#define cmCryptoHash_SHA_CLASS_IMPL(SHA) \
+cmCryptoHash##SHA::cmCryptoHash##SHA(): SHA(new SHA_CTX) {} \
+cmCryptoHash##SHA::~cmCryptoHash##SHA() { delete this->SHA; } \
+void cmCryptoHash##SHA::Initialize() { SHA##_Init(this->SHA); } \
+void cmCryptoHash##SHA::Append(unsigned char const* buf, int sz) \
+{ SHA##_Update(this->SHA, buf, sz); } \
+std::string cmCryptoHash##SHA::Finalize() \
+{ \
+ char out[SHA##_DIGEST_STRING_LENGTH]; \
+ SHA##_End(this->SHA, out); \
+ return std::string(out, SHA##_DIGEST_STRING_LENGTH-1); \
+}
+
+cmCryptoHash_SHA_CLASS_IMPL(SHA1)
+cmCryptoHash_SHA_CLASS_IMPL(SHA224)
+cmCryptoHash_SHA_CLASS_IMPL(SHA256)
+cmCryptoHash_SHA_CLASS_IMPL(SHA384)
+cmCryptoHash_SHA_CLASS_IMPL(SHA512)
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
new file mode 100644
index 0000000..1bea9ab
--- /dev/null
+++ b/Source/cmCryptoHash.h
@@ -0,0 +1,65 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCryptoHash_h
+#define cmCryptoHash_h
+
+#include "cmStandardIncludes.h"
+
+#include <cmsys/auto_ptr.hxx>
+
+class cmCryptoHash
+{
+public:
+ virtual ~cmCryptoHash() {}
+ static cmsys::auto_ptr<cmCryptoHash> New(const char* algo);
+ std::string HashString(const char* input);
+ std::string HashFile(const char* file);
+protected:
+ virtual void Initialize()=0;
+ virtual void Append(unsigned char const*, int)=0;
+ virtual std::string Finalize()=0;
+};
+
+class cmCryptoHashMD5: public cmCryptoHash
+{
+ struct cmsysMD5_s* MD5;
+public:
+ cmCryptoHashMD5();
+ ~cmCryptoHashMD5();
+protected:
+ virtual void Initialize();
+ virtual void Append(unsigned char const* buf, int sz);
+ virtual std::string Finalize();
+};
+
+#define cmCryptoHash_SHA_CLASS_DECL(SHA) \
+ class cmCryptoHash##SHA: public cmCryptoHash \
+ { \
+ union _SHA_CTX* SHA; \
+ public: \
+ cmCryptoHash##SHA(); \
+ ~cmCryptoHash##SHA(); \
+ protected: \
+ virtual void Initialize(); \
+ virtual void Append(unsigned char const* buf, int sz); \
+ virtual std::string Finalize(); \
+ }
+
+cmCryptoHash_SHA_CLASS_DECL(SHA1);
+cmCryptoHash_SHA_CLASS_DECL(SHA224);
+cmCryptoHash_SHA_CLASS_DECL(SHA256);
+cmCryptoHash_SHA_CLASS_DECL(SHA384);
+cmCryptoHash_SHA_CLASS_DECL(SHA512);
+
+#undef cmCryptoHash_SHA_CLASS_DECL
+
+#endif
diff --git a/Source/cmDocumentLocationUndefined.h b/Source/cmDocumentLocationUndefined.h
new file mode 100644
index 0000000..d1be77a
--- /dev/null
+++ b/Source/cmDocumentLocationUndefined.h
@@ -0,0 +1,24 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmDocumentLocationUndefined_h
+#define cmDocumentLocationUndefined_h
+
+#define CM_LOCATION_UNDEFINED_BEHAVIOR(action) \
+ "\n" \
+ "Do not set properties that affect the location of a target after " \
+ action ". These include properties whose names match " \
+ "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?\" " \
+ "or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \
+ "Failure to follow this rule is not diagnosed and leaves the location " \
+ "of the target undefined."
+
+#endif
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index ed303c9..a0632a2 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -508,6 +508,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
+ ("CMAKE_AUTOMOC_STRICT_MODE", cmProperty::VARIABLE,
+ "Switch between strict and relaxed automoc mode.",
+ "When TRUE, automoc behaves exactly as described in the documentation "
+ "of the AUTOMOC target property. "
+ "When set to FALSE, it accepts more input and tries to find the correct "
+ "input file for moc even if it differs from the documented behaviour. "
+ "In this mode it e.g. also checks whether a header file is intended to "
+ "be processed by moc when a \"foo.moc\" file has been included.\n"
+ "When using Qt4, CMAKE_AUTOMOC_STRICT_MODE is initialized to FALSE. "
+ "It also has to be set to FALSE for KDE4 compatibility.",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE,
"Prefixes to prepend when looking for libraries.",
"This specifies what prefixes to add to library names when "
@@ -1112,6 +1126,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_GNUtoMS", cmProperty::VARIABLE,
+ "Convert GNU import libraries (.dll.a) to MS format (.lib).",
+ "This variable is used to initialize the GNUtoMS property on targets "
+ "when they are created. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+
+ cm->DefineProperty
("CMAKE_DEBUG_POSTFIX", cmProperty::VARIABLE,
"See variable CMAKE_<CONFIG>_POSTFIX.",
"This variable is a special case of the more-general "
@@ -1515,6 +1538,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_COMPILER_ID_RUN",
cmProperty::VARIABLE,0,0);
+ cm->DefineProperty("CMAKE_<LANG>_ABI_FILES",
+ cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE",
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 7e73e36..32595ee 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -125,6 +125,8 @@ cmExportBuildFileGenerator
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
std::string value = target->GetFullPath(config, true);
+ target->GetImplibGNUtoMS(value, value,
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
properties[prop] = value;
}
}
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index f33e9e2..eb19d2e 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -13,6 +13,7 @@
#define cmExportCommand_h
#include "cmCommand.h"
+#include "cmDocumentLocationUndefined.h"
class cmExportBuildFileGenerator;
@@ -80,6 +81,7 @@ public:
"should never be installed. "
"See the install(EXPORT) command to export targets from an "
"installation tree."
+ CM_LOCATION_UNDEFINED_BEHAVIOR("passing it to this command")
"\n"
" export(PACKAGE <name>)\n"
"Store the current build directory in the CMake user package registry "
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 9e5c91e..c4f5dfb 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -368,3 +368,66 @@ cmExportFileGenerator
os << " )\n"
<< "\n";
}
+
+
+//----------------------------------------------------------------------------
+void
+cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
+{
+ // Add code which verifies at cmake time that the file which is being
+ // imported actually exists on disk. This should in theory always be theory
+ // case, but still when packages are split into normal and development
+ // packages this might get broken (e.g. the Config.cmake could be part of
+ // the non-development package, something similar happened to me without
+ // on SUSE with a mysql pkg-config file, which claimed everything is fine,
+ // but the development package was not installed.).
+ os << "# Loop over all imported files and verify that they actually exist\n"
+ "FOREACH(target ${_IMPORT_CHECK_TARGETS} )\n"
+ " FOREACH(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
+ " IF(NOT EXISTS \"${file}\" )\n"
+ " MESSAGE(FATAL_ERROR \"The imported target \\\"${target}\\\""
+ " references the file\n"
+ " \\\"${file}\\\"\n"
+ "but this file does not exist. Possible reasons include:\n"
+ "* The file was deleted, renamed, or moved to another location.\n"
+ "* An install or uninstall procedure did not complete successfully.\n"
+ "* The installation package was faulty and contained\n"
+ " \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n"
+ "but not all the files it references.\n"
+ "\")\n"
+ " ENDIF()\n"
+ " ENDFOREACH()\n"
+ " UNSET(_IMPORT_CHECK_FILES_FOR_${target})\n"
+ "ENDFOREACH()\n"
+ "UNSET(_IMPORT_CHECK_TARGETS)\n"
+ "\n";
+}
+
+
+//----------------------------------------------------------------------------
+void
+cmExportFileGenerator
+::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
+ ImportPropertyMap const& properties,
+ const std::set<std::string>& importedLocations)
+{
+ // Construct the imported target name.
+ std::string targetName = this->Namespace;
+ targetName += target->GetName();
+
+ os << "LIST(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n"
+ "LIST(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " ";
+
+ for(std::set<std::string>::const_iterator li = importedLocations.begin();
+ li != importedLocations.end();
+ ++li)
+ {
+ ImportPropertyMap::const_iterator pi = properties.find(*li);
+ if (pi != properties.end())
+ {
+ os << "\"" << pi->second << "\" ";
+ }
+ }
+
+ os << ")\n\n";
+}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 05f73a2..f271e55 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -56,6 +56,11 @@ protected:
void GenerateImportPropertyCode(std::ostream& os, const char* config,
cmTarget* target,
ImportPropertyMap const& properties);
+ void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
+ ImportPropertyMap const& properties,
+ const std::set<std::string>& importedLocations);
+ void GenerateImportedFileCheckLoop(std::ostream& os);
+
// Collect properties with detailed information about targets beyond
// their location on disk.
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 23ff5fb..da14dd7 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -167,16 +167,18 @@ cmExportInstallFileGenerator
// Collect import properties for this target.
cmTargetExport* te = *tei;
ImportPropertyMap properties;
+ std::set<std::string> importedLocations;
+ this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
+ properties, importedLocations);
+ this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
+ properties, importedLocations);
this->SetImportLocationProperty(config, suffix,
- te->ArchiveGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->LibraryGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->RuntimeGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->FrameworkGenerator, properties);
- this->SetImportLocationProperty(config, suffix,
- te->BundleGenerator, properties);
+ te->RuntimeGenerator, properties,
+ importedLocations);
+ this->SetImportLocationProperty(config, suffix, te->FrameworkGenerator,
+ properties, importedLocations);
+ this->SetImportLocationProperty(config, suffix, te->BundleGenerator,
+ properties, importedLocations);
// If any file location was set for the target add it to the
// import file.
@@ -194,9 +196,13 @@ cmExportInstallFileGenerator
// Generate code in the export file.
this->GenerateImportPropertyCode(os, config, te->Target, properties);
+ this->GenerateImportedFileChecksCode(os, te->Target, properties,
+ importedLocations);
}
}
+ this->GenerateImportedFileCheckLoop(os);
+
// Cleanup the import prefix variable.
if(!this->ImportPrefix.empty())
{
@@ -211,7 +217,9 @@ void
cmExportInstallFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
cmInstallTargetGenerator* itgen,
- ImportPropertyMap& properties)
+ ImportPropertyMap& properties,
+ std::set<std::string>& importedLocations
+ )
{
// Skip rules that do not match this configuration.
if(!(itgen && itgen->InstallsForConfig(config)))
@@ -249,6 +257,7 @@ cmExportInstallFileGenerator
// Store the property.
properties[prop] = value;
+ importedLocations.insert(prop);
}
else
{
@@ -291,6 +300,7 @@ cmExportInstallFileGenerator
// Store the property.
properties[prop] = value;
+ importedLocations.insert(prop);
}
}
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 8c8fb44..fb678e8 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -75,7 +75,9 @@ protected:
void SetImportLocationProperty(const char* config,
std::string const& suffix,
cmInstallTargetGenerator* itgen,
- ImportPropertyMap& properties);
+ ImportPropertyMap& properties,
+ std::set<std::string>& importedLocations
+ );
void ComplainAboutImportPrefix(cmInstallTargetGenerator* itgen);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 248a30a..07549e9 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -85,7 +85,16 @@ void cmExtraEclipseCDT4Generator::Generate()
this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory);
this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
- mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"));
+ mf->IsOn("CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT"));
+
+ if ((this->GenerateSourceProject == false)
+ && (mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT")))
+ {
+ mf->IssueMessage(cmake::WARNING,
+ "ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT is set to TRUE, "
+ "but this variable is not supported anymore since CMake 2.8.7.\n"
+ "Enable CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT instead.");
+ }
if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
this->HomeDirectory.c_str()))
@@ -113,7 +122,7 @@ void cmExtraEclipseCDT4Generator::Generate()
this->CreateCProjectFile();
}
-void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const
+void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
{
assert(this->HomeDirectory != this->HomeOutputDirectory);
@@ -141,6 +150,16 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const
"\t</buildSpec>\n"
"\t<natures>\n"
"\t</natures>\n"
+ "\t<linkedResources>\n";
+
+ if (this->SupportsVirtualFolders)
+ {
+ this->CreateLinksToSubprojects(fout, this->HomeDirectory);
+ this->SrcLinkedResources.clear();
+ }
+
+ fout <<
+ "\t</linkedResources>\n"
"</projectDescription>\n"
;
}
@@ -434,7 +453,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
if (this->SupportsVirtualFolders)
{
- this->CreateLinksToSubprojects(fout);
+ this->CreateLinksToSubprojects(fout, this->HomeOutputDirectory);
this->CreateLinksForTargets(fout);
}
@@ -541,7 +560,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
- cmGeneratedFileStream& fout)
+ cmGeneratedFileStream& fout, const std::string& baseDir)
{
// for each sub project create a linked resource to the source dir
// - only if it is an out-of-source build
@@ -557,8 +576,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
it->second[0]->GetMakefile()->GetStartDirectory());
// a linked resource must not point to a parent directory of .project or
// .project itself
- if ((this->HomeOutputDirectory != linkSourceDirectory) &&
- !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
+ if ((baseDir != linkSourceDirectory) &&
+ !cmSystemTools::IsSubDirectory(baseDir.c_str(),
linkSourceDirectory.c_str()))
{
std::string linkName = "[Subprojects]/";
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 61302e7..ebd8c08 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -46,7 +46,7 @@ public:
private:
// create .project file in the source tree
- void CreateSourceProjectFile() const;
+ void CreateSourceProjectFile();
// create .project file
void CreateProjectFile();
@@ -104,7 +104,8 @@ private:
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
- void CreateLinksToSubprojects(cmGeneratedFileStream& fout);
+ void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
+ const std::string& baseDir);
void CreateLinksForTargets(cmGeneratedFileStream& fout);
std::vector<std::string> SrcLinkedResources;
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index f933666..6df5ab3 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -13,6 +13,7 @@
#include "cmake.h"
#include "cmHexFileConverter.h"
#include "cmFileTimeComparison.h"
+#include "cmCryptoHash.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_curl.h"
@@ -22,6 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <cmsys/auto_ptr.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -83,6 +85,15 @@ bool cmFileCommand
{
return this->HandleReadCommand(args);
}
+ else if ( subCommand == "MD5" ||
+ subCommand == "SHA1" ||
+ subCommand == "SHA224" ||
+ subCommand == "SHA256" ||
+ subCommand == "SHA384" ||
+ subCommand == "SHA512" )
+ {
+ return this->HandleHashCommand(args);
+ }
else if ( subCommand == "STRINGS" )
{
return this->HandleStringsCommand(args);
@@ -339,6 +350,41 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
}
//----------------------------------------------------------------------------
+bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
+{
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ if(args.size() != 3)
+ {
+ cmOStringStream e;
+ e << args[0] << " requires a file name and output variable";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
+ if(hash.get())
+ {
+ std::string out = hash->HashFile(args[1].c_str());
+ if(!out.empty())
+ {
+ this->Makefile->AddDefinition(args[2].c_str(), out.c_str());
+ return true;
+ }
+ cmOStringStream e;
+ e << args[0] << " failed to read file \"" << args[1] << "\": "
+ << cmSystemTools::GetLastSystemError();
+ this->SetError(e.str().c_str());
+ }
+ return false;
+#else
+ cmOStringStream e;
+ e << args[0] << " not available during bootstrap";
+ this->SetError(e.str().c_str());
+ return false;
+#endif
+}
+
+//----------------------------------------------------------------------------
bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
{
if(args.size() < 3)
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 162890a..9e2ed0f 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -65,6 +65,7 @@ public:
" file(WRITE filename \"message to write\"... )\n"
" file(APPEND filename \"message to write\"... )\n"
" file(READ filename variable [LIMIT numBytes] [OFFSET offset] [HEX])\n"
+ " file(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512> filename variable)\n"
" file(STRINGS filename variable [LIMIT_COUNT num]\n"
" [LIMIT_INPUT numBytes] [LIMIT_OUTPUT numBytes]\n"
" [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n"
@@ -94,6 +95,8 @@ public:
"variable. It will start at the given offset and read up to numBytes. "
"If the argument HEX is given, the binary data will be converted to "
"hexadecimal representation and this will be stored in the variable.\n"
+ "MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 "
+ "will compute a cryptographic hash of the content of a file.\n"
"STRINGS will parse a list of ASCII strings from a file and "
"store it in a variable. Binary data in the file are ignored. Carriage "
"return (CR) characters are ignored. It works also for Intel Hex and "
@@ -227,6 +230,7 @@ protected:
bool HandleRemove(std::vector<std::string> const& args, bool recurse);
bool HandleWriteCommand(std::vector<std::string> const& args, bool append);
bool HandleReadCommand(std::vector<std::string> const& args);
+ bool HandleHashCommand(std::vector<std::string> const& args);
bool HandleStringsCommand(std::vector<std::string> const& args);
bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse);
bool HandleMakeDirectoryCommand(std::vector<std::string> const& args);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 32eaef8..859503f 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -458,8 +458,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
std::vector<std::string>::iterator new_end =
std::unique(lfiles.begin(), lfiles.end());
lfiles.erase(new_end, lfiles.end());
- std::string dir = mf->GetHomeOutputDirectory();
- this->CurrentReRunCMakeMakefile = dir;
+ this->CurrentReRunCMakeMakefile = mf->GetStartOutputDirectory();
this->CurrentReRunCMakeMakefile += "/CMakeScripts";
cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str());
this->CurrentReRunCMakeMakefile += "/ReRunCMake.make";
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 33ffbfb..ac1c949 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -101,6 +101,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetNameImport;
filesFrom.push_back(from1);
filesTo.push_back(to1);
+ std::string targetNameImportLib;
+ if(this->Target->GetImplibGNUtoMS(targetNameImport,
+ targetNameImportLib))
+ {
+ filesFrom.push_back(fromDirConfig + targetNameImportLib);
+ filesTo.push_back(toDir + targetNameImportLib);
+ }
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
@@ -157,6 +164,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
std::string to1 = toDir + targetNameImport;
filesFrom.push_back(from1);
filesTo.push_back(to1);
+ std::string targetNameImportLib;
+ if(this->Target->GetImplibGNUtoMS(targetNameImport,
+ targetNameImportLib))
+ {
+ filesFrom.push_back(fromDirConfig + targetNameImportLib);
+ filesTo.push_back(toDir + targetNameImportLib);
+ }
// An import library looks like a static library.
type = cmTarget::STATIC_LIBRARY;
@@ -314,7 +328,11 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
if(nameType == NameImplib)
{
// Use the import library name.
- fname = targetNameImport;
+ if(!target->GetImplibGNUtoMS(targetNameImport, fname,
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
+ {
+ fname = targetNameImport;
+ }
}
else if(nameType == NameReal)
{
@@ -339,7 +357,11 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
if(nameType == NameImplib)
{
// Use the import library name.
- fname = targetNameImport;
+ if(!target->GetImplibGNUtoMS(targetNameImport, fname,
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX}"))
+ {
+ fname = targetNameImport;
+ }
}
else if(nameType == NameSO)
{
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 65d6fa6..ffbeb48 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -96,14 +96,14 @@ void cmLocalGenerator::Configure()
std::string filesDir = this->Makefile->GetStartOutputDirectory();
filesDir += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(filesDir.c_str());
-
+
// find & read the list file
this->ReadInputFile();
// at the end of the ReadListFile handle any old style subdirs
// first get all the subdirectories
std::vector<cmLocalGenerator *> subdirs = this->GetChildren();
-
+
// for each subdir recurse
std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin();
for (; sdi != subdirs.end(); ++sdi)
@@ -112,7 +112,7 @@ void cmLocalGenerator::Configure()
{
this->Makefile->ConfigureSubDirectory(*sdi);
}
- }
+ }
// Check whether relative paths should be used for optionally
// relative paths.
@@ -212,10 +212,10 @@ void cmLocalGenerator::ReadInputFile()
}
void cmLocalGenerator::SetupPathConversions()
-{
+{
// Setup the current output directory components for use by
// Convert
- std::string outdir;
+ std::string outdir;
outdir =
cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory());
cmSystemTools::SplitPath(outdir.c_str(), this->HomeDirectoryComponents);
@@ -225,12 +225,12 @@ void cmLocalGenerator::SetupPathConversions()
outdir = cmSystemTools::CollapseFullPath
(this->Makefile->GetHomeOutputDirectory());
- cmSystemTools::SplitPath(outdir.c_str(),
+ cmSystemTools::SplitPath(outdir.c_str(),
this->HomeOutputDirectoryComponents);
outdir = cmSystemTools::CollapseFullPath
(this->Makefile->GetStartOutputDirectory());
- cmSystemTools::SplitPath(outdir.c_str(),
+ cmSystemTools::SplitPath(outdir.c_str(),
this->StartOutputDirectoryComponents);
}
@@ -289,17 +289,17 @@ void cmLocalGenerator::GenerateTestFiles()
fout.SetCopyIfDifferent(true);
fout << "# CMake generated Testfile for " << std::endl
- << "# Source directory: "
+ << "# Source directory: "
<< this->Makefile->GetStartDirectory() << std::endl
- << "# Build directory: "
+ << "# Build directory: "
<< this->Makefile->GetStartOutputDirectory() << std::endl
<< "# " << std::endl
<< "# This file includes the relevent testing commands "
<< "required for " << std::endl
<< "# testing this directory and lists subdirectories to "
<< "be tested as well." << std::endl;
-
- const char* testIncludeFile =
+
+ const char* testIncludeFile =
this->Makefile->GetProperty("TEST_INCLUDE_FILE");
if ( testIncludeFile )
{
@@ -320,7 +320,7 @@ void cmLocalGenerator::GenerateTestFiles()
for(i = 0; i < this->Children.size(); ++i)
{
fout << "SUBDIRS(";
- std::string outP =
+ std::string outP =
this->Children[i]->GetMakefile()->GetStartOutputDirectory();
fout << this->Convert(outP.c_str(),START_OUTPUT);
fout << ")" << std::endl;
@@ -472,7 +472,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Ask each install generator to write its code.
std::vector<cmInstallGenerator*> const& installers =
this->Makefile->GetInstallGenerators();
- for(std::vector<cmInstallGenerator*>::const_iterator
+ for(std::vector<cmInstallGenerator*>::const_iterator
gi = installers.begin();
gi != installers.end(); ++gi)
{
@@ -553,15 +553,15 @@ void cmLocalGenerator::GenerateTargetManifest()
}
}
-void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
- const char* lang,
+void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
+ const char* lang,
cmSourceFile& source,
cmTarget& )
-{
+{
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
- std::string sourceFile =
+ std::string sourceFile =
this->Convert(source.GetFullPath().c_str(),START_OUTPUT,SHELL,true);
std::string varString = "CMAKE_";
varString += lang;
@@ -655,7 +655,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
ofname += "/";
ofname += obj;
objVector.push_back(ofname);
- this->AddCustomCommandToCreateObject(ofname.c_str(),
+ this->AddCustomCommandToCreateObject(ofname.c_str(),
llang, *(*i), target);
objs += this->Convert(ofname.c_str(),START_OUTPUT,MAKEFILE);
objs += " ";
@@ -672,7 +672,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
// Shared Module:
std::string linkLibs; // should be set
std::string flags; // should be set
- std::string linkFlags; // should be set
+ std::string linkFlags; // should be set
this->GetTargetFlags(linkLibs, flags, linkFlags, target);
cmLocalGenerator::RuleVariables vars;
vars.Language = llang;
@@ -682,17 +682,17 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
vars.LinkLibraries = linkLibs.c_str();
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
-
+
std::string langFlags;
this->AddLanguageFlags(langFlags, llang, 0);
this->AddArchitectureFlags(langFlags, &target, llang, 0);
vars.LanguageCompileFlags = langFlags.c_str();
-
+
cmCustomCommandLines commandLines;
std::vector<std::string> rules;
rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str()));
std::vector<std::string> commands;
- cmSystemTools::ExpandList(rules, commands);
+ cmSystemTools::ExpandList(rules, commands);
for(std::vector<std::string>::iterator i = commands.begin();
i != commands.end(); ++i)
{
@@ -728,21 +728,21 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
(this->Makefile->GetSource(targetFullPath.c_str()));
}
-
+
void cmLocalGenerator
::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang)
-{
+{
cmTargets &tgts = this->Makefile->GetTargets();
- for(cmTargets::iterator l = tgts.begin();
+ for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
cmTarget& target = l->second;
switch(target.GetType())
- {
+ {
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
- case cmTarget::EXECUTABLE:
+ case cmTarget::EXECUTABLE:
{
const char* llang = target.GetLinkerLanguage();
if(!llang)
@@ -759,7 +759,7 @@ void cmLocalGenerator
this->AddBuildTargetRule(llang, target);
}
}
- break;
+ break;
default:
break;
}
@@ -769,14 +769,14 @@ void cmLocalGenerator
// List of variables that are replaced when
// rules are expanced. These variables are
// replaced in the form <var> with GetSafeDefinition(var).
-// ${LANG} is replaced in the variable first with all enabled
+// ${LANG} is replaced in the variable first with all enabled
// languages.
static const char* ruleReplaceVars[] =
{
"CMAKE_${LANG}_COMPILER",
"CMAKE_SHARED_LIBRARY_CREATE_${LANG}_FLAGS",
"CMAKE_SHARED_MODULE_CREATE_${LANG}_FLAGS",
- "CMAKE_SHARED_MODULE_${LANG}_FLAGS",
+ "CMAKE_SHARED_MODULE_${LANG}_FLAGS",
"CMAKE_SHARED_LIBRARY_${LANG}_FLAGS",
"CMAKE_${LANG}_LINK_FLAGS",
"CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG",
@@ -807,7 +807,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.Flags;
}
}
-
+
if(replaceValues.Source)
{
if(variable == "SOURCE")
@@ -870,7 +870,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(replaceValues.Target)
- {
+ {
if(variable == "TARGET_QUOTED")
{
std::string targetQuoted = replaceValues.Target;
@@ -1018,13 +1018,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
int pos = 0;
while(ruleReplaceVars[pos])
{
- for(std::vector<std::string>::iterator i = enabledLanguages.begin();
- i != enabledLanguages.end(); ++i)
- {
+ for(std::vector<std::string>::iterator i = enabledLanguages.begin();
+ i != enabledLanguages.end(); ++i)
+ {
const char* lang = i->c_str();
std::string actualReplace = ruleReplaceVars[pos];
// If this is the compiler then look for the extra variable
- // _COMPILER_ARG1 which must be the first argument to the compiler
+ // _COMPILER_ARG1 which must be the first argument to the compiler
const char* compilerArg1 = 0;
if(actualReplace == "CMAKE_${LANG}_COMPILER")
{
@@ -1038,7 +1038,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(actualReplace == variable)
{
- std::string replace =
+ std::string replace =
this->Makefile->GetSafeDefinition(variable.c_str());
// if the variable is not a FLAG then treat it like a path
if(variable.find("_FLAG") == variable.npos)
@@ -1062,7 +1062,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
-void
+void
cmLocalGenerator::ExpandRuleVariables(std::string& s,
const RuleVariables& replaceValues)
{
@@ -1213,7 +1213,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
flagVar += lang;
- const char* includeFlag =
+ const char* includeFlag =
this->Makefile->GetSafeDefinition(flagVar.c_str());
flagVar = "CMAKE_INCLUDE_FLAG_SEP_";
flagVar += lang;
@@ -1223,7 +1223,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
{
quotePaths = true;
}
- bool repeatFlag = true;
+ bool repeatFlag = true;
// should the include flag be repeated like ie. -IA -IB
if(!sep)
{
@@ -1354,15 +1354,15 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
this->Makefile->GetDefinition("VTK_SOURCE_DIR");
if(vtkSourceDir)
{
- const char* vtk_major =
+ const char* vtk_major =
this->Makefile->GetDefinition("VTK_MAJOR_VERSION");
- const char* vtk_minor =
+ const char* vtk_minor =
this->Makefile->GetDefinition("VTK_MINOR_VERSION");
vtk_major = vtk_major? vtk_major : "4";
vtk_minor = vtk_minor? vtk_minor : "4";
int vmajor = 0;
int vminor = 0;
- if(sscanf(vtk_major, "%d", &vmajor) &&
+ if(sscanf(vtk_major, "%d", &vmajor) &&
sscanf(vtk_minor, "%d", &vminor) && vmajor == 4 && vminor <= 4)
{
includeSourceDir = true;
@@ -1403,7 +1403,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
// Get the project-specified include directories.
- std::vector<std::string>& includes =
+ std::vector<std::string>& includes =
this->Makefile->GetIncludeDirectories();
// Support putting all the in-project include directories first if
@@ -1446,17 +1446,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
std::string& linkFlags,
cmTarget& target)
{
- std::string buildType =
+ std::string buildType =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- buildType = cmSystemTools::UpperCase(buildType);
- const char* libraryLinkVariable =
+ buildType = cmSystemTools::UpperCase(buildType);
+ const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
-
+
switch(target.GetType())
{
- case cmTarget::STATIC_LIBRARY:
+ case cmTarget::STATIC_LIBRARY:
{
- const char* targetLinkFlags =
+ const char* targetLinkFlags =
target.GetProperty("STATIC_LIBRARY_FLAGS");
if(targetLinkFlags)
{
@@ -1475,11 +1475,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
}
}
}
- break;
+ break;
case cmTarget::MODULE_LIBRARY:
libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS";
case cmTarget::SHARED_LIBRARY:
- {
+ {
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
if(!buildType.empty())
@@ -1489,8 +1489,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
build += buildType;
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
- }
- if(this->Makefile->IsOn("WIN32") &&
+ }
+ if(this->Makefile->IsOn("WIN32") &&
!(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")))
{
const std::vector<cmSourceFile*>& sources = target.GetSourceFiles();
@@ -1500,14 +1500,14 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
cmSourceFile* sf = *i;
if(sf->GetExtension() == "def")
{
- linkFlags +=
+ linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += this->Convert(sf->GetFullPath().c_str(),
START_OUTPUT, SHELL);
linkFlags += " ";
}
}
- }
+ }
const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
if(targetLinkFlags)
{
@@ -1520,11 +1520,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
- {
+ {
linkFlags += targetLinkFlags;
linkFlags += " ";
}
- }
+ }
cmOStringStream linklibsStr;
this->OutputLinkLibraries(linklibsStr, target, false);
linkLibs = linklibsStr.str();
@@ -1532,7 +1532,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
break;
case cmTarget::EXECUTABLE:
{
- linkFlags +=
+ linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
if(!buildType.empty())
@@ -1541,7 +1541,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
build += buildType;
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
- }
+ }
const char* linkLanguage = target.GetLinkerLanguage();
if(!linkLanguage)
{
@@ -1566,7 +1566,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
if(cmSystemTools::IsOn
(this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
{
- std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_")
+ std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_")
+ linkLanguage + std::string("_FLAGS");
linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str());
linkFlags += " ";
@@ -1579,7 +1579,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
}
else
{
- linkFlags +=
+ linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
linkFlags += " ";
}
@@ -1595,13 +1595,13 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
- {
+ {
linkFlags += targetLinkFlags;
linkFlags += " ";
}
}
}
- break;
+ break;
default:
break;
}
@@ -1661,9 +1661,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
const char* linkLanguage = cli.GetLinkLanguage();
- std::string libPathFlag =
+ std::string libPathFlag =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
- std::string libPathTerminator =
+ std::string libPathTerminator =
this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
// Flags to link an executable to shared libraries.
@@ -1786,11 +1786,11 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
{
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
- const char* sysroot =
+ const char* sysroot =
this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
- const char* sysrootDefault =
+ const char* sysrootDefault =
this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
- const char* deploymentTarget =
+ const char* deploymentTarget =
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT";
bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str());
@@ -1876,7 +1876,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
if(cmSystemTools::FileIsFullPath(inName))
{
std::string tLocation;
- if(target->GetType() >= cmTarget::EXECUTABLE &&
+ if(target->GetType() >= cmTarget::EXECUTABLE &&
target->GetType() <= cmTarget::MODULE_LIBRARY)
{
tLocation = target->GetLocation(config);
@@ -2904,7 +2904,7 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
else
{
cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags);
- }
+ }
return std::string(&arg[0]);
}
@@ -2976,9 +2976,9 @@ cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
//----------------------------------------------------------------------------
-void
+void
cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* ,
- std::vector<std::string>&
+ std::vector<std::string>&
)
{
cmSystemTools::Error("GetTargetObjectFileDirectories"
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 4d16409..de1ac30 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -250,6 +250,20 @@ cmLocalVisualStudioGenerator
// Add this command line.
std::string cmd = ccg.GetCommand(c);
+
+ // Use "call " before any invocations of .bat or .cmd files
+ // invoked as custom commands.
+ //
+ std::string suffix;
+ if (cmd.size() > 4)
+ {
+ suffix = cmSystemTools::LowerCase(cmd.substr(cmd.size()-4));
+ if (suffix == ".bat" || suffix == ".cmd")
+ {
+ script += "call ";
+ }
+ }
+
script += this->Convert(cmd.c_str(), relativeRoot, SHELL);
ccg.AppendArguments(c, script);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 573c430..7939d73 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3213,7 +3213,8 @@ void cmMakefile::ConfigureString(const std::string& input,
}
int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
- bool copyonly, bool atOnly, bool escapeQuotes)
+ bool copyonly, bool atOnly, bool escapeQuotes,
+ const cmNewLineStyle& newLine)
{
int res = 1;
if ( !this->CanIWriteThisFile(outfile) )
@@ -3250,9 +3251,20 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
}
else
{
+ std::string newLineCharacters;
+ std::ios_base::openmode omode = std::ios_base::out | std::ios_base::trunc;
+ if (newLine.IsValid())
+ {
+ newLineCharacters = newLine.GetCharacters();
+ omode |= std::ios::binary;
+ }
+ else
+ {
+ newLineCharacters = "\n";
+ }
std::string tempOutputFile = soutfile;
tempOutputFile += ".tmp";
- std::ofstream fout(tempOutputFile.c_str());
+ std::ofstream fout(tempOutputFile.c_str(), omode);
if(!fout)
{
cmSystemTools::Error(
@@ -3277,7 +3289,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
{
outLine = "";
this->ConfigureString(inLine, outLine, atOnly, escapeQuotes);
- fout << outLine.c_str() << "\n";
+ fout << outLine.c_str() << newLineCharacters;
}
// close the files before attempting to copy
fin.close();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 7c3e4ee..1236787 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -19,6 +19,7 @@
#include "cmPropertyMap.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmNewLineStyle.h"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -703,7 +704,9 @@ public:
* Copy file but change lines acording to ConfigureString
*/
int ConfigureFile(const char* infile, const char* outfile,
- bool copyonly, bool atOnly, bool escapeQuotes);
+ bool copyonly, bool atOnly, bool escapeQuotes,
+ const cmNewLineStyle& = cmNewLineStyle());
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index cd75d79..78278cb 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -241,6 +241,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
exeCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
+ std::string implib;
+ if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
+ {
+ exeCleanFiles.push_back(this->Convert(implib.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
}
// List the PDB for cleaning only when the whole target is
@@ -270,8 +277,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage;
linkRuleVar += "_LINK_EXECUTABLE";
- std::string linkRule =
- this->Makefile->GetRequiredDefinition(linkRuleVar.c_str());
+ std::string linkRule = this->GetLinkRule(linkRuleVar.c_str());
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
if(this->Target->IsExecutableWithExports())
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 31f7be5..b4174cc 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -512,6 +512,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
+ std::string implib;
+ if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
+ {
+ libCleanFiles.push_back(this->Convert(implib.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
}
// List the PDB for cleaning only when the whole target is
@@ -772,7 +779,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
else
{
// Get the set of commands.
- std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
+ std::string linkRule = this->GetLinkRule(linkRuleVar);
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
// Expand placeholders.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 8b91194..a3a832b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1634,6 +1634,23 @@ void cmMakefileTargetGenerator
}
//----------------------------------------------------------------------------
+std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar)
+{
+ std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar);
+ if(this->Target->HasImplibGNUtoMS())
+ {
+ std::string ruleVar = "CMAKE_";
+ ruleVar += this->Target->GetLinkerLanguage(this->ConfigName);
+ ruleVar += "_GNUtoMS_RULE";
+ if(const char* rule = this->Makefile->GetDefinition(ruleVar.c_str()))
+ {
+ linkRule += rule;
+ }
+ }
+ return linkRule;
+}
+
+//----------------------------------------------------------------------------
void cmMakefileTargetGenerator
::CloseFileStreams()
{
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 674cd13..8fba13f 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -120,6 +120,9 @@ protected:
// Append link rule dependencies (objects, etc.).
void AppendLinkDepends(std::vector<std::string>& depends);
+ // Lookup the link rule for this target.
+ std::string GetLinkRule(const char* linkRuleVar);
+
/** In order to support parallel builds for custom commands with
multiple outputs the outputs are given a serial order, and only
the first output actually has the build rule. Other outputs
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
new file mode 100644
index 0000000..6f7b6a9
--- /dev/null
+++ b/Source/cmNewLineStyle.cxx
@@ -0,0 +1,95 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2011 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 "cmNewLineStyle.h"
+
+
+
+cmNewLineStyle::cmNewLineStyle() : NewLineStyle(Invalid)
+{
+}
+
+
+bool cmNewLineStyle::IsValid() const
+{
+ return NewLineStyle != Invalid;
+}
+
+
+bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
+ std::string& errorString)
+{
+ NewLineStyle = Invalid;
+
+ for (size_t i = 0; i< args.size(); i++)
+ {
+ if (args[i] == "NEWLINE_STYLE")
+ {
+ size_t const styleIndex = i + 1;
+ if (args.size() > styleIndex)
+ {
+ const std::string eol = args[styleIndex];
+ if (eol == "LF" || eol == "UNIX")
+ {
+ NewLineStyle = LF;
+ return true;
+ }
+ else if (eol == "CRLF" || eol == "WIN32" || eol == "DOS")
+ {
+ NewLineStyle = CRLF;
+ return true;
+ }
+ else
+ {
+ errorString = "NEWLINE_STYLE sets an unknown style, only LF, "
+ "CRLF, UNIX, DOS, and WIN32 are supported";
+ return false;
+ }
+ }
+ else
+ {
+ errorString = "NEWLINE_STYLE must set a style: "
+ "LF, CRLF, UNIX, DOS, or WIN32";
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+
+const std::string cmNewLineStyle::GetCharacters() const
+{
+ switch (NewLineStyle)
+ {
+ case Invalid:
+ return "";
+ case LF:
+ return "\n";
+ case CRLF:
+ return "\r\n";
+ default:
+ ;
+ };
+ return "";
+}
+
+
+void cmNewLineStyle::SetStyle(Style style)
+{
+ NewLineStyle = style;
+}
+
+
+cmNewLineStyle::Style cmNewLineStyle::GetStyle() const
+{
+ return NewLineStyle;
+}
diff --git a/Source/cmNewLineStyle.h b/Source/cmNewLineStyle.h
new file mode 100644
index 0000000..cae1106
--- /dev/null
+++ b/Source/cmNewLineStyle.h
@@ -0,0 +1,46 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2011 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmNewLineStyle_h
+#define cmNewLineStyle_h
+
+#include "cmStandardIncludes.h"
+
+class cmNewLineStyle
+{
+public:
+
+ cmNewLineStyle();
+
+ enum Style
+ {
+ Invalid,
+ // LF = '\n', 0x0A, 10
+ // CR = '\r', 0x0D, 13
+ LF, // Unix
+ CRLF // Dos
+ };
+
+ void SetStyle(Style);
+ Style GetStyle() const;
+
+ bool IsValid() const;
+
+ bool ReadFromArguments(const std::vector<std::string>& args,
+ std::string &errorString);
+
+ const std::string GetCharacters() const;
+
+private:
+ Style NewLineStyle;
+};
+
+#endif
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index ae63701..65c7952 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -17,11 +17,70 @@
#include "cmSourceFile.h"
#include "cmSystemTools.h"
-# include <cmsys/Terminal.h>
+#include <cmsys/Terminal.h>
+
+#include <string.h>
#include "cmQtAutomoc.h"
+static bool containsQ_OBJECT(const std::string& text)
+{
+ // this simple check is much much faster than the regexp
+ if (strstr(text.c_str(), "Q_OBJECT") == NULL)
+ {
+ return false;
+ }
+
+ cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
+ return qObjectRegExp.find(text);
+}
+
+
+static std::string findMatchingHeader(const std::string& absPath,
+ const std::string& mocSubDir,
+ const std::string& basename,
+ const std::list<std::string>& headerExtensions)
+{
+ std::string header;
+ for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
+ ext != headerExtensions.end();
+ ++ext)
+ {
+ std::string sourceFilePath = absPath + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ {
+ header = sourceFilePath;
+ break;
+ }
+ if (!mocSubDir.empty())
+ {
+ sourceFilePath = mocSubDir + basename + (*ext);
+ if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ {
+ header = sourceFilePath;
+ break;
+ }
+ }
+ }
+
+ return header;
+}
+
+
+static std::string extractSubDir(const std::string& absPath,
+ const std::string& currentMoc)
+{
+ std::string subDir;
+ if (currentMoc.find_first_of('/') != std::string::npos)
+ {
+ subDir = absPath
+ + cmsys::SystemTools::GetFilenamePath(currentMoc) + '/';
+ }
+ return subDir;
+}
+
+
cmQtAutomoc::cmQtAutomoc()
:Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
,ColorOutput(true)
@@ -49,13 +108,23 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
{
cmMakefile* makefile = target->GetMakefile();
const char* targetName = target->GetName();
- // don't do anything if there is no Qt4:
+ // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajorVersion == "")
+ {
+ qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
+ }
if (qtMajorVersion != "4" && qtMajorVersion != "5")
{
return;
}
+ bool strictMode = (qtMajorVersion == "5");
+ if (makefile->IsDefinitionSet("CMAKE_AUTOMOC_STRICT_MODE"))
+ {
+ strictMode = makefile->IsOn("CMAKE_AUTOMOC_STRICT_MODE");
+ }
+
// create a custom target for running automoc at buildtime:
std::string automocTargetName = targetName;
automocTargetName += "_automoc";
@@ -144,6 +213,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
makefile->AddDefinition("_moc_options", _moc_options.c_str());
makefile->AddDefinition("_moc_files", _moc_files.c_str());
makefile->AddDefinition("_moc_headers", _moc_headers.c_str());
+ makefile->AddDefinition("_moc_strict_mode", strictMode ? "TRUE" : "FALSE");
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
std::string inputFile = cmakeRoot;
@@ -179,7 +249,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
{
- this->RunAutomocQt4();
+ this->RunAutomoc();
}
this->WriteOldMocDefinitionsFile(targetDirectory);
@@ -222,6 +292,11 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
}
this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
+ if (this->QtMajorVersion == "")
+ {
+ this->QtMajorVersion = makefile->GetSafeDefinition(
+ "AM_Qt5Core_VERSION_MAJOR");
+ }
this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
this->IncludeProjectDirsBefore = makefile->IsOn(
@@ -238,6 +313,8 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
+ this->StrictMode = makefile->IsOn("AM_STRICT_MODE");
+
return true;
}
@@ -382,7 +459,7 @@ void cmQtAutomoc::Init()
}
-bool cmQtAutomoc::RunAutomocQt4()
+bool cmQtAutomoc::RunAutomoc()
{
if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
|| (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' ')))
@@ -406,6 +483,23 @@ bool cmQtAutomoc::RunAutomocQt4()
std::vector<std::string> sourceFiles;
cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
+ std::list<std::string> headerExtensions;
+ headerExtensions.push_back(".h");
+ headerExtensions.push_back(".hpp");
+ headerExtensions.push_back(".hxx");
+#if defined(_WIN32)
+ // not case sensitive, don't add ".H"
+#elif defined(__APPLE__)
+ // detect case-sensitive filesystem
+ long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE);
+ if (caseSensitive == 1)
+ {
+ headerExtensions.push_back(".H");
+ }
+#else
+ headerExtensions.push_back(".H");
+#endif
+
for (std::vector<std::string>::const_iterator it = sourceFiles.begin();
it != sourceFiles.end();
++it)
@@ -415,7 +509,15 @@ bool cmQtAutomoc::RunAutomocQt4()
{
std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
}
- this->ParseCppFile(absFilename, includedMocs, headerFiles);
+ if (this->StrictMode == false)
+ {
+ this->ParseCppFile(absFilename, headerExtensions, includedMocs);
+ }
+ else
+ {
+ this->StrictParseCppFile(absFilename, headerExtensions, includedMocs);
+ }
+ this->SearchHeadersForCppFile(absFilename, headerExtensions, headerFiles);
}
std::vector<std::string> headerFilesVec;
@@ -496,40 +598,37 @@ bool cmQtAutomoc::RunAutomocQt4()
void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
- std::map<std::string, std::string>& includedMocs,
- std::set<std::string>& absHeaders)
+ const std::list<std::string>& headerExtensions,
+ std::map<std::string, std::string>& includedMocs)
{
cmsys::RegularExpression mocIncludeRegExp(
"[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- std::list<std::string> headerExtensions;
- headerExtensions.push_back(".h");
- headerExtensions.push_back(".hpp");
- headerExtensions.push_back(".hxx");
-#if defined(_WIN32)
- // not case sensitive, don't add ".H"
-#elif defined(__APPLE__)
- // detect case-sensitive filesystem
- long caseSensitive = pathconf(this->Srcdir.c_str(), _PC_CASE_SENSITIVE);
- if (caseSensitive == 1)
- {
- headerExtensions.push_back(".H");
- }
-#else
- headerExtensions.push_back(".H");
-#endif
const std::string contentsString = this->ReadAll(absFilename);
if (contentsString.empty())
{
- std::cerr << "AUTOMOC: empty source file: " << absFilename << std::endl;
+ std::cerr << "AUTOMOC: warning: " << absFilename << ": file is empty\n"
+ << std::endl;
return;
}
const std::string absPath = cmsys::SystemTools::GetFilenamePath(
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+ const std::string scannedFileBasename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFilename);
+ const bool cppContainsQ_OBJECT = containsQ_OBJECT(contentsString);
+ bool dotMocIncluded = false;
+ bool mocUnderscoreIncluded = false;
+ std::string ownMocUnderscoreFile;
+ std::string ownDotMocFile;
+ std::string ownMocHeaderFile;
std::string::size_type matchOffset = 0;
- if (mocIncludeRegExp.find(contentsString.c_str()))
+ // first a simply string check for "moc" is *much* faster than the regexp,
+ // and if the string search already fails, we don't have to try the
+ // expensive regexp
+ if ((strstr(contentsString.c_str(), "moc") != NULL)
+ && (mocIncludeRegExp.find(contentsString)))
{
// for every moc include in the file
do
@@ -552,78 +651,248 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
// basename should be the part of the moc filename used for
// finding the correct header, so we need to remove the moc_ part
basename = basename.substr(4);
+ std::string mocSubDir = extractSubDir(absPath, currentMoc);
+ std::string headerToMoc = findMatchingHeader(
+ absPath, mocSubDir, basename, headerExtensions);
- bool headerFound = false;
- for(std::list<std::string>::const_iterator ext =
- headerExtensions.begin();
- ext != headerExtensions.end();
- ++ext)
+ if (!headerToMoc.empty())
+ {
+ includedMocs[headerToMoc] = currentMoc;
+ if (basename == scannedFileBasename)
+ {
+ mocUnderscoreIncluded = true;
+ ownMocUnderscoreFile = currentMoc;
+ ownMocHeaderFile = headerToMoc;
+ }
+ }
+ else
{
- const std::string &sourceFilePath = absPath + basename + (*ext);
- if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
+ std::cerr << "AUTOMOC: error: " << absFilename << " The file "
+ << "includes the moc file \"" << currentMoc << "\", "
+ << "but could not find header \"" << basename
+ << '{' << this->Join(headerExtensions, ',') << "}\" ";
+ if (mocSubDir.empty())
{
- headerFound = true;
- includedMocs[sourceFilePath] = currentMoc;
- break;
+ std::cerr << "in " << absPath << "\n" << std::endl;
}
+ else
+ {
+ std::cerr << "neither in " << absPath
+ << " nor in " << mocSubDir << "\n" << std::endl;
+ }
+
+ ::exit(EXIT_FAILURE);
}
- if (!headerFound)
+ }
+ else
+ {
+ std::string fileToMoc = absFilename;
+ if ((basename != scannedFileBasename) || (cppContainsQ_OBJECT==false))
{
- // the moc file is in a subdir => look for the header in the
- // same subdir
- if (currentMoc.find_first_of('/') != std::string::npos)
+ std::string mocSubDir = extractSubDir(absPath, currentMoc);
+ std::string headerToMoc = findMatchingHeader(
+ absPath, mocSubDir, basename, headerExtensions);
+ if (!headerToMoc.empty())
{
- const std::string &filepath = absPath
- + cmsys::SystemTools::GetFilenamePath(currentMoc)
- + '/' + basename;
-
- for(std::list<std::string>::const_iterator ext =
- headerExtensions.begin();
- ext != headerExtensions.end();
- ++ext)
+ // this is for KDE4 compatibility:
+ fileToMoc = headerToMoc;
+ if ((cppContainsQ_OBJECT==false) &&(basename==scannedFileBasename))
{
- const std::string &sourceFilePath = filepath + (*ext);
- if (cmsys::SystemTools::FileExists(sourceFilePath.c_str()))
- {
- headerFound = true;
- includedMocs[sourceFilePath] = currentMoc;
- break;
- }
+ std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
+ "includes the moc file \"" << currentMoc <<
+ "\", but does not contain a Q_OBJECT macro. "
+ "Running moc on "
+ << "\"" << headerToMoc << "\" ! Better include \"moc_"
+ << basename << ".cpp\" for a robust build.\n"
+ << std::endl;
}
- if (!headerFound)
+ else
{
- std::cerr << "AUTOMOC: The file \"" << absFilename
- << "\" includes the moc file \"" << currentMoc
- << "\", but neither \"" << absPath << basename
- << '{' << this->Join(headerExtensions, ',')
- << "}\" nor \"" << filepath << '{'
- << this->Join(headerExtensions, ',') << '}'
- << "\" exist." << std::endl;
- ::exit(EXIT_FAILURE);
+ std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
+ "includes the moc file \"" << currentMoc <<
+ "\" instead of \"moc_" << basename << ".cpp\". "
+ "Running moc on "
+ << "\"" << headerToMoc << "\" ! Better include \"moc_"
+ << basename << ".cpp\" for a robust build.\n"
+ << std::endl;
}
}
else
{
- std::cerr << "AUTOMOC: The file \"" << absFilename
- << "\" includes the moc file \"" << currentMoc
- << "\", but \"" << absPath << basename << '{'
- << this->Join(headerExtensions, ',') << '}'
- << "\" does not exist." << std::endl;
+ std::cerr <<"AUTOMOC: error: " << absFilename << ": The file "
+ "includes the moc file \"" << currentMoc <<
+ "\", which seems to be the moc file from a different "
+ "source file. CMake also could not find a matching "
+ "header.\n" << std::endl;
::exit(EXIT_FAILURE);
}
}
+ else
+ {
+ dotMocIncluded = true;
+ ownDotMocFile = currentMoc;
+ }
+ includedMocs[fileToMoc] = currentMoc;
+ }
+ matchOffset += mocIncludeRegExp.end();
+ } while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
+ }
+
+ // In this case, check whether the scanned file itself contains a Q_OBJECT.
+ // If this is the case, the moc_foo.cpp should probably be generated from
+ // foo.cpp instead of foo.h, because otherwise it won't build.
+ // But warn, since this is not how it is supposed to be used.
+ if ((dotMocIncluded == false) && (cppContainsQ_OBJECT == true))
+ {
+ if (mocUnderscoreIncluded == true)
+ {
+ // this is for KDE4 compatibility:
+ std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
+ << "contains a Q_OBJECT macro, but does not include "
+ << "\"" << scannedFileBasename << ".moc\", but instead "
+ "includes "
+ << "\"" << ownMocUnderscoreFile << "\". Running moc on "
+ << "\"" << absFilename << "\" ! Better include \""
+ << scannedFileBasename << ".moc\" for a robust build.\n"
+ << std::endl;
+ includedMocs[absFilename] = ownMocUnderscoreFile;
+ includedMocs.erase(ownMocHeaderFile);
+ }
+ else
+ {
+ // otherwise always error out since it will not compile:
+ std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
+ << "contains a Q_OBJECT macro, but does not include "
+ << "\"" << scannedFileBasename << ".moc\" !\n"
+ << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+ }
+
+}
+
+
+void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
+ const std::list<std::string>& headerExtensions,
+ std::map<std::string, std::string>& includedMocs)
+{
+ cmsys::RegularExpression mocIncludeRegExp(
+ "[\n][ \t]*#[ \t]*include[ \t]+"
+ "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
+
+ const std::string contentsString = this->ReadAll(absFilename);
+ if (contentsString.empty())
+ {
+ std::cerr << "AUTOMOC: warning: " << absFilename << ": file is empty\n"
+ << std::endl;
+ return;
+ }
+ const std::string absPath = cmsys::SystemTools::GetFilenamePath(
+ cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+ const std::string scannedFileBasename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFilename);
+
+ bool dotMocIncluded = false;
+
+ std::string::size_type matchOffset = 0;
+ // first a simply string check for "moc" is *much* faster than the regexp,
+ // and if the string search already fails, we don't have to try the
+ // expensive regexp
+ if ((strstr(contentsString.c_str(), "moc") != NULL)
+ && (mocIncludeRegExp.find(contentsString)))
+ {
+ // for every moc include in the file
+ do
+ {
+ const std::string currentMoc = mocIncludeRegExp.match(1);
+
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(currentMoc);
+ const bool mocUnderscoreStyle = this->StartsWith(basename, "moc_");
+
+ // If the moc include is of the moc_foo.cpp style we expect
+ // the Q_OBJECT class declaration in a header file.
+ // If the moc include is of the foo.moc style we need to look for
+ // a Q_OBJECT macro in the current source file, if it contains the
+ // macro we generate the moc file from the source file.
+ if (mocUnderscoreStyle)
+ {
+ // basename should be the part of the moc filename used for
+ // finding the correct header, so we need to remove the moc_ part
+ basename = basename.substr(4);
+ std::string mocSubDir = extractSubDir(absPath, currentMoc);
+ std::string headerToMoc = findMatchingHeader(
+ absPath, mocSubDir, basename, headerExtensions);
+
+ if (!headerToMoc.empty())
+ {
+ includedMocs[headerToMoc] = currentMoc;
+ }
+ else
+ {
+ std::cerr << "AUTOMOC: error: " << absFilename << " The file "
+ << "includes the moc file \"" << currentMoc << "\", "
+ << "but could not find header \"" << basename
+ << '{' << this->Join(headerExtensions, ',') << "}\" ";
+ if (mocSubDir.empty())
+ {
+ std::cerr << "in " << absPath << "\n" << std::endl;
+ }
+ else
+ {
+ std::cerr << "neither in " << absPath
+ << " nor in " << mocSubDir << "\n" << std::endl;
+ }
+
+ ::exit(EXIT_FAILURE);
+ }
}
else
{
+ if (basename != scannedFileBasename)
+ {
+ std::cerr <<"AUTOMOC: error: " << absFilename << ": The file "
+ "includes the moc file \"" << currentMoc <<
+ "\", which seems to be the moc file from a different "
+ "source file. This is not supported. "
+ "Include \"" << scannedFileBasename << ".moc\" to run "
+ "moc on this source file.\n" << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+ dotMocIncluded = true;
includedMocs[absFilename] = currentMoc;
}
matchOffset += mocIncludeRegExp.end();
} while(mocIncludeRegExp.find(contentsString.c_str() + matchOffset));
}
+ // In this case, check whether the scanned file itself contains a Q_OBJECT.
+ // If this is the case, the moc_foo.cpp should probably be generated from
+ // foo.cpp instead of foo.h, because otherwise it won't build.
+ // But warn, since this is not how it is supposed to be used.
+ if ((dotMocIncluded == false) && (containsQ_OBJECT(contentsString)))
+ {
+ // otherwise always error out since it will not compile:
+ std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
+ << "contains a Q_OBJECT macro, but does not include "
+ << "\"" << scannedFileBasename << ".moc\" !\n"
+ << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
+
+}
+
+
+void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
+ const std::list<std::string>& headerExtensions,
+ std::set<std::string>& absHeaders)
+{
// search for header files and private header files we may need to moc:
const std::string basename =
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename);
+ const std::string absPath = cmsys::SystemTools::GetFilenamePath(
+ cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+
for(std::list<std::string>::const_iterator ext = headerExtensions.begin();
ext != headerExtensions.end();
++ext)
@@ -654,7 +923,6 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
const std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::string>& notIncludedMocs)
{
- cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
for(std::set<std::string>::const_iterator hIt=absHeaders.begin();
hIt!=absHeaders.end();
++hIt)
@@ -673,7 +941,7 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
const std::string currentMoc = "moc_" + basename + ".cpp";
const std::string contents = this->ReadAll(headerName);
- if (qObjectRegExp.find(contents))
+ if (containsQ_OBJECT(contents))
{
//std::cout << "header contains Q_OBJECT macro";
notIncludedMocs[headerName] = currentMoc;
@@ -750,7 +1018,7 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
bool result = cmSystemTools::RunSingleCommand(command, &output, &retVal);
if (!result || retVal)
{
- std::cerr << "AUTOMOC: process for " << mocFilePath << " failed:\n"
+ std::cerr << "AUTOMOC: error: process for " << mocFilePath <<" failed:\n"
<< output << std::endl;
this->RunMocFailed = true;
cmSystemTools::RemoveFile(mocFilePath.c_str());
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index db53b21..a31f36a 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -35,12 +35,19 @@ private:
const char* targetDirectory);
void WriteOldMocDefinitionsFile(const char* targetDirectory);
- bool RunAutomocQt4();
+ bool RunAutomoc();
bool GenerateMoc(const std::string& sourceFile,
const std::string& mocFileName);
void ParseCppFile(const std::string& absFilename,
- std::map<std::string, std::string>& includedMocs,
- std::set<std::string>& absHeaders);
+ const std::list<std::string>& headerExtensions,
+ std::map<std::string, std::string>& includedMocs);
+ void StrictParseCppFile(const std::string& absFilename,
+ const std::list<std::string>& headerExtensions,
+ std::map<std::string, std::string>& includedMocs);
+ void SearchHeadersForCppFile(const std::string& absFilename,
+ const std::list<std::string>& headerExtensions,
+ std::set<std::string>& absHeaders);
+
void ParseHeaders(const std::set<std::string>& absHeaders,
const std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::string>& notIncludedMocs);
@@ -78,6 +85,7 @@ private:
bool ColorOutput;
bool RunMocFailed;
bool GenerateAll;
+ bool StrictMode;
};
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index e8decbb..ea299ca 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -161,6 +161,11 @@ extern int putenv (char *__string) __THROW;
#define for if(false) {} else for
#endif
+// Provide std::ios_base on ancient GCC 2.9x
+#if defined(__GNUC__) && __GNUC__ < 3
+namespace std { typedef ios ios_base; }
+#endif
+
// check for the 720 compiler on the SGI
// which has some strange properties that I don't think are worth
// checking for in a general way in configure
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index d239c06..ec10d57 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -10,6 +10,8 @@
See the License for more information.
============================================================================*/
#include "cmStringCommand.h"
+#include "cmCryptoHash.h"
+
#include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx>
@@ -36,6 +38,15 @@ bool cmStringCommand
{
return this->HandleReplaceCommand(args);
}
+ else if ( subCommand == "MD5" ||
+ subCommand == "SHA1" ||
+ subCommand == "SHA224" ||
+ subCommand == "SHA256" ||
+ subCommand == "SHA384" ||
+ subCommand == "SHA512" )
+ {
+ return this->HandleHashCommand(args);
+ }
else if(subCommand == "TOLOWER")
{
return this->HandleToUpperLowerCommand(args, false);
@@ -83,6 +94,34 @@ bool cmStringCommand
}
//----------------------------------------------------------------------------
+bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
+{
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ if(args.size() != 3)
+ {
+ cmOStringStream e;
+ e << args[0] << " requires an output variable and an input string";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
+ if(hash.get())
+ {
+ std::string out = hash->HashString(args[2].c_str());
+ this->Makefile->AddDefinition(args[1].c_str(), out.c_str());
+ return true;
+ }
+ return false;
+#else
+ cmOStringStream e;
+ e << args[0] << " not available during bootstrap";
+ this->SetError(e.str().c_str());
+ return false;
+#endif
+}
+
+//----------------------------------------------------------------------------
bool cmStringCommand::HandleToUpperLowerCommand(
std::vector<std::string> const& args, bool toUpper)
{
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 52b83d9..452f4a1 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -76,6 +76,8 @@ public:
" string(REPLACE <match_string>\n"
" <replace_string> <output variable>\n"
" <input> [<input>...])\n"
+ " string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>\n"
+ " <output variable> <input>)\n"
" string(COMPARE EQUAL <string1> <string2> <output variable>)\n"
" string(COMPARE NOTEQUAL <string1> <string2> <output variable>)\n"
" string(COMPARE LESS <string1> <string2> <output variable>)\n"
@@ -103,6 +105,8 @@ public:
"backslash through argument parsing.\n"
"REPLACE will replace all occurrences of match_string in the input with "
"replace_string and store the result in the output.\n"
+ "MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 "
+ "will compute a cryptographic hash of the input string.\n"
"COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and "
"store true or false in the output variable.\n"
"ASCII will convert all numbers into corresponding ASCII characters.\n"
@@ -150,6 +154,7 @@ protected:
bool RegexMatch(std::vector<std::string> const& args);
bool RegexMatchAll(std::vector<std::string> const& args);
bool RegexReplace(std::vector<std::string> const& args);
+ bool HandleHashCommand(std::vector<std::string> const& args);
bool HandleToUpperLowerCommand(std::vector<std::string> const& args,
bool toUpper);
bool HandleCompareCommand(std::vector<std::string> const& args);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 03364bd..8eec1e2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -54,7 +54,7 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include <memory> // auto_ptr
# include <fcntl.h>
-# include <cmsys/MD5.h>
+# include "cmCryptoHash.h"
#endif
#if defined(CMAKE_USE_ELF_PARSER)
@@ -1197,48 +1197,10 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname)
bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
- if(!cmSystemTools::FileExists(source))
- {
- return false;
- }
-
- // Open files
-#if defined(_WIN32) || defined(__CYGWIN__)
- cmsys_ios::ifstream fin(source, cmsys_ios::ios::binary | cmsys_ios::ios::in);
-#else
- cmsys_ios::ifstream fin(source);
-#endif
- if(!fin)
- {
- return false;
- }
-
- cmsysMD5* md5 = cmsysMD5_New();
- cmsysMD5_Initialize(md5);
-
- // Should be efficient enough on most system:
- const int bufferSize = 4096;
- char buffer[bufferSize];
- unsigned char const* buffer_uc =
- reinterpret_cast<unsigned char const*>(buffer);
- // This copy loop is very sensitive on certain platforms with
- // slightly broken stream libraries (like HPUX). Normally, it is
- // incorrect to not check the error condition on the fin.read()
- // before using the data, but the fin.gcount() will be zero if an
- // error occurred. Therefore, the loop should be safe everywhere.
- while(fin)
- {
- fin.read(buffer, bufferSize);
- if(int gcount = static_cast<int>(fin.gcount()))
- {
- cmsysMD5_Append(md5, buffer_uc, gcount);
- }
- }
- cmsysMD5_FinalizeHex(md5, md5out);
- cmsysMD5_Delete(md5);
-
- fin.close();
- return true;
+ cmCryptoHashMD5 md5;
+ std::string str = md5.HashFile(source);
+ strncpy(md5out, str.c_str(), 32);
+ return !str.empty();
#else
(void)source;
(void)md5out;
@@ -1250,13 +1212,8 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
std::string cmSystemTools::ComputeStringMD5(const char* input)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
- char md5out[32];
- cmsysMD5* md5 = cmsysMD5_New();
- cmsysMD5_Initialize(md5);
- cmsysMD5_Append(md5, reinterpret_cast<unsigned char const*>(input), -1);
- cmsysMD5_FinalizeHex(md5, md5out);
- cmsysMD5_Delete(md5);
- return std::string(md5out, 32);
+ cmCryptoHashMD5 md5;
+ return md5.HashString(input);
#else
(void)input;
cmSystemTools::Message("md5sum not supported in bootstrapping mode","Error");
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index dad0353..fc3c1c9 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -17,6 +17,7 @@
#include "cmGlobalGenerator.h"
#include "cmComputeLinkInformation.h"
#include "cmDocumentCompileDefinitions.h"
+#include "cmDocumentLocationUndefined.h"
#include "cmListFileCache.h"
#include "cmGeneratorExpression.h"
#include <cmsys/RegularExpression.hxx>
@@ -131,6 +132,7 @@ cmTarget::cmTarget()
this->LinkLibrariesAnalyzed = false;
this->HaveInstallRule = false;
this->DLLPlatform = false;
+ this->IsApple = false;
this->IsImportedTarget = false;
}
@@ -159,8 +161,10 @@ void cmTarget::DefineProperties(cmake *cm)
"This property is initialized by the value of the variable "
"CMAKE_AUTOMOC if it is set when a target is created.\n"
"Additional command line options for moc can be set via the "
- "AUTOMOC_MOC_OPTIONS property."
- );
+ "AUTOMOC_MOC_OPTIONS property.\n"
+ "By setting the CMAKE_AUTOMOC_STRICT_MODE variable to FALSE the rules "
+ "for searching the files which will be processed by moc can be relaxed. "
+ "See the documentation for this variable for more details.");
cm->DefineProperty
("AUTOMOC_MOC_OPTIONS", cmProperty::TARGET,
@@ -584,15 +588,6 @@ void cmTarget::DefineProperties(cmake *cm)
"value is the default. "
"See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables.");
-#define CM_LOCATION_UNDEFINED_BEHAVIOR \
- "\n" \
- "Do not set properties that affect the location of the target after " \
- "reading this property. These include properties whose names match " \
- "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_<CONFIG>)?\" " \
- "or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \
- "Failure to follow this rule is not diagnosed and leaves the location " \
- "of the target undefined."
-
cm->DefineProperty
("LOCATION", cmProperty::TARGET,
"Read-only location of a target on disk.",
@@ -612,7 +607,7 @@ void cmTarget::DefineProperties(cmake *cm)
"In CMake 2.8.4 and above add_custom_command recognizes generator "
"expressions to refer to target locations anywhere in the command. "
"Therefore this property is not needed for creating custom commands."
- CM_LOCATION_UNDEFINED_BEHAVIOR);
+ CM_LOCATION_UNDEFINED_BEHAVIOR("reading this property"));
cm->DefineProperty
("LOCATION_<CONFIG>", cmProperty::TARGET,
@@ -626,7 +621,7 @@ void cmTarget::DefineProperties(cmake *cm)
"arbitrary available configuration. "
"Use the MAP_IMPORTED_CONFIG_<CONFIG> property to map imported "
"configurations explicitly."
- CM_LOCATION_UNDEFINED_BEHAVIOR);
+ CM_LOCATION_UNDEFINED_BEHAVIOR("reading this property"));
cm->DefineProperty
("LINK_DEPENDS", cmProperty::TARGET,
@@ -980,6 +975,23 @@ void cmTarget::DefineProperties(cmake *cm)
"is created its value is used to initialize this property.");
cm->DefineProperty
+ ("GNUtoMS", cmProperty::TARGET,
+ "Convert GNU import library (.dll.a) to MS format (.lib).",
+ "When linking a shared library or executable that exports symbols "
+ "using GNU tools on Windows (MinGW/MSYS) with Visual Studio installed "
+ "convert the import library (.dll.a) from GNU to MS format (.lib). "
+ "Both import libraries will be installed by install(TARGETS) and "
+ "exported by install(EXPORT) and export() to be linked by applications "
+ "with either GNU- or MS-compatible tools."
+ "\n"
+ "If the variable CMAKE_GNUtoMS is set when a target "
+ "is created its value is used to initialize this property. "
+ "The variable must be set prior to the first command that enables "
+ "a language such as project() or enable_language(). "
+ "CMake provides the variable as an option to the user automatically "
+ "when configuring on Windows with GNU tools.");
+
+ cm->DefineProperty
("XCODE_ATTRIBUTE_<an-attribute>", cmProperty::TARGET,
"Set Xcode target attributes directly.",
"Tell the Xcode generator to set '<an-attribute>' to a given value "
@@ -1038,6 +1050,29 @@ void cmTarget::DefineProperties(cmake *cm)
"Can be set to change the visual studio source code control "
"auxpath property.");
cm->DefineProperty
+ ("VS_GLOBAL_PROJECT_TYPES", cmProperty::TARGET,
+ "Visual Studio project type(s).",
+ "Can be set to one or more UUIDs recognized by Visual Studio "
+ "to indicate the type of project. This value is copied "
+ "verbatim into the generated project file. Example for a "
+ "managed C++ unit testing project: \""
+ "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
+ "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are "
+ "semicolon-delimited.");
+ cm->DefineProperty
+ ("VS_GLOBAL_KEYWORD", cmProperty::TARGET,
+ "Visual Studio project keyword.",
+ "Sets the \"keyword\" attribute for a generated Visual Studio "
+ "project. Defaults to \"Win32Proj\". You may wish to override "
+ "this value with \"ManagedCProj\", for example, in a Visual "
+ "Studio managed C++ unit test project.");
+ cm->DefineProperty
+ ("VS_DOTNET_REFERENCES", cmProperty::TARGET,
+ "Visual Studio managed project .NET references",
+ "Adds one or more semicolon-delimited .NET references to a "
+ "generated Visual Studio project. For example, \"System;"
+ "System.Windows.Forms\".");
+ cm->DefineProperty
("VS_GLOBAL_<variable>", cmProperty::TARGET,
"Visual Studio project-specific global variable.",
"Tell the Visual Studio generator to set the global variable "
@@ -1184,6 +1219,9 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->Makefile->IsOn("CYGWIN") ||
this->Makefile->IsOn("MINGW"));
+ // Check whether we are targeting an Apple platform.
+ this->IsApple = this->Makefile->IsOn("APPLE");
+
// Setup default property values.
this->SetPropertyDefault("INSTALL_NAME_DIR", "");
this->SetPropertyDefault("INSTALL_RPATH", "");
@@ -1195,6 +1233,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
this->SetPropertyDefault("Fortran_FORMAT", 0);
this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
+ this->SetPropertyDefault("GNUtoMS", 0);
this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
this->SetPropertyDefault("AUTOMOC", 0);
this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
@@ -3325,7 +3364,11 @@ void cmTarget::GetLibraryNames(std::string& name,
// the library version as the soversion.
soversion = version;
}
- bool isApple = this->Makefile->IsOn("APPLE");
+ if(!version && soversion)
+ {
+ // Use the soversion as the library version.
+ version = soversion;
+ }
// Get the components of the library name.
std::string prefix;
@@ -3337,47 +3380,12 @@ void cmTarget::GetLibraryNames(std::string& name,
name = prefix+base+suffix;
// The library's soname.
- if(isApple)
- {
- soName = prefix+base;
- }
- else
- {
- soName = name;
- }
- if(soversion)
- {
- soName += ".";
- soName += soversion;
- }
- if(isApple)
- {
- soName += suffix;
- }
+ this->ComputeVersionedName(soName, prefix, base, suffix,
+ name, soversion);
// The library's real name on disk.
- if(isApple)
- {
- realName = prefix+base;
- }
- else
- {
- realName = name;
- }
- if(version)
- {
- realName += ".";
- realName += version;
- }
- else if(soversion)
- {
- realName += ".";
- realName += soversion;
- }
- if(isApple)
- {
- realName += suffix;
- }
+ this->ComputeVersionedName(realName, prefix, base, suffix,
+ name, version);
// The import library name.
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -3395,6 +3403,23 @@ void cmTarget::GetLibraryNames(std::string& name,
}
//----------------------------------------------------------------------------
+void cmTarget::ComputeVersionedName(std::string& vName,
+ std::string const& prefix,
+ std::string const& base,
+ std::string const& suffix,
+ std::string const& name,
+ const char* version)
+{
+ vName = this->IsApple? (prefix+base) : name;
+ if(version)
+ {
+ vName += ".";
+ vName += version;
+ }
+ vName += this->IsApple? suffix : std::string();
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GetExecutableNames(std::string& name,
std::string& realName,
std::string& impName,
@@ -3457,6 +3482,26 @@ void cmTarget::GetExecutableNames(std::string& name,
}
//----------------------------------------------------------------------------
+bool cmTarget::HasImplibGNUtoMS()
+{
+ return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS");
+}
+
+//----------------------------------------------------------------------------
+bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName,
+ std::string& out, const char* newExt)
+{
+ if(this->HasImplibGNUtoMS() &&
+ gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a")
+ {
+ out = gnuName.substr(0, gnuName.size()-6);
+ out += newExt? newExt : ".lib";
+ return true;
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GenerateTargetManifest(const char* config)
{
cmMakefile* mf = this->Makefile;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0abdddb..59f0184 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -369,6 +369,14 @@ public:
std::string& impName,
std::string& pdbName, const char* config);
+ /** Does this target have a GNU implib to convert to MS format? */
+ bool HasImplibGNUtoMS();
+
+ /** Convert the given GNU import library name (.dll.a) to a name with a new
+ extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
+ bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
+ const char* newExt = 0);
+
/** Add the target output files to the global generator manifest. */
void GenerateTargetManifest(const char* config);
@@ -557,6 +565,7 @@ private:
cmPropertyMap Properties;
LinkLibraryVectorType OriginalLinkLibraries;
bool DLLPlatform;
+ bool IsApple;
bool IsImportedTarget;
// Cache target output paths for each configuration.
@@ -595,6 +604,12 @@ private:
cmTargetInternalPointer Internal;
void ConstructSourceFileFlags();
+ void ComputeVersionedName(std::string& vName,
+ std::string const& prefix,
+ std::string const& base,
+ std::string const& suffix,
+ std::string const& name,
+ const char* version);
};
typedef std::map<cmStdString,cmTarget> cmTargets;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 805959d..36c4ca8 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -95,8 +95,8 @@ bool cmTargetLinkLibrariesCommand
bool haveLLT = false;
// Start with primary linking and switch to link interface
- // specification when the keyword is encountered.
- this->DoingInterface = false;
+ // specification if the keyword is encountered as the first argument.
+ this->CurrentProcessingState = ProcessingLinkLibraries;
// add libraries, nothe that there is an optional prefix
// of debug and optimized than can be used
@@ -104,7 +104,7 @@ bool cmTargetLinkLibrariesCommand
{
if(args[i] == "LINK_INTERFACE_LIBRARIES")
{
- this->DoingInterface = true;
+ this->CurrentProcessingState = ProcessingLinkInterface;
if(i != 1)
{
this->Makefile->IssueMessage(
@@ -115,6 +115,32 @@ bool cmTargetLinkLibrariesCommand
return true;
}
}
+ else if(args[i] == "LINK_PUBLIC")
+ {
+ if(i != 1 && this->CurrentProcessingState != ProcessingPrivateInterface)
+ {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
+ "argument, just after the target name."
+ );
+ return true;
+ }
+ this->CurrentProcessingState = ProcessingPublicInterface;
+ }
+ else if(args[i] == "LINK_PRIVATE")
+ {
+ if(i != 1 && this->CurrentProcessingState != ProcessingPublicInterface)
+ {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
+ "argument, just after the target name."
+ );
+ return true;
+ }
+ this->CurrentProcessingState = ProcessingPrivateInterface;
+ }
else if(args[i] == "debug")
{
if(haveLLT)
@@ -186,10 +212,12 @@ bool cmTargetLinkLibrariesCommand
cmSystemTools::SetFatalErrorOccured();
}
- // If the INTERFACE option was given, make sure the
- // LINK_INTERFACE_LIBRARIES property exists. This allows the
- // command to be used to specify an empty link interface.
- if(this->DoingInterface &&
+ // If any of the LINK_ options were given, make sure the
+ // LINK_INTERFACE_LIBRARIES target property exists.
+ // Use of any of the new keywords implies awareness of
+ // this property. And if no libraries are named, it should
+ // result in an empty link interface.
+ if(this->CurrentProcessingState != ProcessingLinkLibraries &&
!this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
{
this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
@@ -217,11 +245,15 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{
// Handle normal case first.
- if(!this->DoingInterface)
+ if(this->CurrentProcessingState != ProcessingLinkInterface)
{
this->Makefile
->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
- return;
+ if (this->CurrentProcessingState != ProcessingPublicInterface)
+ {
+ // Not LINK_INTERFACE_LIBRARIES or LINK_PUBLIC, do not add to interface.
+ return;
+ }
}
// Get the list of configurations considered to be DEBUG.
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index ce57df7..8df4ac0 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -19,7 +19,7 @@
*
* cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
* into executable(s) or shared objects. The names of the libraries
- * should be those defined by the LIBRARY(library) command(s).
+ * should be those defined by the LIBRARY(library) command(s).
*/
class cmTargetLinkLibrariesCommand : public cmCommand
{
@@ -27,7 +27,7 @@ public:
/**
* This is a virtual constructor for the command.
*/
- virtual cmCommand* Clone()
+ virtual cmCommand* Clone()
{
return new cmTargetLinkLibrariesCommand;
}
@@ -47,12 +47,12 @@ public:
/**
* Succinct documentation.
*/
- virtual const char* GetTerseDocumentation()
+ virtual const char* GetTerseDocumentation()
{
- return
+ return
"Link a target to given libraries.";
}
-
+
/**
* More documentation.
*/
@@ -107,6 +107,18 @@ public:
"Libraries specified as \"general\" (or without any keyword) are "
"treated as if specified for both \"debug\" and \"optimized\"."
"\n"
+ " target_link_libraries(<target>\n"
+ " <LINK_PRIVATE|LINK_PUBLIC>\n"
+ " [[debug|optimized|general] <lib>] ...\n"
+ " [<LINK_PRIVATE|LINK_PUBLIC>\n"
+ " [[debug|optimized|general] <lib>] ...])\n"
+ "The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both "
+ "the link dependencies and the link interface in one command. "
+ "Libraries and targets following LINK_PUBLIC are linked to, and are "
+ "made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets "
+ "following LINK_PRIVATE are linked to, but are not made part of the "
+ "LINK_INTERFACE_LIBRARIES. "
+ "\n"
"The library dependency graph is normally acyclic (a DAG), but in the "
"case of mutually-dependent STATIC libraries CMake allows the graph "
"to contain cycles (strongly connected components). "
@@ -130,14 +142,21 @@ public:
")"
;
}
-
+
cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
cmTarget* Target;
- bool DoingInterface;
+ enum ProcessingState {
+ ProcessingLinkLibraries,
+ ProcessingLinkInterface,
+ ProcessingPublicInterface,
+ ProcessingPrivateInterface
+ };
+
+ ProcessingState CurrentProcessingState;
void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
};
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 2c9ef37..a219ae9 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,6 +178,15 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ProjectGUID>", 2);
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
+ const char* vsProjectTypes =
+ this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES");
+ if(vsProjectTypes)
+ {
+ this->WriteString("<ProjectTypes>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectTypes) <<
+ "</ProjectTypes>\n";
+ }
+
const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
@@ -203,7 +212,19 @@ void cmVisualStudio10TargetGenerator::Generate()
}
}
- this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
+ const char* vsGlobalKeyword =
+ this->Target->GetProperty("VS_GLOBAL_KEYWORD");
+ if(!vsGlobalKeyword)
+ {
+ this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<Keyword>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword) <<
+ "</Keyword>\n";
+ }
+
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
@@ -233,6 +254,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteCustomCommands();
this->WriteObjSources();
this->WriteCLSources();
+ this->WriteDotNetReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -244,6 +266,39 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteGroups();
}
+void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
+{
+ const char* vsDotNetReferences
+ = this->Target->GetProperty("VS_DOTNET_REFERENCES");
+ if(vsDotNetReferences)
+ {
+ std::string references(vsDotNetReferences);
+ std::string::size_type position = 0;
+
+ this->WriteString("<ItemGroup>\n", 1);
+ while(references.length() > 0)
+ {
+ if((position = references.find(";")) == std::string::npos)
+ {
+ position = references.length() + 1;
+ }
+
+ this->WriteString("<Reference Include=\"", 2);
+ (*this->BuildFileStream) <<
+ cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
+ this->WriteString("<CopyLocalSatelliteAssemblies>true"
+ "</CopyLocalSatelliteAssemblies>\n", 3);
+ this->WriteString("<ReferenceOutputAssembly>true"
+ "</ReferenceOutputAssembly>\n", 3);
+ this->WriteString("</Reference>\n", 2);
+
+ references.erase(0, position + 1);
+ }
+
+ this->WriteString("</ItemGroup>\n", 1);
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
@@ -298,16 +353,24 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
}
configType += "</ConfigurationType>\n";
this->WriteString(configType.c_str(), 2);
+
const char* mfcFlag =
this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
- if(mfcFlag)
+ std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
+
+ std::string useOfMfcValue = "false";
+ if(mfcFlagValue == "1")
{
- this->WriteString("<UseOfMfc>true</UseOfMfc>\n", 2);
+ useOfMfcValue = "Static";
}
- else
+ else if(mfcFlagValue == "2")
{
- this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
+ useOfMfcValue = "Dynamic";
}
+ std::string mfcLine = "<UseOfMfc>";
+ mfcLine += useOfMfcValue + "</UseOfMfc>\n";
+ this->WriteString(mfcLine.c_str(), 2);
+
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
this->ClOptions[*i]->UsingUnicode())
{
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index c3c27f4..6702509 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -47,6 +47,7 @@ private:
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteCLSources();
+ void WriteDotNetReferences();
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c
new file mode 100644
index 0000000..12c39ed
--- /dev/null
+++ b/Source/cm_sha2.c
@@ -0,0 +1,1613 @@
+/*
+ * FILE: sha2.c
+ * AUTHOR: Aaron D. Gifford
+ * http://www.aarongifford.com/computers/sha.html
+ *
+ * Copyright (c) 2000-2003, Aaron D. Gifford
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: sha2.c,v 1.4 2004/01/07 22:58:18 adg Exp $
+ */
+
+#include <string.h> /* memcpy()/memset() or bcopy()/bzero() */
+#include <assert.h> /* assert() */
+#include "cm_sha2.h" /* "sha2.h" -> "cm_sha2.h" renamed for CMake */
+
+/*
+ * ASSERT NOTE:
+ * Some sanity checking code is included using assert(). On my FreeBSD
+ * system, this additional code can be removed by compiling with NDEBUG
+ * defined. Check your own systems manpage on assert() to see how to
+ * compile WITHOUT the sanity checking code on your system.
+ *
+ * UNROLLED TRANSFORM LOOP NOTE:
+ * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform
+ * loop version for the hash transform rounds (defined using macros
+ * later in this file). Either define on the command line, for example:
+ *
+ * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c
+ *
+ * or define below:
+ *
+ * #define SHA2_UNROLL_TRANSFORM
+ *
+ */
+
+
+/*** SHA-224/256/384/512 Machine Architecture Definitions *************/
+/*
+ * BYTE_ORDER NOTE:
+ *
+ * Please make sure that your system defines BYTE_ORDER. If your
+ * architecture is little-endian, make sure it also defines
+ * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are
+ * equivilent.
+ *
+ * If your system does not define the above, then you can do so by
+ * hand like this:
+ *
+ * #define LITTLE_ENDIAN 1234
+ * #define BIG_ENDIAN 4321
+ *
+ * And for little-endian machines, add:
+ *
+ * #define BYTE_ORDER LITTLE_ENDIAN
+ *
+ * Or for big-endian machines:
+ *
+ * #define BYTE_ORDER BIG_ENDIAN
+ *
+ * The FreeBSD machine this was written on defines BYTE_ORDER
+ * appropriately by including <sys/types.h> (which in turn includes
+ * <machine/endian.h> where the appropriate definitions are actually
+ * made).
+ */
+#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
+/* CMake modification: use byte order from cmIML. */
+# include "cmIML/ABI.h"
+# undef BYTE_ORDER
+# undef BIG_ENDIAN
+# undef LITTLE_ENDIAN
+# define BYTE_ORDER cmIML_ABI_ENDIAN_ID
+# define BIG_ENDIAN cmIML_ABI_ENDIAN_ID_BIG
+# define LITTLE_ENDIAN cmIML_ABI_ENDIAN_ID_LITTLE
+#endif
+
+/* CMake modification: use types computed in header. */
+typedef cm_sha2_uint8_t sha_byte; /* Exactly 1 byte */
+typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */
+typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */
+#define SHA_UINT32_C(x) cmIML_INT_UINT32_C(x)
+#define SHA_UINT64_C(x) cmIML_INT_UINT64_C(x)
+#if defined(__BORLANDC__)
+# pragma warn -8004 /* variable assigned value that is never used */
+#endif
+#if defined(__clang__)
+# pragma clang diagnostic ignored "-Wcast-align"
+#endif
+
+/*** ENDIAN REVERSAL MACROS *******************************************/
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define REVERSE32(w,x) { \
+ sha_word32 tmp = (w); \
+ tmp = (tmp >> 16) | (tmp << 16); \
+ (x) = ((tmp & SHA_UINT32_C(0xff00ff00)) >> 8) | \
+ ((tmp & SHA_UINT32_C(0x00ff00ff)) << 8); \
+}
+#define REVERSE64(w,x) { \
+ sha_word64 tmp = (w); \
+ tmp = (tmp >> 32) | (tmp << 32); \
+ tmp = ((tmp & SHA_UINT64_C(0xff00ff00ff00ff00)) >> 8) | \
+ ((tmp & SHA_UINT64_C(0x00ff00ff00ff00ff)) << 8); \
+ (x) = ((tmp & SHA_UINT64_C(0xffff0000ffff0000)) >> 16) | \
+ ((tmp & SHA_UINT64_C(0x0000ffff0000ffff)) << 16); \
+}
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+/*
+ * Macro for incrementally adding the unsigned 64-bit integer n to the
+ * unsigned 128-bit integer (represented using a two-element array of
+ * 64-bit words):
+ */
+#define ADDINC128(w,n) { \
+ (w)[0] += (sha_word64)(n); \
+ if ((w)[0] < (n)) { \
+ (w)[1]++; \
+ } \
+}
+
+/*
+ * Macros for copying blocks of memory and for zeroing out ranges
+ * of memory. Using these macros makes it easy to switch from
+ * using memset()/memcpy() and using bzero()/bcopy().
+ *
+ * Please define either SHA2_USE_MEMSET_MEMCPY or define
+ * SHA2_USE_BZERO_BCOPY depending on which function set you
+ * choose to use:
+ */
+#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY)
+/* Default to memset()/memcpy() if no option is specified */
+#define SHA2_USE_MEMSET_MEMCPY 1
+#endif
+#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY)
+/* Abort with an error if BOTH options are defined */
+#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both!
+#endif
+
+#ifdef SHA2_USE_MEMSET_MEMCPY
+#define MEMSET_BZERO(p,l) memset((p), 0, (l))
+#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l))
+#endif
+#ifdef SHA2_USE_BZERO_BCOPY
+#define MEMSET_BZERO(p,l) bzero((p), (l))
+#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l))
+#endif
+
+
+/*** THE SIX LOGICAL FUNCTIONS ****************************************/
+/*
+ * Bit shifting and rotation (used by the six SHA-XYZ logical functions:
+ *
+ * NOTE: In the original SHA-256/384/512 document, the shift-right
+ * function was named R and the rotate-right function was called S.
+ * (See: http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf on the
+ * web.)
+ *
+ * The newer NIST FIPS 180-2 document uses a much clearer naming
+ * scheme, SHR for shift-right, ROTR for rotate-right, and ROTL for
+ * rotate-left. (See:
+ * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
+ * on the web.)
+ *
+ * WARNING: These macros must be used cautiously, since they reference
+ * supplied parameters sometimes more than once, and thus could have
+ * unexpected side-effects if used without taking this into account.
+ */
+/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */
+#define SHR(b,x) ((x) >> (b))
+/* 32-bit Rotate-right (used in SHA-256): */
+#define ROTR32(b,x) (((x) >> (b)) | ((x) << (32 - (b))))
+/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */
+#define ROTR64(b,x) (((x) >> (b)) | ((x) << (64 - (b))))
+/* 32-bit Rotate-left (used in SHA-1): */
+#define ROTL32(b,x) (((x) << (b)) | ((x) >> (32 - (b))))
+
+/* Two logical functions used in SHA-1, SHA-254, SHA-256, SHA-384, and SHA-512: */
+#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
+#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+
+/* Function used in SHA-1: */
+#define Parity(x,y,z) ((x) ^ (y) ^ (z))
+
+/* Four logical functions used in SHA-256: */
+#define Sigma0_256(x) (ROTR32(2, (x)) ^ ROTR32(13, (x)) ^ ROTR32(22, (x)))
+#define Sigma1_256(x) (ROTR32(6, (x)) ^ ROTR32(11, (x)) ^ ROTR32(25, (x)))
+#define sigma0_256(x) (ROTR32(7, (x)) ^ ROTR32(18, (x)) ^ SHR( 3 , (x)))
+#define sigma1_256(x) (ROTR32(17, (x)) ^ ROTR32(19, (x)) ^ SHR( 10, (x)))
+
+/* Four of six logical functions used in SHA-384 and SHA-512: */
+#define Sigma0_512(x) (ROTR64(28, (x)) ^ ROTR64(34, (x)) ^ ROTR64(39, (x)))
+#define Sigma1_512(x) (ROTR64(14, (x)) ^ ROTR64(18, (x)) ^ ROTR64(41, (x)))
+#define sigma0_512(x) (ROTR64( 1, (x)) ^ ROTR64( 8, (x)) ^ SHR( 7, (x)))
+#define sigma1_512(x) (ROTR64(19, (x)) ^ ROTR64(61, (x)) ^ SHR( 6, (x)))
+
+/*** INTERNAL FUNCTION PROTOTYPES *************************************/
+
+/* SHA-224 and SHA-256: */
+void SHA256_Internal_Init(SHA_CTX*, const sha_word32*);
+void SHA256_Internal_Last(SHA_CTX*);
+void SHA256_Internal_Transform(SHA_CTX*, const sha_word32*);
+
+/* SHA-384 and SHA-512: */
+void SHA512_Internal_Init(SHA_CTX*, const sha_word64*);
+void SHA512_Internal_Last(SHA_CTX*);
+void SHA512_Internal_Transform(SHA_CTX*, const sha_word64*);
+
+
+/*** SHA2 INITIAL HASH VALUES AND CONSTANTS ***************************/
+
+/* Hash constant words K for SHA-1: */
+#define K1_0_TO_19 SHA_UINT32_C(0x5a827999)
+#define K1_20_TO_39 SHA_UINT32_C(0x6ed9eba1)
+#define K1_40_TO_59 SHA_UINT32_C(0x8f1bbcdc)
+#define K1_60_TO_79 SHA_UINT32_C(0xca62c1d6)
+
+/* Initial hash value H for SHA-1: */
+static const sha_word32 sha1_initial_hash_value[5] = {
+ SHA_UINT32_C(0x67452301),
+ SHA_UINT32_C(0xefcdab89),
+ SHA_UINT32_C(0x98badcfe),
+ SHA_UINT32_C(0x10325476),
+ SHA_UINT32_C(0xc3d2e1f0)
+};
+
+/* Hash constant words K for SHA-224 and SHA-256: */
+static const sha_word32 K256[64] = {
+ SHA_UINT32_C(0x428a2f98), SHA_UINT32_C(0x71374491),
+ SHA_UINT32_C(0xb5c0fbcf), SHA_UINT32_C(0xe9b5dba5),
+ SHA_UINT32_C(0x3956c25b), SHA_UINT32_C(0x59f111f1),
+ SHA_UINT32_C(0x923f82a4), SHA_UINT32_C(0xab1c5ed5),
+ SHA_UINT32_C(0xd807aa98), SHA_UINT32_C(0x12835b01),
+ SHA_UINT32_C(0x243185be), SHA_UINT32_C(0x550c7dc3),
+ SHA_UINT32_C(0x72be5d74), SHA_UINT32_C(0x80deb1fe),
+ SHA_UINT32_C(0x9bdc06a7), SHA_UINT32_C(0xc19bf174),
+ SHA_UINT32_C(0xe49b69c1), SHA_UINT32_C(0xefbe4786),
+ SHA_UINT32_C(0x0fc19dc6), SHA_UINT32_C(0x240ca1cc),
+ SHA_UINT32_C(0x2de92c6f), SHA_UINT32_C(0x4a7484aa),
+ SHA_UINT32_C(0x5cb0a9dc), SHA_UINT32_C(0x76f988da),
+ SHA_UINT32_C(0x983e5152), SHA_UINT32_C(0xa831c66d),
+ SHA_UINT32_C(0xb00327c8), SHA_UINT32_C(0xbf597fc7),
+ SHA_UINT32_C(0xc6e00bf3), SHA_UINT32_C(0xd5a79147),
+ SHA_UINT32_C(0x06ca6351), SHA_UINT32_C(0x14292967),
+ SHA_UINT32_C(0x27b70a85), SHA_UINT32_C(0x2e1b2138),
+ SHA_UINT32_C(0x4d2c6dfc), SHA_UINT32_C(0x53380d13),
+ SHA_UINT32_C(0x650a7354), SHA_UINT32_C(0x766a0abb),
+ SHA_UINT32_C(0x81c2c92e), SHA_UINT32_C(0x92722c85),
+ SHA_UINT32_C(0xa2bfe8a1), SHA_UINT32_C(0xa81a664b),
+ SHA_UINT32_C(0xc24b8b70), SHA_UINT32_C(0xc76c51a3),
+ SHA_UINT32_C(0xd192e819), SHA_UINT32_C(0xd6990624),
+ SHA_UINT32_C(0xf40e3585), SHA_UINT32_C(0x106aa070),
+ SHA_UINT32_C(0x19a4c116), SHA_UINT32_C(0x1e376c08),
+ SHA_UINT32_C(0x2748774c), SHA_UINT32_C(0x34b0bcb5),
+ SHA_UINT32_C(0x391c0cb3), SHA_UINT32_C(0x4ed8aa4a),
+ SHA_UINT32_C(0x5b9cca4f), SHA_UINT32_C(0x682e6ff3),
+ SHA_UINT32_C(0x748f82ee), SHA_UINT32_C(0x78a5636f),
+ SHA_UINT32_C(0x84c87814), SHA_UINT32_C(0x8cc70208),
+ SHA_UINT32_C(0x90befffa), SHA_UINT32_C(0xa4506ceb),
+ SHA_UINT32_C(0xbef9a3f7), SHA_UINT32_C(0xc67178f2)
+};
+
+/* Initial hash value H for SHA-224: */
+static const sha_word32 sha224_initial_hash_value[8] = {
+ SHA_UINT32_C(0xc1059ed8),
+ SHA_UINT32_C(0x367cd507),
+ SHA_UINT32_C(0x3070dd17),
+ SHA_UINT32_C(0xf70e5939),
+ SHA_UINT32_C(0xffc00b31),
+ SHA_UINT32_C(0x68581511),
+ SHA_UINT32_C(0x64f98fa7),
+ SHA_UINT32_C(0xbefa4fa4)
+};
+
+/* Initial hash value H for SHA-256: */
+static const sha_word32 sha256_initial_hash_value[8] = {
+ SHA_UINT32_C(0x6a09e667),
+ SHA_UINT32_C(0xbb67ae85),
+ SHA_UINT32_C(0x3c6ef372),
+ SHA_UINT32_C(0xa54ff53a),
+ SHA_UINT32_C(0x510e527f),
+ SHA_UINT32_C(0x9b05688c),
+ SHA_UINT32_C(0x1f83d9ab),
+ SHA_UINT32_C(0x5be0cd19)
+};
+
+/* Hash constant words K for SHA-384 and SHA-512: */
+static const sha_word64 K512[80] = {
+ SHA_UINT64_C(0x428a2f98d728ae22), SHA_UINT64_C(0x7137449123ef65cd),
+ SHA_UINT64_C(0xb5c0fbcfec4d3b2f), SHA_UINT64_C(0xe9b5dba58189dbbc),
+ SHA_UINT64_C(0x3956c25bf348b538), SHA_UINT64_C(0x59f111f1b605d019),
+ SHA_UINT64_C(0x923f82a4af194f9b), SHA_UINT64_C(0xab1c5ed5da6d8118),
+ SHA_UINT64_C(0xd807aa98a3030242), SHA_UINT64_C(0x12835b0145706fbe),
+ SHA_UINT64_C(0x243185be4ee4b28c), SHA_UINT64_C(0x550c7dc3d5ffb4e2),
+ SHA_UINT64_C(0x72be5d74f27b896f), SHA_UINT64_C(0x80deb1fe3b1696b1),
+ SHA_UINT64_C(0x9bdc06a725c71235), SHA_UINT64_C(0xc19bf174cf692694),
+ SHA_UINT64_C(0xe49b69c19ef14ad2), SHA_UINT64_C(0xefbe4786384f25e3),
+ SHA_UINT64_C(0x0fc19dc68b8cd5b5), SHA_UINT64_C(0x240ca1cc77ac9c65),
+ SHA_UINT64_C(0x2de92c6f592b0275), SHA_UINT64_C(0x4a7484aa6ea6e483),
+ SHA_UINT64_C(0x5cb0a9dcbd41fbd4), SHA_UINT64_C(0x76f988da831153b5),
+ SHA_UINT64_C(0x983e5152ee66dfab), SHA_UINT64_C(0xa831c66d2db43210),
+ SHA_UINT64_C(0xb00327c898fb213f), SHA_UINT64_C(0xbf597fc7beef0ee4),
+ SHA_UINT64_C(0xc6e00bf33da88fc2), SHA_UINT64_C(0xd5a79147930aa725),
+ SHA_UINT64_C(0x06ca6351e003826f), SHA_UINT64_C(0x142929670a0e6e70),
+ SHA_UINT64_C(0x27b70a8546d22ffc), SHA_UINT64_C(0x2e1b21385c26c926),
+ SHA_UINT64_C(0x4d2c6dfc5ac42aed), SHA_UINT64_C(0x53380d139d95b3df),
+ SHA_UINT64_C(0x650a73548baf63de), SHA_UINT64_C(0x766a0abb3c77b2a8),
+ SHA_UINT64_C(0x81c2c92e47edaee6), SHA_UINT64_C(0x92722c851482353b),
+ SHA_UINT64_C(0xa2bfe8a14cf10364), SHA_UINT64_C(0xa81a664bbc423001),
+ SHA_UINT64_C(0xc24b8b70d0f89791), SHA_UINT64_C(0xc76c51a30654be30),
+ SHA_UINT64_C(0xd192e819d6ef5218), SHA_UINT64_C(0xd69906245565a910),
+ SHA_UINT64_C(0xf40e35855771202a), SHA_UINT64_C(0x106aa07032bbd1b8),
+ SHA_UINT64_C(0x19a4c116b8d2d0c8), SHA_UINT64_C(0x1e376c085141ab53),
+ SHA_UINT64_C(0x2748774cdf8eeb99), SHA_UINT64_C(0x34b0bcb5e19b48a8),
+ SHA_UINT64_C(0x391c0cb3c5c95a63), SHA_UINT64_C(0x4ed8aa4ae3418acb),
+ SHA_UINT64_C(0x5b9cca4f7763e373), SHA_UINT64_C(0x682e6ff3d6b2b8a3),
+ SHA_UINT64_C(0x748f82ee5defb2fc), SHA_UINT64_C(0x78a5636f43172f60),
+ SHA_UINT64_C(0x84c87814a1f0ab72), SHA_UINT64_C(0x8cc702081a6439ec),
+ SHA_UINT64_C(0x90befffa23631e28), SHA_UINT64_C(0xa4506cebde82bde9),
+ SHA_UINT64_C(0xbef9a3f7b2c67915), SHA_UINT64_C(0xc67178f2e372532b),
+ SHA_UINT64_C(0xca273eceea26619c), SHA_UINT64_C(0xd186b8c721c0c207),
+ SHA_UINT64_C(0xeada7dd6cde0eb1e), SHA_UINT64_C(0xf57d4f7fee6ed178),
+ SHA_UINT64_C(0x06f067aa72176fba), SHA_UINT64_C(0x0a637dc5a2c898a6),
+ SHA_UINT64_C(0x113f9804bef90dae), SHA_UINT64_C(0x1b710b35131c471b),
+ SHA_UINT64_C(0x28db77f523047d84), SHA_UINT64_C(0x32caab7b40c72493),
+ SHA_UINT64_C(0x3c9ebe0a15c9bebc), SHA_UINT64_C(0x431d67c49c100d4c),
+ SHA_UINT64_C(0x4cc5d4becb3e42b6), SHA_UINT64_C(0x597f299cfc657e2a),
+ SHA_UINT64_C(0x5fcb6fab3ad6faec), SHA_UINT64_C(0x6c44198c4a475817)
+};
+
+/* Initial hash value H for SHA-384 */
+static const sha_word64 sha384_initial_hash_value[8] = {
+ SHA_UINT64_C(0xcbbb9d5dc1059ed8),
+ SHA_UINT64_C(0x629a292a367cd507),
+ SHA_UINT64_C(0x9159015a3070dd17),
+ SHA_UINT64_C(0x152fecd8f70e5939),
+ SHA_UINT64_C(0x67332667ffc00b31),
+ SHA_UINT64_C(0x8eb44a8768581511),
+ SHA_UINT64_C(0xdb0c2e0d64f98fa7),
+ SHA_UINT64_C(0x47b5481dbefa4fa4)
+};
+
+/* Initial hash value H for SHA-512 */
+static const sha_word64 sha512_initial_hash_value[8] = {
+ SHA_UINT64_C(0x6a09e667f3bcc908),
+ SHA_UINT64_C(0xbb67ae8584caa73b),
+ SHA_UINT64_C(0x3c6ef372fe94f82b),
+ SHA_UINT64_C(0xa54ff53a5f1d36f1),
+ SHA_UINT64_C(0x510e527fade682d1),
+ SHA_UINT64_C(0x9b05688c2b3e6c1f),
+ SHA_UINT64_C(0x1f83d9abfb41bd6b),
+ SHA_UINT64_C(0x5be0cd19137e2179)
+};
+
+/*
+ * Constant used by SHA224/256/384/512_End() functions for converting the
+ * digest to a readable hexadecimal character string:
+ */
+static const char *sha_hex_digits = "0123456789abcdef";
+
+
+/*** SHA-1: ***********************************************************/
+void SHA1_Init(SHA_CTX* context) {
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ MEMCPY_BCOPY(context->s1.state, sha1_initial_hash_value, sizeof(sha_word32) * 5);
+ MEMSET_BZERO(context->s1.buffer, 64);
+ context->s1.bitcount = 0;
+}
+
+#ifdef SHA2_UNROLL_TRANSFORM
+
+/* Unrolled SHA-1 round macros: */
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+#define ROUND1_0_TO_15(a,b,c,d,e) \
+ REVERSE32(*data++, W1[j]); \
+ (e) = ROTL32(5, (a)) + Ch((b), (c), (d)) + (e) + \
+ K1_0_TO_19 + W1[j]; \
+ (b) = ROTL32(30, (b)); \
+ j++;
+
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#define ROUND1_0_TO_15(a,b,c,d,e) \
+ (e) = ROTL32(5, (a)) + Ch((b), (c), (d)) + (e) + \
+ K1_0_TO_19 + ( W1[j] = *data++ ); \
+ (b) = ROTL32(30, (b)); \
+ j++;
+
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#define ROUND1_16_TO_19(a,b,c,d,e) \
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \
+ (e) = ROTL32(5, a) + Ch(b,c,d) + e + K1_0_TO_19 + ( W1[j&0x0f] = ROTL32(1, T1) ); \
+ (b) = ROTL32(30, b); \
+ j++;
+
+#define ROUND1_20_TO_39(a,b,c,d,e) \
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \
+ (e) = ROTL32(5, a) + Parity(b,c,d) + e + K1_20_TO_39 + ( W1[j&0x0f] = ROTL32(1, T1) ); \
+ (b) = ROTL32(30, b); \
+ j++;
+
+#define ROUND1_40_TO_59(a,b,c,d,e) \
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \
+ (e) = ROTL32(5, a) + Maj(b,c,d) + e + K1_40_TO_59 + ( W1[j&0x0f] = ROTL32(1, T1) ); \
+ (b) = ROTL32(30, b); \
+ j++;
+
+#define ROUND1_60_TO_79(a,b,c,d,e) \
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f]; \
+ (e) = ROTL32(5, a) + Parity(b,c,d) + e + K1_60_TO_79 + ( W1[j&0x0f] = ROTL32(1, T1) ); \
+ (b) = ROTL32(30, b); \
+ j++;
+
+void SHA1_Internal_Transform(SHA_CTX* context, const sha_word32* data) {
+ sha_word32 a, b, c, d, e;
+ sha_word32 T1, *W1;
+ int j;
+
+ W1 = (sha_word32*)context->s1.buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->s1.state[0];
+ b = context->s1.state[1];
+ c = context->s1.state[2];
+ d = context->s1.state[3];
+ e = context->s1.state[4];
+
+ j = 0;
+
+ /* Rounds 0 to 15 unrolled: */
+ ROUND1_0_TO_15(a,b,c,d,e);
+ ROUND1_0_TO_15(e,a,b,c,d);
+ ROUND1_0_TO_15(d,e,a,b,c);
+ ROUND1_0_TO_15(c,d,e,a,b);
+ ROUND1_0_TO_15(b,c,d,e,a);
+ ROUND1_0_TO_15(a,b,c,d,e);
+ ROUND1_0_TO_15(e,a,b,c,d);
+ ROUND1_0_TO_15(d,e,a,b,c);
+ ROUND1_0_TO_15(c,d,e,a,b);
+ ROUND1_0_TO_15(b,c,d,e,a);
+ ROUND1_0_TO_15(a,b,c,d,e);
+ ROUND1_0_TO_15(e,a,b,c,d);
+ ROUND1_0_TO_15(d,e,a,b,c);
+ ROUND1_0_TO_15(c,d,e,a,b);
+ ROUND1_0_TO_15(b,c,d,e,a);
+ ROUND1_0_TO_15(a,b,c,d,e);
+
+ /* Rounds 16 to 19 unrolled: */
+ ROUND1_16_TO_19(e,a,b,c,d);
+ ROUND1_16_TO_19(d,e,a,b,c);
+ ROUND1_16_TO_19(c,d,e,a,b);
+ ROUND1_16_TO_19(b,c,d,e,a);
+
+ /* Rounds 20 to 39 unrolled: */
+ ROUND1_20_TO_39(a,b,c,d,e);
+ ROUND1_20_TO_39(e,a,b,c,d);
+ ROUND1_20_TO_39(d,e,a,b,c);
+ ROUND1_20_TO_39(c,d,e,a,b);
+ ROUND1_20_TO_39(b,c,d,e,a);
+ ROUND1_20_TO_39(a,b,c,d,e);
+ ROUND1_20_TO_39(e,a,b,c,d);
+ ROUND1_20_TO_39(d,e,a,b,c);
+ ROUND1_20_TO_39(c,d,e,a,b);
+ ROUND1_20_TO_39(b,c,d,e,a);
+ ROUND1_20_TO_39(a,b,c,d,e);
+ ROUND1_20_TO_39(e,a,b,c,d);
+ ROUND1_20_TO_39(d,e,a,b,c);
+ ROUND1_20_TO_39(c,d,e,a,b);
+ ROUND1_20_TO_39(b,c,d,e,a);
+ ROUND1_20_TO_39(a,b,c,d,e);
+ ROUND1_20_TO_39(e,a,b,c,d);
+ ROUND1_20_TO_39(d,e,a,b,c);
+ ROUND1_20_TO_39(c,d,e,a,b);
+ ROUND1_20_TO_39(b,c,d,e,a);
+
+ /* Rounds 40 to 59 unrolled: */
+ ROUND1_40_TO_59(a,b,c,d,e);
+ ROUND1_40_TO_59(e,a,b,c,d);
+ ROUND1_40_TO_59(d,e,a,b,c);
+ ROUND1_40_TO_59(c,d,e,a,b);
+ ROUND1_40_TO_59(b,c,d,e,a);
+ ROUND1_40_TO_59(a,b,c,d,e);
+ ROUND1_40_TO_59(e,a,b,c,d);
+ ROUND1_40_TO_59(d,e,a,b,c);
+ ROUND1_40_TO_59(c,d,e,a,b);
+ ROUND1_40_TO_59(b,c,d,e,a);
+ ROUND1_40_TO_59(a,b,c,d,e);
+ ROUND1_40_TO_59(e,a,b,c,d);
+ ROUND1_40_TO_59(d,e,a,b,c);
+ ROUND1_40_TO_59(c,d,e,a,b);
+ ROUND1_40_TO_59(b,c,d,e,a);
+ ROUND1_40_TO_59(a,b,c,d,e);
+ ROUND1_40_TO_59(e,a,b,c,d);
+ ROUND1_40_TO_59(d,e,a,b,c);
+ ROUND1_40_TO_59(c,d,e,a,b);
+ ROUND1_40_TO_59(b,c,d,e,a);
+
+ /* Rounds 60 to 79 unrolled: */
+ ROUND1_60_TO_79(a,b,c,d,e);
+ ROUND1_60_TO_79(e,a,b,c,d);
+ ROUND1_60_TO_79(d,e,a,b,c);
+ ROUND1_60_TO_79(c,d,e,a,b);
+ ROUND1_60_TO_79(b,c,d,e,a);
+ ROUND1_60_TO_79(a,b,c,d,e);
+ ROUND1_60_TO_79(e,a,b,c,d);
+ ROUND1_60_TO_79(d,e,a,b,c);
+ ROUND1_60_TO_79(c,d,e,a,b);
+ ROUND1_60_TO_79(b,c,d,e,a);
+ ROUND1_60_TO_79(a,b,c,d,e);
+ ROUND1_60_TO_79(e,a,b,c,d);
+ ROUND1_60_TO_79(d,e,a,b,c);
+ ROUND1_60_TO_79(c,d,e,a,b);
+ ROUND1_60_TO_79(b,c,d,e,a);
+ ROUND1_60_TO_79(a,b,c,d,e);
+ ROUND1_60_TO_79(e,a,b,c,d);
+ ROUND1_60_TO_79(d,e,a,b,c);
+ ROUND1_60_TO_79(c,d,e,a,b);
+ ROUND1_60_TO_79(b,c,d,e,a);
+
+ /* Compute the current intermediate hash value */
+ context->s1.state[0] += a;
+ context->s1.state[1] += b;
+ context->s1.state[2] += c;
+ context->s1.state[3] += d;
+ context->s1.state[4] += e;
+
+ /* Clean up */
+ a = b = c = d = e = T1 = 0;
+}
+
+#else /* SHA2_UNROLL_TRANSFORM */
+
+void SHA1_Internal_Transform(SHA_CTX* context, const sha_word32* data) {
+ sha_word32 a, b, c, d, e;
+ sha_word32 T1, *W1;
+ int j;
+
+ W1 = (sha_word32*)context->s1.buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->s1.state[0];
+ b = context->s1.state[1];
+ c = context->s1.state[2];
+ d = context->s1.state[3];
+ e = context->s1.state[4];
+ j = 0;
+ do {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ T1 = data[j];
+ /* Copy data while converting to host byte order */
+ REVERSE32(*data++, W1[j]);
+ T1 = ROTL32(5, a) + Ch(b, c, d) + e + K1_0_TO_19 + W1[j];
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+ T1 = ROTL32(5, a) + Ch(b, c, d) + e + K1_0_TO_19 + (W1[j] = *data++);
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+ e = d;
+ d = c;
+ c = ROTL32(30, b);
+ b = a;
+ a = T1;
+ j++;
+ } while (j < 16);
+
+ do {
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
+ T1 = ROTL32(5, a) + Ch(b,c,d) + e + K1_0_TO_19 + (W1[j&0x0f] = ROTL32(1, T1));
+ e = d;
+ d = c;
+ c = ROTL32(30, b);
+ b = a;
+ a = T1;
+ j++;
+ } while (j < 20);
+
+ do {
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
+ T1 = ROTL32(5, a) + Parity(b,c,d) + e + K1_20_TO_39 + (W1[j&0x0f] = ROTL32(1, T1));
+ e = d;
+ d = c;
+ c = ROTL32(30, b);
+ b = a;
+ a = T1;
+ j++;
+ } while (j < 40);
+
+ do {
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
+ T1 = ROTL32(5, a) + Maj(b,c,d) + e + K1_40_TO_59 + (W1[j&0x0f] = ROTL32(1, T1));
+ e = d;
+ d = c;
+ c = ROTL32(30, b);
+ b = a;
+ a = T1;
+ j++;
+ } while (j < 60);
+
+ do {
+ T1 = W1[(j+13)&0x0f] ^ W1[(j+8)&0x0f] ^ W1[(j+2)&0x0f] ^ W1[j&0x0f];
+ T1 = ROTL32(5, a) + Parity(b,c,d) + e + K1_60_TO_79 + (W1[j&0x0f] = ROTL32(1, T1));
+ e = d;
+ d = c;
+ c = ROTL32(30, b);
+ b = a;
+ a = T1;
+ j++;
+ } while (j < 80);
+
+
+ /* Compute the current intermediate hash value */
+ context->s1.state[0] += a;
+ context->s1.state[1] += b;
+ context->s1.state[2] += c;
+ context->s1.state[3] += d;
+ context->s1.state[4] += e;
+
+ /* Clean up */
+ a = b = c = d = e = T1 = 0;
+}
+
+#endif /* SHA2_UNROLL_TRANSFORM */
+
+void SHA1_Update(SHA_CTX* context, const sha_byte *data, size_t len) {
+ unsigned int freespace, usedspace;
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0 && data != (sha_byte*)0);
+
+ usedspace = (unsigned int)((context->s1.bitcount >> 3) % 64);
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = 64 - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->s1.buffer[usedspace], data, freespace);
+ context->s1.bitcount += freespace << 3;
+ len -= freespace;
+ data += freespace;
+ SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->s1.buffer[usedspace], data, len);
+ context->s1.bitcount += len << 3;
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= 64) {
+ /* Process as many complete blocks as we can */
+ SHA1_Internal_Transform(context, (sha_word32*)data);
+ context->s1.bitcount += 512;
+ len -= 64;
+ data += 64;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->s1.buffer, data, len);
+ context->s1.bitcount += len << 3;
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
+}
+
+void SHA1_Final(sha_byte digest[], SHA_CTX* context) {
+ sha_word32 *d = (sha_word32*)digest;
+ unsigned int usedspace;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ if (digest == (sha_byte*)0) {
+ /*
+ * No digest buffer, so we can do nothing
+ * except clean up and go home
+ */
+ MEMSET_BZERO(context, sizeof(*context));
+ return;
+ }
+
+ usedspace = (unsigned int)((context->s1.bitcount >> 3) % 64);
+ if (usedspace == 0) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(context->s1.buffer, 56);
+
+ /* Begin padding with a 1 bit: */
+ *context->s1.buffer = 0x80;
+ } else {
+ /* Begin padding with a 1 bit: */
+ context->s1.buffer[usedspace++] = 0x80;
+
+ if (usedspace <= 56) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->s1.buffer[usedspace], 56 - usedspace);
+ } else {
+ if (usedspace < 64) {
+ MEMSET_BZERO(&context->s1.buffer[usedspace], 64 - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->s1.buffer, 56);
+ }
+ /* Clean up: */
+ usedspace = 0;
+ }
+ /* Set the bit count: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ /* Convert FROM host byte order */
+ REVERSE64(context->s1.bitcount,context->s1.bitcount);
+#endif
+ *(sha_word64*)&context->s1.buffer[56] = context->s1.bitcount;
+
+ /* Final transform: */
+ SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer);
+
+ /* Save the hash data for output: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < (SHA1_DIGEST_LENGTH >> 2); j++) {
+ REVERSE32(context->s1.state[j],context->s1.state[j]);
+ *d++ = context->s1.state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->s1.state, SHA1_DIGEST_LENGTH);
+#endif
+
+ /* Clean up: */
+ MEMSET_BZERO(context, sizeof(*context));
+}
+
+char *SHA1_End(SHA_CTX* context, char buffer[]) {
+ sha_byte digest[SHA1_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA1_Final(digest, context);
+
+ for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
+ *buffer++ = sha_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(*context));
+ }
+ MEMSET_BZERO(digest, SHA1_DIGEST_LENGTH);
+ return buffer;
+}
+
+char* SHA1_Data(const sha_byte* data, size_t len, char digest[SHA1_DIGEST_STRING_LENGTH]) {
+ SHA_CTX context;
+
+ SHA1_Init(&context);
+ SHA1_Update(&context, data, len);
+ return SHA1_End(&context, digest);
+}
+
+
+/*** SHA-256: *********************************************************/
+void SHA256_Internal_Init(SHA_CTX* context, const sha_word32* ihv) {
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ MEMCPY_BCOPY(context->s256.state, ihv, sizeof(sha_word32) * 8);
+ MEMSET_BZERO(context->s256.buffer, 64);
+ context->s256.bitcount = 0;
+}
+
+void SHA256_Init(SHA_CTX* context) {
+ SHA256_Internal_Init(context, sha256_initial_hash_value);
+}
+
+#ifdef SHA2_UNROLL_TRANSFORM
+
+/* Unrolled SHA-256 round macros: */
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
+ REVERSE32(*data++, W256[j]); \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
+ K256[j] + W256[j]; \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
+
+
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
+ K256[j] + (W256[j] = *data++); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
+
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#define ROUND256(a,b,c,d,e,f,g,h) \
+ s0 = W256[(j+1)&0x0f]; \
+ s0 = sigma0_256(s0); \
+ s1 = W256[(j+14)&0x0f]; \
+ s1 = sigma1_256(s1); \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
+ (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
+
+void SHA256_Internal_Transform(SHA_CTX* context, const sha_word32* data) {
+ sha_word32 a, b, c, d, e, f, g, h, s0, s1;
+ sha_word32 T1, *W256;
+ int j;
+
+ W256 = (sha_word32*)context->s256.buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->s256.state[0];
+ b = context->s256.state[1];
+ c = context->s256.state[2];
+ d = context->s256.state[3];
+ e = context->s256.state[4];
+ f = context->s256.state[5];
+ g = context->s256.state[6];
+ h = context->s256.state[7];
+
+ j = 0;
+ do {
+ /* Rounds 0 to 15 (unrolled): */
+ ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
+ ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
+ ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
+ ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
+ ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
+ ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
+ ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
+ ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
+ } while (j < 16);
+
+ /* Now for the remaining rounds to 64: */
+ do {
+ ROUND256(a,b,c,d,e,f,g,h);
+ ROUND256(h,a,b,c,d,e,f,g);
+ ROUND256(g,h,a,b,c,d,e,f);
+ ROUND256(f,g,h,a,b,c,d,e);
+ ROUND256(e,f,g,h,a,b,c,d);
+ ROUND256(d,e,f,g,h,a,b,c);
+ ROUND256(c,d,e,f,g,h,a,b);
+ ROUND256(b,c,d,e,f,g,h,a);
+ } while (j < 64);
+
+ /* Compute the current intermediate hash value */
+ context->s256.state[0] += a;
+ context->s256.state[1] += b;
+ context->s256.state[2] += c;
+ context->s256.state[3] += d;
+ context->s256.state[4] += e;
+ context->s256.state[5] += f;
+ context->s256.state[6] += g;
+ context->s256.state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = 0;
+}
+
+#else /* SHA2_UNROLL_TRANSFORM */
+
+void SHA256_Internal_Transform(SHA_CTX* context, const sha_word32* data) {
+ sha_word32 a, b, c, d, e, f, g, h, s0, s1;
+ sha_word32 T1, T2, *W256;
+ int j;
+
+ W256 = (sha_word32*)context->s256.buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->s256.state[0];
+ b = context->s256.state[1];
+ c = context->s256.state[2];
+ d = context->s256.state[3];
+ e = context->s256.state[4];
+ f = context->s256.state[5];
+ g = context->s256.state[6];
+ h = context->s256.state[7];
+
+ j = 0;
+ do {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ /* Copy data while converting to host byte order */
+ REVERSE32(*data++,W256[j]);
+ /* Apply the SHA-256 compression function to update a..h */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+ /* Apply the SHA-256 compression function to update a..h with copy */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 16);
+
+ do {
+ /* Part of the message block expansion: */
+ s0 = W256[(j+1)&0x0f];
+ s0 = sigma0_256(s0);
+ s1 = W256[(j+14)&0x0f];
+ s1 = sigma1_256(s1);
+
+ /* Apply the SHA-256 compression function to update a..h */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
+ (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 64);
+
+ /* Compute the current intermediate hash value */
+ context->s256.state[0] += a;
+ context->s256.state[1] += b;
+ context->s256.state[2] += c;
+ context->s256.state[3] += d;
+ context->s256.state[4] += e;
+ context->s256.state[5] += f;
+ context->s256.state[6] += g;
+ context->s256.state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = T2 = 0;
+}
+
+#endif /* SHA2_UNROLL_TRANSFORM */
+
+void SHA256_Update(SHA_CTX* context, const sha_byte *data, size_t len) {
+ unsigned int freespace, usedspace;
+
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0 && data != (sha_byte*)0);
+
+ usedspace = (unsigned int)((context->s256.bitcount >> 3) % 64);
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = 64 - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->s256.buffer[usedspace], data, freespace);
+ context->s256.bitcount += freespace << 3;
+ len -= freespace;
+ data += freespace;
+ SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->s256.buffer[usedspace], data, len);
+ context->s256.bitcount += len << 3;
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= 64) {
+ /* Process as many complete blocks as we can */
+ SHA256_Internal_Transform(context, (sha_word32*)data);
+ context->s256.bitcount += 512;
+ len -= 64;
+ data += 64;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->s256.buffer, data, len);
+ context->s256.bitcount += len << 3;
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
+}
+
+void SHA256_Internal_Last(SHA_CTX* context) {
+ unsigned int usedspace;
+
+ usedspace = (unsigned int)((context->s256.bitcount >> 3) % 64);
+#if BYTE_ORDER == LITTLE_ENDIAN
+ /* Convert FROM host byte order */
+ REVERSE64(context->s256.bitcount,context->s256.bitcount);
+#endif
+ if (usedspace > 0) {
+ /* Begin padding with a 1 bit: */
+ context->s256.buffer[usedspace++] = 0x80;
+
+ if (usedspace <= 56) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->s256.buffer[usedspace], 56 - usedspace);
+ } else {
+ if (usedspace < 64) {
+ MEMSET_BZERO(&context->s256.buffer[usedspace], 64 - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->s256.buffer, 56);
+ }
+ /* Clean up: */
+ usedspace = 0;
+ } else {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(context->s256.buffer, 56);
+
+ /* Begin padding with a 1 bit: */
+ *context->s256.buffer = 0x80;
+ }
+ /* Set the bit count: */
+ *(sha_word64*)&context->s256.buffer[56] = context->s256.bitcount;
+
+ /* Final transform: */
+ SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer);
+}
+
+void SHA256_Final(sha_byte digest[], SHA_CTX* context) {
+ sha_word32 *d = (sha_word32*)digest;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha_byte*)0) {
+ SHA256_Internal_Last(context);
+
+ /* Save the hash data for output: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < (SHA256_DIGEST_LENGTH >> 2); j++) {
+ REVERSE32(context->s256.state[j],context->s256.state[j]);
+ *d++ = context->s256.state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->s256.state, SHA256_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Clean up state data: */
+ MEMSET_BZERO(context, sizeof(*context));
+}
+
+char *SHA256_End(SHA_CTX* context, char buffer[]) {
+ sha_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA256_Final(digest, context);
+
+ for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
+ *buffer++ = sha_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(*context));
+ }
+ MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
+ return buffer;
+}
+
+char* SHA256_Data(const sha_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) {
+ SHA_CTX context;
+
+ SHA256_Init(&context);
+ SHA256_Update(&context, data, len);
+ return SHA256_End(&context, digest);
+}
+
+
+/*** SHA-224: *********************************************************/
+void SHA224_Init(SHA_CTX* context) {
+ SHA256_Internal_Init(context, sha224_initial_hash_value);
+}
+
+void SHA224_Internal_Transform(SHA_CTX* context, const sha_word32* data) {
+ SHA256_Internal_Transform(context, data);
+}
+
+void SHA224_Update(SHA_CTX* context, const sha_byte *data, size_t len) {
+ SHA256_Update(context, data, len);
+}
+
+void SHA224_Final(sha_byte digest[], SHA_CTX* context) {
+ sha_word32 *d = (sha_word32*)digest;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha_byte*)0) {
+ SHA256_Internal_Last(context);
+
+ /* Save the hash data for output: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < (SHA224_DIGEST_LENGTH >> 2); j++) {
+ REVERSE32(context->s256.state[j],context->s256.state[j]);
+ *d++ = context->s256.state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->s256.state, SHA224_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Clean up state data: */
+ MEMSET_BZERO(context, sizeof(*context));
+}
+
+char *SHA224_End(SHA_CTX* context, char buffer[]) {
+ sha_byte digest[SHA224_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA224_Final(digest, context);
+
+ for (i = 0; i < SHA224_DIGEST_LENGTH; i++) {
+ *buffer++ = sha_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(*context));
+ }
+ MEMSET_BZERO(digest, SHA224_DIGEST_LENGTH);
+ return buffer;
+}
+
+char* SHA224_Data(const sha_byte* data, size_t len, char digest[SHA224_DIGEST_STRING_LENGTH]) {
+ SHA_CTX context;
+
+ SHA224_Init(&context);
+ SHA224_Update(&context, data, len);
+ return SHA224_End(&context, digest);
+}
+
+
+/*** SHA-512: *********************************************************/
+void SHA512_Internal_Init(SHA_CTX* context, const sha_word64* ihv) {
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ MEMCPY_BCOPY(context->s512.state, ihv, sizeof(sha_word64) * 8);
+ MEMSET_BZERO(context->s512.buffer, 128);
+ context->s512.bitcount[0] = context->s512.bitcount[1] = 0;
+}
+
+void SHA512_Init(SHA_CTX* context) {
+ SHA512_Internal_Init(context, sha512_initial_hash_value);
+}
+
+#ifdef SHA2_UNROLL_TRANSFORM
+
+/* Unrolled SHA-512 round macros: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
+ REVERSE64(*data++, W512[j]); \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
+ K512[j] + W512[j]; \
+ (d) += T1, \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
+ j++
+
+
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
+ K512[j] + (W512[j] = *data++); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
+ j++
+
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#define ROUND512(a,b,c,d,e,f,g,h) \
+ s0 = W512[(j+1)&0x0f]; \
+ s0 = sigma0_512(s0); \
+ s1 = W512[(j+14)&0x0f]; \
+ s1 = sigma1_512(s1); \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
+ (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
+ j++
+
+void SHA512_Internal_Transform(SHA_CTX* context, const sha_word64* data) {
+ sha_word64 a, b, c, d, e, f, g, h, s0, s1;
+ sha_word64 T1, *W512 = (sha_word64*)context->s512.buffer;
+ int j;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->s512.state[0];
+ b = context->s512.state[1];
+ c = context->s512.state[2];
+ d = context->s512.state[3];
+ e = context->s512.state[4];
+ f = context->s512.state[5];
+ g = context->s512.state[6];
+ h = context->s512.state[7];
+
+ j = 0;
+ do {
+ ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
+ ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
+ ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
+ ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
+ ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
+ ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
+ ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
+ ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
+ } while (j < 16);
+
+ /* Now for the remaining rounds up to 79: */
+ do {
+ ROUND512(a,b,c,d,e,f,g,h);
+ ROUND512(h,a,b,c,d,e,f,g);
+ ROUND512(g,h,a,b,c,d,e,f);
+ ROUND512(f,g,h,a,b,c,d,e);
+ ROUND512(e,f,g,h,a,b,c,d);
+ ROUND512(d,e,f,g,h,a,b,c);
+ ROUND512(c,d,e,f,g,h,a,b);
+ ROUND512(b,c,d,e,f,g,h,a);
+ } while (j < 80);
+
+ /* Compute the current intermediate hash value */
+ context->s512.state[0] += a;
+ context->s512.state[1] += b;
+ context->s512.state[2] += c;
+ context->s512.state[3] += d;
+ context->s512.state[4] += e;
+ context->s512.state[5] += f;
+ context->s512.state[6] += g;
+ context->s512.state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = 0;
+}
+
+#else /* SHA2_UNROLL_TRANSFORM */
+
+void SHA512_Internal_Transform(SHA_CTX* context, const sha_word64* data) {
+ sha_word64 a, b, c, d, e, f, g, h, s0, s1;
+ sha_word64 T1, T2, *W512 = (sha_word64*)context->s512.buffer;
+ int j;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->s512.state[0];
+ b = context->s512.state[1];
+ c = context->s512.state[2];
+ d = context->s512.state[3];
+ e = context->s512.state[4];
+ f = context->s512.state[5];
+ g = context->s512.state[6];
+ h = context->s512.state[7];
+
+ j = 0;
+ do {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ /* Convert TO host byte order */
+ REVERSE64(*data++, W512[j]);
+ /* Apply the SHA-512 compression function to update a..h */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+ /* Apply the SHA-512 compression function to update a..h with copy */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+ T2 = Sigma0_512(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 16);
+
+ do {
+ /* Part of the message block expansion: */
+ s0 = W512[(j+1)&0x0f];
+ s0 = sigma0_512(s0);
+ s1 = W512[(j+14)&0x0f];
+ s1 = sigma1_512(s1);
+
+ /* Apply the SHA-512 compression function to update a..h */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
+ (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
+ T2 = Sigma0_512(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 80);
+
+ /* Compute the current intermediate hash value */
+ context->s512.state[0] += a;
+ context->s512.state[1] += b;
+ context->s512.state[2] += c;
+ context->s512.state[3] += d;
+ context->s512.state[4] += e;
+ context->s512.state[5] += f;
+ context->s512.state[6] += g;
+ context->s512.state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = T2 = 0;
+}
+
+#endif /* SHA2_UNROLL_TRANSFORM */
+
+void SHA512_Update(SHA_CTX* context, const sha_byte *data, size_t len) {
+ unsigned int freespace, usedspace;
+
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0 && data != (sha_byte*)0);
+
+ usedspace = (unsigned int)((context->s512.bitcount[0] >> 3) % 128);
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = 128 - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->s512.buffer[usedspace], data, freespace);
+ ADDINC128(context->s512.bitcount, freespace << 3);
+ len -= freespace;
+ data += freespace;
+ SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->s512.buffer[usedspace], data, len);
+ ADDINC128(context->s512.bitcount, len << 3);
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= 128) {
+ /* Process as many complete blocks as we can */
+ SHA512_Internal_Transform(context, (sha_word64*)data);
+ ADDINC128(context->s512.bitcount, 1024);
+ len -= 128;
+ data += 128;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->s512.buffer, data, len);
+ ADDINC128(context->s512.bitcount, len << 3);
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
+}
+
+void SHA512_Internal_Last(SHA_CTX* context) {
+ unsigned int usedspace;
+
+ usedspace = (unsigned int)((context->s512.bitcount[0] >> 3) % 128);
+#if BYTE_ORDER == LITTLE_ENDIAN
+ /* Convert FROM host byte order */
+ REVERSE64(context->s512.bitcount[0],context->s512.bitcount[0]);
+ REVERSE64(context->s512.bitcount[1],context->s512.bitcount[1]);
+#endif
+ if (usedspace > 0) {
+ /* Begin padding with a 1 bit: */
+ context->s512.buffer[usedspace++] = 0x80;
+
+ if (usedspace <= 112) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->s512.buffer[usedspace], 112 - usedspace);
+ } else {
+ if (usedspace < 128) {
+ MEMSET_BZERO(&context->s512.buffer[usedspace], 128 - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->s512.buffer, 112);
+ }
+ /* Clean up: */
+ usedspace = 0;
+ } else {
+ /* Prepare for final transform: */
+ MEMSET_BZERO(context->s512.buffer, 112);
+
+ /* Begin padding with a 1 bit: */
+ *context->s512.buffer = 0x80;
+ }
+ /* Store the length of input data (in bits): */
+ *(sha_word64*)&context->s512.buffer[112] = context->s512.bitcount[1];
+ *(sha_word64*)&context->s512.buffer[120] = context->s512.bitcount[0];
+
+ /* Final transform: */
+ SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer);
+}
+
+void SHA512_Final(sha_byte digest[], SHA_CTX* context) {
+ sha_word64 *d = (sha_word64*)digest;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha_byte*)0) {
+ SHA512_Internal_Last(context);
+
+ /* Save the hash data for output: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < (SHA512_DIGEST_LENGTH >> 3); j++) {
+ REVERSE64(context->s512.state[j],context->s512.state[j]);
+ *d++ = context->s512.state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->s512.state, SHA512_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Zero out state data */
+ MEMSET_BZERO(context, sizeof(*context));
+}
+
+char *SHA512_End(SHA_CTX* context, char buffer[]) {
+ sha_byte digest[SHA512_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA512_Final(digest, context);
+
+ for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
+ *buffer++ = sha_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(*context));
+ }
+ MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
+ return buffer;
+}
+
+char* SHA512_Data(const sha_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) {
+ SHA_CTX context;
+
+ SHA512_Init(&context);
+ SHA512_Update(&context, data, len);
+ return SHA512_End(&context, digest);
+}
+
+
+/*** SHA-384: *********************************************************/
+void SHA384_Init(SHA_CTX* context) {
+ SHA512_Internal_Init(context, sha384_initial_hash_value);
+}
+
+void SHA384_Update(SHA_CTX* context, const sha_byte* data, size_t len) {
+ SHA512_Update(context, data, len);
+}
+
+void SHA384_Final(sha_byte digest[], SHA_CTX* context) {
+ sha_word64 *d = (sha_word64*)digest;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha_byte*)0) {
+ SHA512_Internal_Last(context);
+
+ /* Save the hash data for output: */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < (SHA384_DIGEST_LENGTH >> 3); j++) {
+ REVERSE64(context->s512.state[j],context->s512.state[j]);
+ *d++ = context->s512.state[j];
+ }
+ }
+#else
+ MEMCPY_BCOPY(d, context->s512.state, SHA384_DIGEST_LENGTH);
+#endif
+ }
+
+ /* Zero out state data */
+ MEMSET_BZERO(context, sizeof(*context));
+}
+
+char *SHA384_End(SHA_CTX* context, char buffer[]) {
+ sha_byte digest[SHA384_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA384_Final(digest, context);
+
+ for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
+ *buffer++ = sha_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(*context));
+ }
+ MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
+ return buffer;
+}
+
+char* SHA384_Data(const sha_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) {
+ SHA_CTX context;
+
+ SHA384_Init(&context);
+ SHA384_Update(&context, data, len);
+ return SHA384_End(&context, digest);
+}
diff --git a/Source/cm_sha2.h b/Source/cm_sha2.h
new file mode 100644
index 0000000..71395f0
--- /dev/null
+++ b/Source/cm_sha2.h
@@ -0,0 +1,140 @@
+/*
+ * FILE: sha2.h
+ * AUTHOR: Aaron D. Gifford
+ * http://www.aarongifford.com/computers/sha.html
+ *
+ * Copyright (c) 2000-2003, Aaron D. Gifford
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: sha2.h,v 1.4 2004/01/07 19:06:18 adg Exp $
+ */
+
+#ifndef __SHA2_H__
+#define __SHA2_H__
+
+#include "cm_sha2_mangle.h"
+
+/* CMake modification: use integer types from cmIML. */
+#include "cmIML/INT.h"
+typedef cmIML_INT_uint8_t cm_sha2_uint8_t;
+typedef cmIML_INT_uint32_t cm_sha2_uint32_t;
+typedef cmIML_INT_uint64_t cm_sha2_uint64_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Import u_intXX_t size_t type definitions from system headers. You
+ * may need to change this, or define these things yourself in this
+ * file.
+ */
+#include <sys/types.h>
+
+/*** SHA-224/256/384/512 Various Length Definitions *******************/
+
+/* Digest lengths for SHA-1/224/256/384/512 */
+#define SHA1_DIGEST_LENGTH 20
+#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
+#define SHA224_DIGEST_LENGTH 28
+#define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1)
+#define SHA256_DIGEST_LENGTH 32
+#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
+#define SHA384_DIGEST_LENGTH 48
+#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
+#define SHA512_DIGEST_LENGTH 64
+#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
+
+
+/*** SHA-224/256/384/512 Context Structures ***************************/
+
+typedef union _SHA_CTX {
+ /* SHA-1 uses this part of the union: */
+ struct {
+ cm_sha2_uint32_t state[5];
+ cm_sha2_uint64_t bitcount;
+ cm_sha2_uint8_t buffer[64];
+ } s1;
+
+ /* SHA-224 and SHA-256 use this part of the union: */
+ struct {
+ cm_sha2_uint32_t state[8];
+ cm_sha2_uint64_t bitcount;
+ cm_sha2_uint8_t buffer[64];
+ } s256;
+
+ /* SHA-384 and SHA-512 use this part of the union: */
+ struct {
+ cm_sha2_uint64_t state[8];
+ cm_sha2_uint64_t bitcount[2];
+ cm_sha2_uint8_t buffer[128];
+ } s512;
+} SHA_CTX;
+
+/*** SHA-256/384/512 Function Prototypes ******************************/
+
+void SHA1_Init(SHA_CTX*);
+void SHA1_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
+void SHA1_Final(cm_sha2_uint8_t[SHA1_DIGEST_LENGTH], SHA_CTX*);
+char* SHA1_End(SHA_CTX*, char[SHA1_DIGEST_STRING_LENGTH]);
+char* SHA1_Data(const cm_sha2_uint8_t*, size_t,
+ char[SHA1_DIGEST_STRING_LENGTH]);
+
+void SHA224_Init(SHA_CTX*);
+void SHA224_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
+void SHA224_Final(cm_sha2_uint8_t[SHA224_DIGEST_LENGTH], SHA_CTX*);
+char* SHA224_End(SHA_CTX*, char[SHA224_DIGEST_STRING_LENGTH]);
+char* SHA224_Data(const cm_sha2_uint8_t*, size_t,
+ char[SHA224_DIGEST_STRING_LENGTH]);
+
+void SHA256_Init(SHA_CTX*);
+void SHA256_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
+void SHA256_Final(cm_sha2_uint8_t[SHA256_DIGEST_LENGTH], SHA_CTX*);
+char* SHA256_End(SHA_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
+char* SHA256_Data(const cm_sha2_uint8_t*, size_t,
+ char[SHA256_DIGEST_STRING_LENGTH]);
+
+void SHA384_Init(SHA_CTX*);
+void SHA384_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
+void SHA384_Final(cm_sha2_uint8_t[SHA384_DIGEST_LENGTH], SHA_CTX*);
+char* SHA384_End(SHA_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
+char* SHA384_Data(const cm_sha2_uint8_t*, size_t,
+ char[SHA384_DIGEST_STRING_LENGTH]);
+
+void SHA512_Init(SHA_CTX*);
+void SHA512_Update(SHA_CTX*, const cm_sha2_uint8_t*, size_t);
+void SHA512_Final(cm_sha2_uint8_t[SHA512_DIGEST_LENGTH], SHA_CTX*);
+char* SHA512_End(SHA_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
+char* SHA512_Data(const cm_sha2_uint8_t*, size_t,
+ char[SHA512_DIGEST_STRING_LENGTH]);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __SHA2_H__ */
diff --git a/Source/cm_sha2_mangle.h b/Source/cm_sha2_mangle.h
new file mode 100644
index 0000000..e73d131
--- /dev/null
+++ b/Source/cm_sha2_mangle.h
@@ -0,0 +1,51 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cm_sha2_mangle_h
+#define cm_sha2_mangle_h
+
+/* Mangle sha2 symbol names to avoid possible conflict with
+ implementations in other libraries to which CMake links. */
+#define SHA1_Data cmSHA1_Data
+#define SHA1_End cmSHA1_End
+#define SHA1_Final cmSHA1_Final
+#define SHA1_Init cmSHA1_Init
+#define SHA1_Internal_Transform cmSHA1_Internal_Transform
+#define SHA1_Update cmSHA1_Update
+#define SHA224_Data cmSHA224_Data
+#define SHA224_End cmSHA224_End
+#define SHA224_Final cmSHA224_Final
+#define SHA224_Init cmSHA224_Init
+#define SHA224_Internal_Transform cmSHA224_Internal_Transform
+#define SHA224_Update cmSHA224_Update
+#define SHA256_Data cmSHA256_Data
+#define SHA256_End cmSHA256_End
+#define SHA256_Final cmSHA256_Final
+#define SHA256_Init cmSHA256_Init
+#define SHA256_Internal_Init cmSHA256_Internal_Init
+#define SHA256_Internal_Last cmSHA256_Internal_Last
+#define SHA256_Internal_Transform cmSHA256_Internal_Transform
+#define SHA256_Update cmSHA256_Update
+#define SHA384_Data cmSHA384_Data
+#define SHA384_End cmSHA384_End
+#define SHA384_Final cmSHA384_Final
+#define SHA384_Init cmSHA384_Init
+#define SHA384_Update cmSHA384_Update
+#define SHA512_Data cmSHA512_Data
+#define SHA512_End cmSHA512_End
+#define SHA512_Final cmSHA512_Final
+#define SHA512_Init cmSHA512_Init
+#define SHA512_Internal_Init cmSHA512_Internal_Init
+#define SHA512_Internal_Last cmSHA512_Internal_Last
+#define SHA512_Internal_Transform cmSHA512_Internal_Transform
+#define SHA512_Update cmSHA512_Update
+
+#endif
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 1bf19c0..4d83293 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -128,7 +128,7 @@ public:
#include <io.h>
#include <direct.h>
#define _unlink unlink
-#endif
+#endif
/* The maximum length of a file name. */
#if defined(PATH_MAX)
@@ -168,9 +168,9 @@ static inline char *realpath(const char *path, char *resolved_path)
snprintf(resolved_path, maxlen, "%s", path);
BPath normalized(resolved_path, NULL, true);
const char *resolved = normalized.Path();
- if (resolved != NULL) // NULL == No such file.
+ if (resolved != NULL) // NULL == No such file.
{
- if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
+ if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
{
return resolved_path;
}
@@ -179,7 +179,7 @@ static inline char *realpath(const char *path, char *resolved_path)
}
#endif
-#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
+#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
inline int Mkdir(const char* dir)
{
return _mkdir(dir);
@@ -300,7 +300,7 @@ double SystemTools::GetTime(void)
#endif
}
-class SystemToolsTranslationMap :
+class SystemToolsTranslationMap :
public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
{
};
@@ -326,7 +326,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
kwsys_stl::string pathEnv = cpathEnv;
// A hack to make the below algorithm work.
- if(pathEnv[pathEnv.length()-1] != ':')
+ if(!pathEnv.empty() && pathEnv[pathEnv.length()-1] != pathSep[0])
{
pathEnv += pathSep;
}
@@ -371,7 +371,7 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
}
}
-#ifdef INTEL_COMPILER
+#ifdef __INTEL_COMPILER
#pragma warning disable 444
#endif
@@ -392,7 +392,7 @@ kwsysDeletingCharVector::~kwsysDeletingCharVector()
#endif
}
bool SystemTools::PutEnv(const char* value)
-{
+{
static kwsysDeletingCharVector localEnvironment;
char* envVar = new char[strlen(value)+1];
strcpy(envVar, value);
@@ -403,18 +403,13 @@ bool SystemTools::PutEnv(const char* value)
return ret == 0;
}
-#ifdef INTEL_COMPILER
-#pragma warning restore 444
-#endif
-
-
const char* SystemTools::GetExecutableExtension()
{
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
return ".exe";
#else
return "";
-#endif
+#endif
}
@@ -482,7 +477,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
{
const char *src = source.c_str();
char *searchPos = const_cast<char *>(strstr(src,replace));
-
+
// get out quick if string is not found
if (!searchPos)
{
@@ -499,7 +494,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
char *orig = strdup(src);
char *currentPos = orig;
searchPos = searchPos - src + orig;
-
+
// initialize the result
source.erase(source.begin(),source.end());
do
@@ -551,7 +546,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
#endif
// Read a registry value.
-// Example :
+// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will return the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -580,7 +575,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
-
+
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -602,11 +597,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
{
primaryKey = HKEY_USERS;
}
-
+
HKEY hKey;
- if(RegOpenKeyEx(primaryKey,
- second.c_str(),
- 0,
+ if(RegOpenKeyEx(primaryKey,
+ second.c_str(),
+ 0,
SystemToolsMakeRegistryMode(KEY_READ, view),
&hKey) != ERROR_SUCCESS)
{
@@ -617,11 +612,11 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
DWORD dwType, dwSize;
dwSize = 1023;
char data[1024];
- if(RegQueryValueEx(hKey,
- (LPTSTR)valuename.c_str(),
- NULL,
- &dwType,
- (BYTE *)data,
+ if(RegQueryValueEx(hKey,
+ (LPTSTR)valuename.c_str(),
+ NULL,
+ &dwType,
+ (BYTE *)data,
&dwSize) == ERROR_SUCCESS)
{
if (dwType == REG_SZ)
@@ -656,7 +651,7 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &,
// Write a registry value.
-// Example :
+// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will set the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -669,7 +664,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
kwsys_stl::string primary = key;
kwsys_stl::string second;
kwsys_stl::string valuename;
-
+
size_t start = primary.find("\\");
if (start == kwsys_stl::string::npos)
{
@@ -684,7 +679,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
-
+
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -706,13 +701,13 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
{
primaryKey = HKEY_USERS;
}
-
+
HKEY hKey;
DWORD dwDummy;
char lpClass[] = "";
- if(RegCreateKeyEx(primaryKey,
- second.c_str(),
- 0,
+ if(RegCreateKeyEx(primaryKey,
+ second.c_str(),
+ 0,
lpClass,
REG_OPTION_NON_VOLATILE,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
@@ -723,11 +718,11 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value,
return false;
}
- if(RegSetValueEx(hKey,
- (LPTSTR)valuename.c_str(),
- 0,
- REG_SZ,
- (CONST BYTE *)value,
+ if(RegSetValueEx(hKey,
+ (LPTSTR)valuename.c_str(),
+ 0,
+ REG_SZ,
+ (CONST BYTE *)value,
(DWORD)(strlen(value) + 1)) == ERROR_SUCCESS)
{
return true;
@@ -742,7 +737,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64)
#endif
// Delete a registry value.
-// Example :
+// Example :
// HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
// => will delete the data of the "default" value of the key
// HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
@@ -754,7 +749,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
kwsys_stl::string primary = key;
kwsys_stl::string second;
kwsys_stl::string valuename;
-
+
size_t start = primary.find("\\");
if (start == kwsys_stl::string::npos)
{
@@ -769,7 +764,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
second = primary.substr(start+1, valuenamepos-start-1);
primary = primary.substr(0, start);
-
+
HKEY primaryKey = HKEY_CURRENT_USER;
if (primary == "HKEY_CURRENT_USER")
{
@@ -791,11 +786,11 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
{
primaryKey = HKEY_USERS;
}
-
+
HKEY hKey;
- if(RegOpenKeyEx(primaryKey,
- second.c_str(),
- 0,
+ if(RegOpenKeyEx(primaryKey,
+ second.c_str(),
+ 0,
SystemToolsMakeRegistryMode(KEY_WRITE, view),
&hKey) != ERROR_SUCCESS)
{
@@ -803,7 +798,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
}
else
{
- if(RegDeleteValue(hKey,
+ if(RegDeleteValue(hKey,
(LPTSTR)valuename.c_str()) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@@ -824,17 +819,17 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
#ifdef _WIN32
HANDLE hFile1, hFile2;
- hFile1 = CreateFile( file1,
- GENERIC_READ,
+ hFile1 = CreateFile( file1,
+ GENERIC_READ,
FILE_SHARE_READ ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL
);
- hFile2 = CreateFile( file2,
- GENERIC_READ,
- FILE_SHARE_READ,
+ hFile2 = CreateFile( file2,
+ GENERIC_READ,
+ FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
@@ -868,10 +863,10 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
{
// see if the files are the same file
// check the device inode and size
- if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
+ if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
memcmp(&fileStat2.st_ino, &fileStat1.st_ino, sizeof(fileStat1.st_ino)) == 0 &&
- fileStat2.st_size == fileStat1.st_size
- )
+ fileStat2.st_size == fileStat1.st_size
+ )
{
return true;
}
@@ -1068,11 +1063,11 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s)
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
// MS has an assert that will fail if s[i] < 0; setting
// LC_CTYPE using setlocale() does *not* help. Painful.
- if ((int)s[i] >= 0 && isalpha(s[i]) &&
+ if ((int)s[i] >= 0 && isalpha(s[i]) &&
(i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
#else
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
-#endif
+#endif
{
n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
}
@@ -1089,11 +1084,11 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
// MS has an assert that will fail if s[i] < 0; setting
// LC_CTYPE using setlocale() does *not* help. Painful.
- if ((int)s[i] >= 0 && isalpha(s[i]) &&
+ if ((int)s[i] >= 0 && isalpha(s[i]) &&
(i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
#else
if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
-#endif
+#endif
{
n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
}
@@ -1171,7 +1166,7 @@ char* SystemTools::AppendStrings(
return newstr;
}
-// Return a lower case string
+// Return a lower case string
kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
{
kwsys_stl::string n;
@@ -1183,7 +1178,7 @@ kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
return n;
}
-// Return a lower case string
+// Return a lower case string
kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s)
{
kwsys_stl::string n;
@@ -1313,7 +1308,7 @@ const char* SystemTools::FindLastString(const char* str1, const char* str2)
{
return NULL;
}
-
+
size_t len1 = strlen(str1), len2 = strlen(str2);
if (len1 >= len2)
{
@@ -1341,8 +1336,8 @@ char* SystemTools::DuplicateString(const char* str)
return NULL;
}
-// Return a cropped string
-kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
+// Return a cropped string
+kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
size_t max_len)
{
if (!s.size() || max_len == 0 || max_len >= s.size())
@@ -1386,7 +1381,7 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
if(isPath && path[0] == '/')
{
path.erase(path.begin());
- paths.push_back("/");
+ paths.push_back("/");
}
kwsys_stl::string::size_type pos1 = 0;
kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1);
@@ -1395,9 +1390,9 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
paths.push_back(path.substr(pos1, pos2-pos1));
pos1 = pos2+1;
pos2 = path.find(sep, pos1+1);
- }
+ }
paths.push_back(path.substr(pos1, pos2-pos1));
-
+
return paths;
}
@@ -1411,11 +1406,11 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
// Quick-hack attempt at estimating the length of the string.
// Should never under-estimate.
-
+
// Start with the length of the format string itself.
size_t length = strlen(format);
-
+
// Increase the length for every argument in the format.
const char* cur = format;
@@ -1447,7 +1442,7 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
{
// Assume the argument contributes no more than 64 characters.
length += 64;
-
+
// Eat the argument.
static_cast<void>(va_arg(ap, double));
} break;
@@ -1455,24 +1450,24 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap)
{
// Assume the argument contributes no more than 64 characters.
length += 64;
-
+
// Eat the argument.
static_cast<void>(va_arg(ap, int));
} break;
}
}
-
+
// Move past the characters just tested.
++cur;
}
}
-
+
return static_cast<int>(length);
}
kwsys_stl::string SystemTools::EscapeChars(
- const char *str,
- const char *chars_to_escape,
+ const char *str,
+ const char *chars_to_escape,
char escape_char)
{
kwsys_stl::string n;
@@ -1529,7 +1524,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path)
}
#endif
-// convert windows slashes to unix slashes
+// convert windows slashes to unix slashes
void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
{
const char* pathCString = path.c_str();
@@ -1596,7 +1591,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
}
}
#endif
- // remove trailing slash if the path is more than
+ // remove trailing slash if the path is more than
// a single /
pathCString = path.c_str();
if(path.size() > 1 && *(pathCString+(path.size()-1)) == '/')
@@ -1614,7 +1609,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
{
kwsys_stl::string ret = path;
-
+
// remove // except at the beginning might be a cygwin drive
kwsys_stl::string::size_type pos=1;
while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
@@ -1652,7 +1647,7 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path)
// remove double slashes not at the start
kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
-{
+{
kwsys_stl::string ret;
// make it big enough for all of path and double quotes
ret.reserve(strlen(path)+3);
@@ -1738,13 +1733,13 @@ bool SystemTools::FilesDiffer(const char* source,
const char* destination)
{
struct stat statSource;
- if (stat(source, &statSource) != 0)
+ if (stat(source, &statSource) != 0)
{
return true;
}
struct stat statDestination;
- if (stat(destination, &statDestination) != 0)
+ if (stat(destination, &statDestination) != 0)
{
return true;
}
@@ -1790,7 +1785,7 @@ bool SystemTools::FilesDiffer(const char* source,
{
return true;
}
-
+
// If this block differs the file differs.
if(memcmp(static_cast<const void*>(source_buf),
static_cast<const void*>(dest_buf),
@@ -1849,7 +1844,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
// Open files
#if defined(_WIN32) || defined(__CYGWIN__)
- kwsys_ios::ifstream fin(source,
+ kwsys_ios::ifstream fin(source,
kwsys_ios::ios::binary | kwsys_ios::ios::in);
#else
kwsys_ios::ifstream fin(source);
@@ -1858,7 +1853,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
{
return false;
}
-
+
// try and remove the destination file so that read only destination files
// can be written to.
// If the remove fails continue so that files in read only directories
@@ -1866,17 +1861,17 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
SystemTools::RemoveFile(destination);
#if defined(_WIN32) || defined(__CYGWIN__)
- kwsys_ios::ofstream fout(destination,
+ kwsys_ios::ofstream fout(destination,
kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#else
- kwsys_ios::ofstream fout(destination,
+ kwsys_ios::ofstream fout(destination,
kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#endif
if(!fout)
{
return false;
}
-
+
// This copy loop is very sensitive on certain platforms with
// slightly broken stream libraries (like HPUX). Normally, it is
// incorrect to not check the error condition on the fin.read()
@@ -1890,12 +1885,12 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
fout.write(buffer, fin.gcount());
}
}
-
+
// Make sure the operating system has finished writing the file
// before closing it. This will ensure the file is finished before
// the check below.
fout.flush();
-
+
fin.close();
fout.close();
@@ -1979,7 +1974,7 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination,
unsigned long SystemTools::FileLength(const char* filename)
{
struct stat fs;
- if (stat(filename, &fs) != 0)
+ if (stat(filename, &fs) != 0)
{
return 0;
}
@@ -2225,7 +2220,7 @@ kwsys_stl::string SystemTools
{
// Add the system search path to our path first
kwsys_stl::vector<kwsys_stl::string> path;
- if (!no_system_path)
+ if (!no_system_path)
{
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
SystemTools::GetPath(path);
@@ -2340,7 +2335,7 @@ kwsys_stl::string SystemTools::FindProgram(
// first try with extensions if the os supports them
if(extensions.size())
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
+ for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
extensions.begin(); i != extensions.end(); ++i)
{
tryPath = name;
@@ -2368,7 +2363,7 @@ kwsys_stl::string SystemTools::FindProgram(
}
// now add the additional paths
{
- for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
+ for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
userPaths.begin(); i != userPaths.end(); ++i)
{
path.push_back(*i);
@@ -2397,7 +2392,7 @@ kwsys_stl::string SystemTools::FindProgram(
// first try with extensions
if(extensions.size())
{
- for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
+ for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
= extensions.begin(); ext != extensions.end(); ++ext)
{
tryPath = *p;
@@ -2962,7 +2957,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
}
// split up both paths into arrays of strings using / as a separator
- kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
+ kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here
@@ -3019,7 +3014,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
}
}
kwsys_stl::string relativePath; // result string
- // now turn the array of directories into a unix path by puttint /
+ // now turn the array of directories into a unix path by puttint /
// between each entry that does not already have one
for(kwsys_stl::vector<String>::iterator vit1 = finalPath.begin();
vit1 != finalPath.end(); ++vit1)
@@ -3396,7 +3391,7 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename
{
kwsys_stl::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
-
+
kwsys_stl::string::size_type slash_pos = fn.rfind("/");
if(slash_pos != kwsys_stl::string::npos)
{
@@ -3515,7 +3510,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
}
bool SystemTools::FileHasSignature(const char *filename,
- const char *signature,
+ const char *signature,
long offset)
{
if (!filename || !signature)
@@ -3547,9 +3542,9 @@ bool SystemTools::FileHasSignature(const char *filename,
return res;
}
-SystemTools::FileTypeEnum
+SystemTools::FileTypeEnum
SystemTools::DetectFileType(const char *filename,
- unsigned long length,
+ unsigned long length,
double percent_bin)
{
if (!filename || percent_bin < 0)
@@ -3577,13 +3572,13 @@ SystemTools::DetectFileType(const char *filename,
// Loop over contents and count
size_t text_count = 0;
-
+
const unsigned char *ptr = buffer;
const unsigned char *buffer_end = buffer + read_length;
while (ptr != buffer_end)
{
- if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
+ if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
*ptr == '\n' ||
*ptr == '\r' ||
*ptr == '\t')
@@ -3595,7 +3590,7 @@ SystemTools::DetectFileType(const char *filename,
delete [] buffer;
- double current_percent_bin =
+ double current_percent_bin =
(static_cast<double>(read_length - text_count) /
static_cast<double>(read_length));
@@ -3607,8 +3602,8 @@ SystemTools::DetectFileType(const char *filename,
return SystemTools::FileTypeText;
}
-bool SystemTools::LocateFileInDir(const char *filename,
- const char *dir,
+bool SystemTools::LocateFileInDir(const char *filename,
+ const char *dir,
kwsys_stl::string& filename_found,
int try_filename_dirs)
{
@@ -3621,7 +3616,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename);
- // Check if 'dir' is really a directory
+ // Check if 'dir' is really a directory
// If win32 and matches something like C:, accept it as a dir
kwsys_stl::string real_dir;
@@ -3645,7 +3640,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
if (filename_base.size() && dir)
{
size_t dir_len = strlen(dir);
- int need_slash =
+ int need_slash =
(dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\');
kwsys_stl::string temp = dir;
@@ -3676,7 +3671,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
filename_dir = SystemTools::GetFilenamePath(filename_dir);
filename_dir_base = SystemTools::GetFilenameName(filename_dir);
#if defined( _WIN32 )
- if (!filename_dir_base.size() ||
+ if (!filename_dir_base.size() ||
filename_dir_base[filename_dir_base.size() - 1] == ':')
#else
if (!filename_dir_base.size())
@@ -3700,7 +3695,7 @@ bool SystemTools::LocateFileInDir(const char *filename,
} while (!res && filename_dir_base.size());
}
}
-
+
return res;
}
@@ -3746,12 +3741,12 @@ bool SystemTools::FileIsFullPath(const char* in_name)
bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(WIN32) && !defined(__CYGWIN__)
const int size = int(strlen(path)) +1; // size of return
char *buffer = new char[size]; // create a buffer
char *tempPath = new char[size]; // create a buffer
int ret;
-
+
// if the path passed in has quotes around it, first remove the quotes
if (path[0] == '"' && path[strlen(path)-1] == '"')
{
@@ -3762,7 +3757,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{
strcpy(tempPath,path);
}
-
+
buffer[0] = 0;
ret = GetShortPathName(tempPath, buffer, size);
@@ -3785,7 +3780,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
#endif
}
-void SystemTools::SplitProgramFromArgs(const char* path,
+void SystemTools::SplitProgramFromArgs(const char* path,
kwsys_stl::string& program, kwsys_stl::string& args)
{
// see if this is a full path to a program
@@ -3797,7 +3792,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
return;
}
// Try to find the program in the path, note the program
- // may have spaces in its name so we have to look for it
+ // may have spaces in its name so we have to look for it
kwsys_stl::vector<kwsys_stl::string> e;
kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
if(findProg.size())
@@ -3828,7 +3823,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
args = dir.substr(spacePos, dir.size()-spacePos);
return;
}
- // Now try and find the the program in the path
+ // Now try and find the the program in the path
findProg = SystemTools::FindProgram(tryProg.c_str(), e);
if(findProg.size())
{
@@ -4203,23 +4198,23 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
if (!bOsVersionInfoEx)
{
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (!GetVersionEx((OSVERSIONINFO *)&osvi))
+ if (!GetVersionEx((OSVERSIONINFO *)&osvi))
{
return 0;
}
}
-
+
switch (osvi.dwPlatformId)
{
// Test for the Windows NT product family.
case VER_PLATFORM_WIN32_NT:
-
+
// Test for the specific product family.
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
{
-#if (_MSC_VER >= 1300)
+#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
res += "Microsoft Windows Vista";
@@ -4259,7 +4254,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
{
// Test for the workstation type.
-#if (_MSC_VER >= 1300)
+#if (_MSC_VER >= 1300)
if (osvi.wProductType == VER_NT_WORKSTATION)
{
if (osvi.dwMajorVersion == 4)
@@ -4278,7 +4273,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
}
-
+
// Test for the server type.
else if (osvi.wProductType == VER_NT_SERVER)
@@ -4302,7 +4297,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
res += " Standard Edition";
}
}
-
+
else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
{
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
@@ -4319,7 +4314,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
}
- else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0
+ else if (osvi.dwMajorVersion <= 4) // Windows NT 4.0
{
if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
{
@@ -4336,7 +4331,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// Test for specific product on Windows NT 4.0 SP5 and earlier
- else
+ else
{
HKEY hKey;
#define BUFSIZE 80
@@ -4386,7 +4381,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// Display service pack (if any) and build number.
- if (osvi.dwMajorVersion == 4 &&
+ if (osvi.dwMajorVersion == 4 &&
lstrcmpi(osvi.szCSDVersion, "Service Pack 6") == 0)
{
HKEY hKey;
@@ -4415,7 +4410,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
res += buffer;
res += ")";
}
-
+
RegCloseKey(hKey);
}
else // Windows NT 3.51 and earlier or Windows 2000 and later
@@ -4455,11 +4450,11 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
{
res += "Microsoft Windows Millennium Edition";
- }
+ }
break;
case VER_PLATFORM_WIN32s:
-
+
res += "Microsoft Win32s";
break;
}
@@ -4469,7 +4464,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
}
// ----------------------------------------------------------------------
-bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
+bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
kwsys_stl::string& protocol,
kwsys_stl::string& dataglom )
{
@@ -4487,12 +4482,12 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
}
// ----------------------------------------------------------------------
-bool SystemTools::ParseURL( const kwsys_stl::string& URL,
+bool SystemTools::ParseURL( const kwsys_stl::string& URL,
kwsys_stl::string& protocol,
- kwsys_stl::string& username,
- kwsys_stl::string& password,
- kwsys_stl::string& hostname,
- kwsys_stl::string& dataport,
+ kwsys_stl::string& username,
+ kwsys_stl::string& password,
+ kwsys_stl::string& hostname,
+ kwsys_stl::string& dataport,
kwsys_stl::string& database )
{
kwsys::RegularExpression urlRe( VTK_URL_REGEX );
@@ -4515,7 +4510,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL,
hostname = urlRe.match( 6 );
dataport = urlRe.match( 8 );
database = urlRe.match( 9 );
-
+
return true;
}
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 82fa8cd..b03f656 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2011)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 11)
+SET(KWSYS_DATE_STAMP_MONTH 12)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 10)
+SET(KWSYS_DATE_STAMP_DAY 16)
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
new file mode 100644
index 0000000..1faa888
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -0,0 +1,58 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(target_link_libraries)
+
+file(WRITE
+ "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
+ "int main() { return 0; }
+"
+)
+
+add_executable(
+ target_link_libraries
+ "${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
+)
+
+macro(ASSERT_PROPERTY _target _property _value)
+ get_target_property(_out ${_target} ${_property})
+ if (NOT _out)
+ set(_out "")
+ endif()
+ if (NOT "${_out}" STREQUAL "${_value}")
+ message(SEND_ERROR "Target ${_target} does not have property ${_property} with value ${_value}. Actual value: ${_out}")
+ endif()
+endmacro()
+
+include(GenerateExportHeader)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_library(depA SHARED depA.cpp)
+generate_export_header(depA)
+
+add_library(depB SHARED depB.cpp)
+generate_export_header(depB)
+
+target_link_libraries(depB LINK_PRIVATE depA)
+
+add_library(depC SHARED depC.cpp)
+generate_export_header(depC)
+
+target_link_libraries(depC LINK_PUBLIC depA)
+
+assert_property(depA LINK_INTERFACE_LIBRARIES "")
+assert_property(depB LINK_INTERFACE_LIBRARIES "")
+assert_property(depC LINK_INTERFACE_LIBRARIES "depA")
+
+add_executable(targetA targetA.cpp)
+
+target_link_libraries(targetA LINK_INTERFACE_LIBRARIES depA depB)
+
+assert_property(targetA LINK_INTERFACE_LIBRARIES "depA;depB")
+
+set_target_properties(targetA PROPERTIES LINK_INTERFACE_LIBRARIES "")
+
+assert_property(targetA LINK_INTERFACE_LIBRARIES "")
+
+target_link_libraries(targetA depB depC)
+
+assert_property(targetA LINK_INTERFACE_LIBRARIES "")
diff --git a/Tests/CMakeCommands/target_link_libraries/depA.cpp b/Tests/CMakeCommands/target_link_libraries/depA.cpp
new file mode 100644
index 0000000..c2e8e7b
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depA.cpp
@@ -0,0 +1,7 @@
+
+#include "depA.h"
+
+int DepA::foo()
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depA.h b/Tests/CMakeCommands/target_link_libraries/depA.h
new file mode 100644
index 0000000..7a85948
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depA.h
@@ -0,0 +1,7 @@
+
+#include "depa_export.h"
+
+struct DEPA_EXPORT DepA
+{
+ int foo();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/depB.cpp b/Tests/CMakeCommands/target_link_libraries/depB.cpp
new file mode 100644
index 0000000..97e5be2
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depB.cpp
@@ -0,0 +1,11 @@
+
+#include "depB.h"
+
+#include "depA.h"
+
+int DepB::foo()
+{
+ DepA a;
+
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depB.h b/Tests/CMakeCommands/target_link_libraries/depB.h
new file mode 100644
index 0000000..e617813
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depB.h
@@ -0,0 +1,7 @@
+
+#include "depb_export.h"
+
+struct DEPB_EXPORT DepB
+{
+ int foo();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/depC.cpp b/Tests/CMakeCommands/target_link_libraries/depC.cpp
new file mode 100644
index 0000000..93410a8
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depC.cpp
@@ -0,0 +1,13 @@
+
+#include "depC.h"
+
+int DepC::foo()
+{
+ return 0;
+}
+
+DepA DepC::getA()
+{
+ DepA a;
+ return a;
+} \ No newline at end of file
diff --git a/Tests/CMakeCommands/target_link_libraries/depC.h b/Tests/CMakeCommands/target_link_libraries/depC.h
new file mode 100644
index 0000000..4d65c9e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depC.h
@@ -0,0 +1,12 @@
+
+#include "depc_export.h"
+
+#include "depA.h"
+
+struct DEPC_EXPORT DepC
+{
+ int foo();
+
+ DepA getA();
+
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/targetA.cpp b/Tests/CMakeCommands/target_link_libraries/targetA.cpp
new file mode 100644
index 0000000..3c6472e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/targetA.cpp
@@ -0,0 +1,12 @@
+
+#include "depB.h"
+#include "depC.h"
+
+int main(int argc, char **argv)
+{
+ DepA a;
+ DepB b;
+ DepC c;
+
+ return a.foo() + b.foo() + c.foo();
+}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 21d1196..1851f7a 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1206,6 +1206,61 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MakeClean")
ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
+ if(NOT DEFINED CTEST_RUN_MFC)
+ set(CTEST_RUN_MFC OFF)
+
+ if(MSVC)
+ set(CTEST_RUN_MFC ON)
+
+ # Look for evidence that this is a VCExpress build. If so, avoid
+ # the MFC test by default.
+ string(TOLOWER "${CMAKE_TEST_MAKEPROGRAM}" mkprog)
+ if(mkprog MATCHES "vcexpress")
+ message(STATUS
+ "CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test")
+ set(CTEST_RUN_MFC OFF)
+ endif()
+
+ # Since MSBuild might also be the "makeprogram" for a VCExpress
+ # build tree, use one more heuristic, too. The string representing
+ # the .vcproj file type contains "VCExpress" on machines where an
+ # express edition of VS was installed last:
+ if(CTEST_RUN_MFC)
+ execute_process(COMMAND cmd /c assoc .vcproj
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE ov)
+ if(ov MATCHES "VCExpress")
+ message(STATUS
+ ".vcproj file association indicates VCExpress, avoiding MFC test")
+ set(CTEST_RUN_MFC OFF)
+ endif()
+ endif()
+
+ # For the Watcom WMake generator, avoid the MFC test by default.
+ if(CTEST_RUN_MFC)
+ if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake")
+ message(STATUS
+ "using the Watcom WMake generator, avoiding MFC test")
+ set(CTEST_RUN_MFC OFF)
+ endif()
+ endif()
+ endif()
+ endif()
+
+ if(CTEST_RUN_MFC)
+ add_test(MFC ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/MFC"
+ "${CMake_BINARY_DIR}/Tests/MFC"
+ --build-two-config
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project mfc_driver
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --test-command ${CMAKE_CTEST_COMMAND}
+ -C \${CTEST_CONFIGURATION_TYPE} -VV)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC")
+ endif()
+
IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio")
ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -1603,6 +1658,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
-P "${CMake_SOURCE_DIR}/Tests/CMakeCommands/build_command/RunCMake.cmake"
)
+ ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
+
CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestCrash/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake"
diff --git a/Tests/CMakeTests/.gitattributes b/Tests/CMakeTests/.gitattributes
new file mode 100644
index 0000000..c34e350
--- /dev/null
+++ b/Tests/CMakeTests/.gitattributes
@@ -0,0 +1 @@
+File-HASH-Input.txt crlf=input
diff --git a/Tests/CMakeTests/CheckCMakeTest.cmake b/Tests/CMakeTests/CheckCMakeTest.cmake
index 2e4fedd..db92905 100644
--- a/Tests/CMakeTests/CheckCMakeTest.cmake
+++ b/Tests/CMakeTests/CheckCMakeTest.cmake
@@ -12,7 +12,7 @@ function(check_cmake_test prefix)
)
string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}")
string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}")
- if(NOT "${result}" STREQUAL ${${test}-RESULT})
+ if(NOT "${result}" STREQUAL "${${test}-RESULT}")
message(FATAL_ERROR
"Test ${test} result is [${result}], not [${${test}-RESULT}].\n"
"Test ${test} output:\n"
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake
new file mode 100644
index 0000000..3b09eb0
--- /dev/null
+++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-COPYONLY.cmake
@@ -0,0 +1,3 @@
+set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
+file(WRITE ${file_name} "Data\n")
+configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS)
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake
new file mode 100644
index 0000000..133a67a
--- /dev/null
+++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-NoArg.cmake
@@ -0,0 +1,3 @@
+set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
+file(WRITE ${file_name} "Data\n")
+configure_file(${file_name} ${file_name}.out NEWLINE_STYLE)
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake
new file mode 100644
index 0000000..b7e619c
--- /dev/null
+++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-ValidArg.cmake
@@ -0,0 +1,17 @@
+set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
+
+function(test_eol style in out)
+ file(WRITE ${file_name} "${in}")
+ configure_file(${file_name} ${file_name}.out NEWLINE_STYLE ${style})
+ file(READ ${file_name}.out new HEX)
+ if(NOT "${new}" STREQUAL "${out}")
+ message(FATAL_ERROR "No ${style} line endings")
+ endif()
+endfunction()
+
+test_eol(DOS "a\n" "610d0a")
+test_eol(WIN32 "b\n" "620d0a")
+test_eol(CRLF "c\n" "630d0a")
+
+test_eol(UNIX "d\n" "640a")
+test_eol(LF "e\n" "650a")
diff --git a/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake b/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake
new file mode 100644
index 0000000..e8887c1
--- /dev/null
+++ b/Tests/CMakeTests/ConfigureFile-NewLineStyle-WrongArg.cmake
@@ -0,0 +1,3 @@
+set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
+file(WRITE ${file_name} "Data\n")
+configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO)
diff --git a/Tests/CMakeTests/ConfigureFileTest.cmake.in b/Tests/CMakeTests/ConfigureFileTest.cmake.in
index c78a470..6cc61d9 100644
--- a/Tests/CMakeTests/ConfigureFileTest.cmake.in
+++ b/Tests/CMakeTests/ConfigureFileTest.cmake.in
@@ -6,6 +6,14 @@ set(Relative-RESULT 0)
set(Relative-STDERR "Relative test file")
set(BadArg-RESULT 1)
set(BadArg-STDERR "called with incorrect number of arguments")
+set(NewLineStyle-NoArg-RESULT 1)
+set(NewLineStyle-NoArg-STDERR "NEWLINE_STYLE must set a style:")
+set(NewLineStyle-WrongArg-RESULT 1)
+set(NewLineStyle-WrongArg-STDERR "NEWLINE_STYLE sets an unknown style")
+set(NewLineStyle-ValidArg-RESULT 0)
+set(NewLineStyle-ValidArg-STDERR )
+set(NewLineStyle-COPYONLY-RESULT 1)
+set(NewLineStyle-COPYONLY-STDERR "COPYONLY could not be used in combination")
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(ConfigureFile
@@ -13,4 +21,8 @@ check_cmake_test(ConfigureFile
DirOutput
Relative
BadArg
+ NewLineStyle-NoArg
+ NewLineStyle-WrongArg
+ NewLineStyle-ValidArg
+ NewLineStyle-COPYONLY
)
diff --git a/Tests/CMakeTests/File-HASH-Input.txt b/Tests/CMakeTests/File-HASH-Input.txt
new file mode 100644
index 0000000..a1d315b
--- /dev/null
+++ b/Tests/CMakeTests/File-HASH-Input.txt
@@ -0,0 +1 @@
+sample input string
diff --git a/Tests/CMakeTests/File-MD5-BadArg1.cmake b/Tests/CMakeTests/File-MD5-BadArg1.cmake
new file mode 100644
index 0000000..ac5f67a
--- /dev/null
+++ b/Tests/CMakeTests/File-MD5-BadArg1.cmake
@@ -0,0 +1 @@
+file(MD5)
diff --git a/Tests/CMakeTests/File-MD5-BadArg2.cmake b/Tests/CMakeTests/File-MD5-BadArg2.cmake
new file mode 100644
index 0000000..2acc075
--- /dev/null
+++ b/Tests/CMakeTests/File-MD5-BadArg2.cmake
@@ -0,0 +1 @@
+file(MD5 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt)
diff --git a/Tests/CMakeTests/File-MD5-BadArg4.cmake b/Tests/CMakeTests/File-MD5-BadArg4.cmake
new file mode 100644
index 0000000..79b2755
--- /dev/null
+++ b/Tests/CMakeTests/File-MD5-BadArg4.cmake
@@ -0,0 +1 @@
+file(MD5 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt md5 extra_arg)
diff --git a/Tests/CMakeTests/File-MD5-NoFile.cmake b/Tests/CMakeTests/File-MD5-NoFile.cmake
new file mode 100644
index 0000000..1b91bc8
--- /dev/null
+++ b/Tests/CMakeTests/File-MD5-NoFile.cmake
@@ -0,0 +1 @@
+file(MD5 ${CMAKE_CURRENT_LIST_DIR}/DoesNotExist.cmake md5)
diff --git a/Tests/CMakeTests/File-MD5-Works.cmake b/Tests/CMakeTests/File-MD5-Works.cmake
new file mode 100644
index 0000000..0fabe54
--- /dev/null
+++ b/Tests/CMakeTests/File-MD5-Works.cmake
@@ -0,0 +1,2 @@
+file(MD5 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt md5)
+message("${md5}")
diff --git a/Tests/CMakeTests/File-SHA1-Works.cmake b/Tests/CMakeTests/File-SHA1-Works.cmake
new file mode 100644
index 0000000..f2ab5d7
--- /dev/null
+++ b/Tests/CMakeTests/File-SHA1-Works.cmake
@@ -0,0 +1,2 @@
+file(SHA1 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha1)
+message("${sha1}")
diff --git a/Tests/CMakeTests/File-SHA224-Works.cmake b/Tests/CMakeTests/File-SHA224-Works.cmake
new file mode 100644
index 0000000..3e86b17
--- /dev/null
+++ b/Tests/CMakeTests/File-SHA224-Works.cmake
@@ -0,0 +1,2 @@
+file(SHA224 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha224)
+message("${sha224}")
diff --git a/Tests/CMakeTests/File-SHA256-Works.cmake b/Tests/CMakeTests/File-SHA256-Works.cmake
new file mode 100644
index 0000000..b72d89e
--- /dev/null
+++ b/Tests/CMakeTests/File-SHA256-Works.cmake
@@ -0,0 +1,2 @@
+file(SHA256 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha256)
+message("${sha256}")
diff --git a/Tests/CMakeTests/File-SHA384-Works.cmake b/Tests/CMakeTests/File-SHA384-Works.cmake
new file mode 100644
index 0000000..0eeca33
--- /dev/null
+++ b/Tests/CMakeTests/File-SHA384-Works.cmake
@@ -0,0 +1,2 @@
+file(SHA384 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha384)
+message("${sha384}")
diff --git a/Tests/CMakeTests/File-SHA512-Works.cmake b/Tests/CMakeTests/File-SHA512-Works.cmake
new file mode 100644
index 0000000..d74ee44
--- /dev/null
+++ b/Tests/CMakeTests/File-SHA512-Works.cmake
@@ -0,0 +1,2 @@
+file(SHA512 ${CMAKE_CURRENT_LIST_DIR}/File-HASH-Input.txt sha512)
+message("${sha512}")
diff --git a/Tests/CMakeTests/FileTest.cmake.in b/Tests/CMakeTests/FileTest.cmake.in
index b6dcaa6..3c3d85d 100644
--- a/Tests/CMakeTests/FileTest.cmake.in
+++ b/Tests/CMakeTests/FileTest.cmake.in
@@ -12,6 +12,26 @@ set(Copy-NoDest-RESULT 1)
set(Copy-NoDest-STDERR "given no DESTINATION")
set(Copy-NoFile-RESULT 1)
set(Copy-NoFile-STDERR "COPY cannot find.*/does_not_exist\\.txt")
+set(MD5-NoFile-RESULT 1)
+set(MD5-NoFile-STDERR "file MD5 failed to read file")
+set(MD5-BadArg1-RESULT 1)
+set(MD5-BadArg1-STDERR "file must be called with at least two arguments")
+set(MD5-BadArg2-RESULT 1)
+set(MD5-BadArg2-STDERR "file MD5 requires a file name and output variable")
+set(MD5-BadArg4-RESULT 1)
+set(MD5-BadArg4-STDERR "file MD5 requires a file name and output variable")
+set(MD5-Works-RESULT 0)
+set(MD5-Works-STDERR "10d20ddb981a6202b84aa1ce1cb7fce3")
+set(SHA1-Works-RESULT 0)
+set(SHA1-Works-STDERR "83f093e04289b21a9415f408ad50be8b57ad2f34")
+set(SHA224-Works-RESULT 0)
+set(SHA224-Works-STDERR "e995a7789922c4ef9279d94e763c8375934180a51baa7147bc48edf7")
+set(SHA256-Works-RESULT 0)
+set(SHA256-Works-STDERR "d1c5915d8b71150726a1eef75a29ec6bea8fd1bef6b7299ef8048760b0402025")
+set(SHA384-Works-RESULT 0)
+set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee")
+set(SHA512-Works-RESULT 0)
+set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51")
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(File
@@ -22,6 +42,16 @@ check_cmake_test(File
Copy-LateArg
Copy-NoDest
Copy-NoFile
+ MD5-NoFile
+ MD5-BadArg1
+ MD5-BadArg2
+ MD5-BadArg4
+ MD5-Works
+ SHA1-Works
+ SHA224-Works
+ SHA256-Works
+ SHA384-Works
+ SHA512-Works
)
# Also execute each test listed in FileTestScript.cmake:
diff --git a/Tests/CMakeTests/String-MD5-BadArg1.cmake b/Tests/CMakeTests/String-MD5-BadArg1.cmake
new file mode 100644
index 0000000..8946476
--- /dev/null
+++ b/Tests/CMakeTests/String-MD5-BadArg1.cmake
@@ -0,0 +1 @@
+string(MD5)
diff --git a/Tests/CMakeTests/String-MD5-BadArg2.cmake b/Tests/CMakeTests/String-MD5-BadArg2.cmake
new file mode 100644
index 0000000..abbbf87
--- /dev/null
+++ b/Tests/CMakeTests/String-MD5-BadArg2.cmake
@@ -0,0 +1 @@
+string(MD5 md5)
diff --git a/Tests/CMakeTests/String-MD5-BadArg4.cmake b/Tests/CMakeTests/String-MD5-BadArg4.cmake
new file mode 100644
index 0000000..edd4427
--- /dev/null
+++ b/Tests/CMakeTests/String-MD5-BadArg4.cmake
@@ -0,0 +1 @@
+string(MD5 md5 input extra_arg)
diff --git a/Tests/CMakeTests/String-MD5-Works.cmake b/Tests/CMakeTests/String-MD5-Works.cmake
new file mode 100644
index 0000000..4ef7a07
--- /dev/null
+++ b/Tests/CMakeTests/String-MD5-Works.cmake
@@ -0,0 +1,2 @@
+string(MD5 md5 "sample input string\n")
+message("${md5}")
diff --git a/Tests/CMakeTests/String-SHA1-Works.cmake b/Tests/CMakeTests/String-SHA1-Works.cmake
new file mode 100644
index 0000000..2f3b51b
--- /dev/null
+++ b/Tests/CMakeTests/String-SHA1-Works.cmake
@@ -0,0 +1,2 @@
+string(SHA1 sha1 "sample input string\n")
+message("${sha1}")
diff --git a/Tests/CMakeTests/String-SHA224-Works.cmake b/Tests/CMakeTests/String-SHA224-Works.cmake
new file mode 100644
index 0000000..5b7f880
--- /dev/null
+++ b/Tests/CMakeTests/String-SHA224-Works.cmake
@@ -0,0 +1,2 @@
+string(SHA224 sha224 "sample input string\n")
+message("${sha224}")
diff --git a/Tests/CMakeTests/String-SHA256-Works.cmake b/Tests/CMakeTests/String-SHA256-Works.cmake
new file mode 100644
index 0000000..e3e89ae
--- /dev/null
+++ b/Tests/CMakeTests/String-SHA256-Works.cmake
@@ -0,0 +1,2 @@
+string(SHA256 sha256 "sample input string\n")
+message("${sha256}")
diff --git a/Tests/CMakeTests/String-SHA384-Works.cmake b/Tests/CMakeTests/String-SHA384-Works.cmake
new file mode 100644
index 0000000..828a190
--- /dev/null
+++ b/Tests/CMakeTests/String-SHA384-Works.cmake
@@ -0,0 +1,2 @@
+string(SHA384 sha384 "sample input string\n")
+message("${sha384}")
diff --git a/Tests/CMakeTests/String-SHA512-Works.cmake b/Tests/CMakeTests/String-SHA512-Works.cmake
new file mode 100644
index 0000000..e17db5c
--- /dev/null
+++ b/Tests/CMakeTests/String-SHA512-Works.cmake
@@ -0,0 +1,2 @@
+string(SHA512 sha512 "sample input string\n")
+message("${sha512}")
diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in
index 6bb60f4..49e7dc9 100644
--- a/Tests/CMakeTests/StringTest.cmake.in
+++ b/Tests/CMakeTests/StringTest.cmake.in
@@ -1,3 +1,35 @@
+set(MD5-BadArg1-RESULT 1)
+set(MD5-BadArg1-STDERR "string MD5 requires an output variable")
+set(MD5-BadArg2-RESULT 1)
+set(MD5-BadArg2-STDERR "string MD5 requires an output variable and an input string")
+set(MD5-BadArg4-RESULT 1)
+set(MD5-BadArg4-STDERR "string MD5 requires an output variable and an input string")
+set(MD5-Works-RESULT 0)
+set(MD5-Works-STDERR "10d20ddb981a6202b84aa1ce1cb7fce3")
+set(SHA1-Works-RESULT 0)
+set(SHA1-Works-STDERR "83f093e04289b21a9415f408ad50be8b57ad2f34")
+set(SHA224-Works-RESULT 0)
+set(SHA224-Works-STDERR "e995a7789922c4ef9279d94e763c8375934180a51baa7147bc48edf7")
+set(SHA256-Works-RESULT 0)
+set(SHA256-Works-STDERR "d1c5915d8b71150726a1eef75a29ec6bea8fd1bef6b7299ef8048760b0402025")
+set(SHA384-Works-RESULT 0)
+set(SHA384-Works-STDERR "1de9560b4e030e02051ea408200ffc55d70c97ac64ebf822461a5c786f495c36df43259b14483bc8d364f0106f4971ee")
+set(SHA512-Works-RESULT 0)
+set(SHA512-Works-STDERR "3982a1b4e651768bec70ab1fb97045cb7a659f4ba7203d501c52ab2e803071f9d5fd272022df15f27727fc67f8cd022e710e29010b2a9c0b467c111e2f6abf51")
+
+include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
+check_cmake_test(String
+ MD5-BadArg1
+ MD5-BadArg2
+ MD5-BadArg4
+ MD5-Works
+ SHA1-Works
+ SHA224-Works
+ SHA256-Works
+ SHA384-Works
+ SHA512-Works
+ )
+
# Execute each test listed in StringTestScript.cmake:
#
set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/StringTestScript.cmake")
diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt
index 2e01c50..ccfb894 100644
--- a/Tests/ExportImport/CMakeLists.txt
+++ b/Tests/ExportImport/CMakeLists.txt
@@ -22,6 +22,11 @@ else(CMAKE_CONFIGURATION_TYPES)
endif(CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES)
+if(MINGW OR MSYS)
+ # Test CMAKE_GNUtoMS whether we have VS or not.
+ set(ExportImport_GNUtoMS 1)
+endif()
+
configure_file(${ExportImport_SOURCE_DIR}/InitialCache.cmake.in
${ExportImport_BINARY_DIR}/InitialCache.cmake @ONLY)
diff --git a/Tests/ExportImport/InitialCache.cmake.in b/Tests/ExportImport/InitialCache.cmake.in
index f920b1f..4893f70 100644
--- a/Tests/ExportImport/InitialCache.cmake.in
+++ b/Tests/ExportImport/InitialCache.cmake.in
@@ -12,3 +12,4 @@ SET(CMAKE_CXX_FLAGS_MINSIZEREL "@CMAKE_CXX_FLAGS_MINSIZEREL@" CACHE STRING "C++
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" CACHE STRING "C++ Flags")
SET(CMAKE_INSTALL_PREFIX "@ExportImport_BINARY_DIR@/Root" CACHE STRING "Installation Prefix")
SET(CMAKE_SKIP_RPATH ON CACHE BOOL "No RPATH")
+SET(CMAKE_GNUtoMS "@ExportImport_GNUtoMS@" CACHE BOOL "CMAKE_GNUtoMS")
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 4a542d7..ac70129 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -343,13 +343,6 @@ endif()
# Only do svn tests with svn >= version 1.2
#
if(do_svn_tests)
- execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} --version
- OUTPUT_VARIABLE Subversion_VERSION_SVN
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*"
- "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")
- message(STATUS "Subversion_VERSION_SVN='${Subversion_VERSION_SVN}'")
-
if(Subversion_VERSION_SVN VERSION_LESS 1.2)
message(STATUS "No ExternalProject svn tests with svn client less than version 1.2")
set(do_svn_tests 0)
diff --git a/Tests/ExternalProject/Example/CMakeLists.txt b/Tests/ExternalProject/Example/CMakeLists.txt
index 2cadd7d..69ebaaf 100644
--- a/Tests/ExternalProject/Example/CMakeLists.txt
+++ b/Tests/ExternalProject/Example/CMakeLists.txt
@@ -6,6 +6,6 @@ include(ExternalProject)
ExternalProject_Add(
cmake281
URL http://www.cmake.org/files/v2.8/cmake-2.8.1.tar.gz
- CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND ""
)
diff --git a/Tests/MFC/CMakeLists.txt b/Tests/MFC/CMakeLists.txt
new file mode 100644
index 0000000..62ff749
--- /dev/null
+++ b/Tests/MFC/CMakeLists.txt
@@ -0,0 +1,61 @@
+cmake_minimum_required(VERSION 2.8)
+project(mfc_driver)
+
+include(CTest)
+include(ExternalProject)
+
+
+set(CMAKE_MFC_FLAG_VALUE "2")
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.SharedMfcDll.txt
+ @ONLY
+ )
+
+ExternalProject_Add(mfcShared
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/mfc1
+ PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.SharedMfcDll.txt
+ <SOURCE_DIR>/CMakeLists.txt
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ )
+
+
+set(CMAKE_MFC_FLAG_VALUE "1")
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.StaticMfcLib.txt
+ @ONLY
+ )
+
+ExternalProject_Add(mfcStatic
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/mfc1
+ PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.StaticMfcLib.txt
+ <SOURCE_DIR>/CMakeLists.txt
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ )
+
+
+set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}")
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ValidateBuild.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/ValidateBuild.cmake
+ @ONLY
+ )
+add_test(
+ NAME validate
+ COMMAND ${CMAKE_COMMAND}
+ -P "${CMAKE_CURRENT_BINARY_DIR}/ValidateBuild.cmake"
+ )
+
+
+add_test(
+ NAME environment
+ COMMAND ${CMAKE_COMMAND} -E environment
+ )
+
+
+message(STATUS "===== environment =====")
+execute_process(COMMAND ${CMAKE_COMMAND} -E environment)
+message(STATUS "===== /environment =====")
diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in
new file mode 100644
index 0000000..e6bfabd
--- /dev/null
+++ b/Tests/MFC/CMakeLists.txt.in
@@ -0,0 +1,62 @@
+cmake_minimum_required(VERSION 2.8)
+project(mfc1)
+
+macro(replace_flags var these those)
+ if("${${var}}" MATCHES "${these}")
+ string(REGEX REPLACE "${these}" "${those}" ${var} "${${var}}")
+ #message(STATUS "info: ${var} changed to '${${var}}'")
+ endif()
+ message(STATUS "info: ${var}='${${var}}'")
+endmacro()
+
+macro(msvc_link_to_static_crt)
+ if(MSVC)
+ set(has_correct_flag 0)
+ foreach(lang C CXX)
+ foreach(suffix "" _DEBUG _MINSIZEREL _RELEASE _RELWITHDEBINFO)
+ replace_flags("CMAKE_${lang}_FLAGS${suffix}" "/MD" "/MT")
+ if(CMAKE_${lang}_FLAGS${suffix} MATCHES "/MT")
+ set(has_correct_flag 1)
+ endif()
+ endforeach()
+ endforeach()
+ if(NOT has_correct_flag)
+ message(FATAL_ERROR "no CMAKE_*_FLAGS var contains /MT")
+ endif()
+ endif()
+endmacro()
+
+set(files
+ ChildFrm.cpp
+ ChildFrm.h
+ MainFrm.cpp
+ MainFrm.h
+ mfc1.cpp
+ mfc1.h
+ mfc1.rc
+ mfc1Doc.cpp
+ mfc1Doc.h
+ mfc1View.cpp
+ mfc1View.h
+ Resource.h
+ stdafx.cpp
+ stdafx.h
+)
+
+set(CMAKE_MFC_FLAG "@CMAKE_MFC_FLAG_VALUE@")
+
+if("${CMAKE_MFC_FLAG}" STREQUAL "1")
+ msvc_link_to_static_crt()
+else()
+ # VS generators add this automatically based on the CMAKE_MFC_FLAG value,
+ # but generators matching "Make" require:
+ add_definitions(-D_AFXDLL)
+endif()
+
+add_executable(mfc1 WIN32 ${files})
+install(TARGETS mfc1 DESTINATION bin)
+
+if("${CMAKE_MFC_FLAG}" STREQUAL "2")
+ set(CMAKE_INSTALL_MFC_LIBRARIES ON)
+ include(InstallRequiredSystemLibraries)
+endif()
diff --git a/Tests/MFC/ValidateBuild.cmake.in b/Tests/MFC/ValidateBuild.cmake.in
new file mode 100644
index 0000000..ed923f5
--- /dev/null
+++ b/Tests/MFC/ValidateBuild.cmake.in
@@ -0,0 +1,68 @@
+#
+# This code validates that the install trees of the shared and static builds
+# of "mfc1" have the expected contents:
+#
+set(binary_dir "@binary_dir@")
+message("binary_dir='${binary_dir}'")
+
+# There should be exactly one file in the static install tree "bin" directory
+# and it should be named "mfc1.exe"
+#
+message(STATUS "===== mfcStatic install tree =====")
+file(GLOB_RECURSE files "${binary_dir}/mfcStatic-prefix/bin/*.*")
+message(STATUS "mfcStatic files='${files}'")
+list(LENGTH files len)
+if(NOT len EQUAL 1)
+ message(FATAL_ERROR
+ "len='${len}' is not '1' (count of static 'bin' files)")
+endif()
+get_filename_component(name "${files}" NAME)
+string(TOLOWER "${name}" name)
+if(NOT "${name}" STREQUAL "mfc1.exe")
+ message(FATAL_ERROR "unexpected mfcStatic file name '${name}'")
+endif()
+
+# There should be at least 3 files in the shared install tree "bin"
+# directory: mfc1.exe, the main MFC dll and the C runtime dll. With more
+# recent versions of VS, there will also be an MFC language dll and a
+# manifest file.
+#
+message(STATUS "===== mfcShared install tree =====")
+file(GLOB_RECURSE files "${binary_dir}/mfcShared-prefix/bin/*.*")
+message(STATUS "mfcShared files='${files}'")
+list(LENGTH files len)
+
+set(msvc6 "@MSVC60@")
+if("${msvc6}" STREQUAL "1")
+ set(expected_minimum_file_count 1)
+else()
+ set(expected_minimum_file_count 3)
+endif()
+
+if(len LESS ${expected_minimum_file_count})
+ message(FATAL_ERROR
+ "len='${len}' is less than '${expected_minimum_file_count}' (count of shared 'bin' files)")
+endif()
+foreach(f ${files})
+ message(STATUS "file '${f}'")
+ get_filename_component(ext "${f}" EXT)
+ string(TOLOWER "${ext}" ext)
+
+ if("${ext}" MATCHES "\\.exe$")
+ message(STATUS " exe file")
+ get_filename_component(name "${f}" NAME)
+ string(TOLOWER "${name}" name)
+ if(NOT "${name}" STREQUAL "mfc1.exe")
+ message(FATAL_ERROR "unexpected mfcShared .exe file name '${name}'")
+ endif()
+ elseif("${ext}" MATCHES "\\.dll$")
+ message(STATUS " dll file")
+ elseif("${ext}" MATCHES "\\.manifest$")
+ message(STATUS " manifest file")
+ else()
+ message(STATUS " unknown file")
+ message(FATAL_ERROR "unexpected mfcShared ${ext} file name '${f}'")
+ endif()
+endforeach()
+
+message(STATUS "All mfc1 build validation tests pass.")
diff --git a/Tests/MFC/mfc1/.gitattributes b/Tests/MFC/mfc1/.gitattributes
new file mode 100644
index 0000000..59be5dc
--- /dev/null
+++ b/Tests/MFC/mfc1/.gitattributes
@@ -0,0 +1,6 @@
+.gitattributes export-ignore
+
+*.sln -crlf
+*.vcproj -crlf
+
+* -whitespace
diff --git a/Tests/MFC/mfc1/ChildFrm.cpp b/Tests/MFC/mfc1/ChildFrm.cpp
new file mode 100644
index 0000000..b04c4f2
--- /dev/null
+++ b/Tests/MFC/mfc1/ChildFrm.cpp
@@ -0,0 +1,59 @@
+// ChildFrm.cpp : implementation of the CChildFrame class
+//
+#include "stdafx.h"
+#include "mfc1.h"
+
+#include "ChildFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CChildFrame
+
+IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
+
+BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
+END_MESSAGE_MAP()
+
+
+// CChildFrame construction/destruction
+
+CChildFrame::CChildFrame()
+{
+ // TODO: add member initialization code here
+}
+
+CChildFrame::~CChildFrame()
+{
+}
+
+
+BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+ // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
+ if( !CMDIChildWnd::PreCreateWindow(cs) )
+ return FALSE;
+
+ return TRUE;
+}
+
+
+// CChildFrame diagnostics
+
+#ifdef _DEBUG
+void CChildFrame::AssertValid() const
+{
+ CMDIChildWnd::AssertValid();
+}
+
+void CChildFrame::Dump(CDumpContext& dc) const
+{
+ CMDIChildWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+
+// CChildFrame message handlers
diff --git a/Tests/MFC/mfc1/ChildFrm.h b/Tests/MFC/mfc1/ChildFrm.h
new file mode 100644
index 0000000..34b80f1
--- /dev/null
+++ b/Tests/MFC/mfc1/ChildFrm.h
@@ -0,0 +1,34 @@
+// ChildFrm.h : interface of the CChildFrame class
+//
+
+
+#pragma once
+
+
+class CChildFrame : public CMDIChildWnd
+{
+ DECLARE_DYNCREATE(CChildFrame)
+public:
+ CChildFrame();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// Implementation
+public:
+ virtual ~CChildFrame();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+// Generated message map functions
+protected:
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/Tests/MFC/mfc1/MainFrm.cpp b/Tests/MFC/mfc1/MainFrm.cpp
new file mode 100644
index 0000000..44554bf
--- /dev/null
+++ b/Tests/MFC/mfc1/MainFrm.cpp
@@ -0,0 +1,98 @@
+// MainFrm.cpp : implementation of the CMainFrame class
+//
+
+#include "stdafx.h"
+#include "mfc1.h"
+
+#include "MainFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CMainFrame
+
+IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
+
+BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
+ ON_WM_CREATE()
+END_MESSAGE_MAP()
+
+static UINT indicators[] =
+{
+ ID_SEPARATOR, // status line indicator
+ ID_INDICATOR_CAPS,
+ ID_INDICATOR_NUM,
+ ID_INDICATOR_SCRL,
+};
+
+
+// CMainFrame construction/destruction
+
+CMainFrame::CMainFrame()
+{
+ // TODO: add member initialization code here
+}
+
+CMainFrame::~CMainFrame()
+{
+}
+
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
+ | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
+ !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
+ {
+ TRACE0("Failed to create toolbar\n");
+ return -1; // fail to create
+ }
+
+ if (!m_wndStatusBar.Create(this) ||
+ !m_wndStatusBar.SetIndicators(indicators,
+ sizeof(indicators)/sizeof(UINT)))
+ {
+ TRACE0("Failed to create status bar\n");
+ return -1; // fail to create
+ }
+ // TODO: Delete these three lines if you don't want the toolbar to be dockable
+ m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+ EnableDocking(CBRS_ALIGN_ANY);
+ DockControlBar(&m_wndToolBar);
+
+ return 0;
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if( !CMDIFrameWnd::PreCreateWindow(cs) )
+ return FALSE;
+ // TODO: Modify the Window class or styles here by modifying
+ // the CREATESTRUCT cs
+
+ return TRUE;
+}
+
+
+// CMainFrame diagnostics
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+ CMDIFrameWnd::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+ CMDIFrameWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+
+// CMainFrame message handlers
diff --git a/Tests/MFC/mfc1/MainFrm.h b/Tests/MFC/mfc1/MainFrm.h
new file mode 100644
index 0000000..1039ac5
--- /dev/null
+++ b/Tests/MFC/mfc1/MainFrm.h
@@ -0,0 +1,38 @@
+// MainFrm.h : interface of the CMainFrame class
+//
+
+
+#pragma once
+class CMainFrame : public CMDIFrameWnd
+{
+ DECLARE_DYNAMIC(CMainFrame)
+public:
+ CMainFrame();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+public:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// Implementation
+public:
+ virtual ~CMainFrame();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected: // control bar embedded members
+ CStatusBar m_wndStatusBar;
+ CToolBar m_wndToolBar;
+
+// Generated message map functions
+protected:
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/Tests/MFC/mfc1/ReadMe.txt b/Tests/MFC/mfc1/ReadMe.txt
new file mode 100644
index 0000000..d84608e
--- /dev/null
+++ b/Tests/MFC/mfc1/ReadMe.txt
@@ -0,0 +1,135 @@
+================================================================================
+ MICROSOFT FOUNDATION CLASS LIBRARY : mfc1 Project Overview
+===============================================================================
+
+The application wizard has created this mfc1 application for
+you. This application not only demonstrates the basics of using the Microsoft
+Foundation Classes but is also a starting point for writing your application.
+
+This file contains a summary of what you will find in each of the files that
+make up your mfc1 application.
+
+mfc1.vcproj
+ This is the main project file for VC++ projects generated using an application wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ application wizard.
+
+mfc1.h
+ This is the main header file for the application. It includes other
+ project specific headers (including Resource.h) and declares the
+ Cmfc1App application class.
+
+mfc1.cpp
+ This is the main application source file that contains the application
+ class Cmfc1App.
+
+mfc1.rc
+ This is a listing of all of the Microsoft Windows resources that the
+ program uses. It includes the icons, bitmaps, and cursors that are stored
+ in the RES subdirectory. This file can be directly edited in Microsoft
+ Visual C++. Your project resources are in 1033.
+
+res\mfc1.ico
+ This is an icon file, which is used as the application's icon. This
+ icon is included by the main resource file mfc1.rc.
+
+res\mfc1.rc2
+ This file contains resources that are not edited by Microsoft
+ Visual C++. You should place all resources not editable by
+ the resource editor in this file.
+mfc1.reg
+ This is an example .reg file that shows you the kind of registration
+ settings the framework will set for you. You can use this as a .reg
+ file to go along with your application or just delete it and rely
+ on the default RegisterShellFileTypes registration.
+/////////////////////////////////////////////////////////////////////////////
+
+For the main frame window:
+ The project includes a standard MFC interface.
+MainFrm.h, MainFrm.cpp
+ These files contain the frame class CMainFrame, which is derived from
+ CMDIFrameWnd and controls all MDI frame features.
+res\Toolbar.bmp
+ This bitmap file is used to create tiled images for the toolbar.
+ The initial toolbar and status bar are constructed in the CMainFrame
+ class. Edit this toolbar bitmap using the resource editor, and
+ update the IDR_MAINFRAME TOOLBAR array in mfc1.rc to add
+ toolbar buttons.
+/////////////////////////////////////////////////////////////////////////////
+
+For the child frame window:
+
+ChildFrm.h, ChildFrm.cpp
+ These files define and implement the CChildFrame class, which
+ supports the child windows in an MDI application.
+
+/////////////////////////////////////////////////////////////////////////////
+
+The application wizard creates one document type and one view:
+
+mfc1Doc.h, mfc1Doc.cpp - the document
+ These files contain your Cmfc1Doc class. Edit these files to
+ add your special document data and to implement file saving and loading
+ (via Cmfc1Doc::Serialize).
+ The Document will have the following strings:
+ File extension: mf1
+ File type ID: mfc1.Document
+ Main frame caption: mfc1
+ Doc type name: mfc1
+ Filter name: mfc1 Files (*.mf1)
+ File new short name: mfc1
+ File type long name: mfc1.Document
+mfc1View.h, mfc1View.cpp - the view of the document
+ These files contain your Cmfc1View class.
+ Cmfc1View objects are used to view Cmfc1Doc objects.
+res\mfc1Doc.ico
+ This is an icon file, which is used as the icon for MDI child windows
+ for the Cmfc1Doc class. This icon is included by the main
+ resource file mfc1.rc.
+/////////////////////////////////////////////////////////////////////////////
+
+Other Features:
+
+ActiveX Controls
+ The application includes support to use ActiveX controls.
+
+Printing and Print Preview support
+ The application wizard has generated code to handle the print, print setup, and print preview
+ commands by calling member functions in the CView class from the MFC library.
+/////////////////////////////////////////////////////////////////////////////
+
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named mfc1.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+ This is the standard header file, which defines new resource IDs.
+ Microsoft Visual C++ reads and updates this file.
+
+mfc1.manifest
+ Application manifest files are used by Windows XP to describe an applications
+ dependency on specific versions of Side-by-Side assemblies. The loader uses this
+ information to load the appropriate assembly from the assembly cache or private
+ from the application. The Application manifest maybe included for redistribution
+ as an external .manifest file that is installed in the same folder as the application
+ executable or it may be included in the executable in the form of a resource.
+/////////////////////////////////////////////////////////////////////////////
+
+Other notes:
+
+The application wizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+If your application uses MFC in a shared DLL, and your application is in a
+language other than the operating system's current language, you will need
+to copy the corresponding localized resources MFC70XXX.DLL from the Microsoft
+Visual C++ CD-ROM under the Win\System directory to your computer's system or
+system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the
+language abbreviation. For example, MFC70DEU.DLL contains resources
+translated to German.) If you don't do this, some of the UI elements of
+your application will remain in the language of the operating system.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Tests/MFC/mfc1/Resource.h b/Tests/MFC/mfc1/Resource.h
new file mode 100644
index 0000000..0a9c13f
--- /dev/null
+++ b/Tests/MFC/mfc1/Resource.h
@@ -0,0 +1,20 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by mfc1.rc
+//
+#define IDD_ABOUTBOX 100
+#define IDP_OLE_INIT_FAILED 100
+#define IDR_MAINFRAME 128
+#define IDR_mfc1TYPE 129
+#define IDR_MANIFEST CREATEPROCESS_MANIFEST_RESOURCE_ID
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 130
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 32771
+#endif
+#endif
diff --git a/Tests/MFC/mfc1/mfc1.cpp b/Tests/MFC/mfc1/mfc1.cpp
new file mode 100644
index 0000000..9530cd2
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1.cpp
@@ -0,0 +1,144 @@
+// mfc1.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "mfc1.h"
+#include "MainFrm.h"
+
+#include "ChildFrm.h"
+#include "mfc1Doc.h"
+#include "mfc1View.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// Cmfc1App
+
+BEGIN_MESSAGE_MAP(Cmfc1App, CWinApp)
+ ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
+ // Standard file based document commands
+ ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
+ ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
+ // Standard print setup command
+ ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
+END_MESSAGE_MAP()
+
+
+// Cmfc1App construction
+
+Cmfc1App::Cmfc1App()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only Cmfc1App object
+
+Cmfc1App theApp;
+
+// Cmfc1App initialization
+
+BOOL Cmfc1App::InitInstance()
+{
+ // InitCommonControls() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ InitCommonControls();
+
+ CWinApp::InitInstance();
+
+ // Initialize OLE libraries
+ if (!AfxOleInit())
+ {
+ AfxMessageBox(IDP_OLE_INIT_FAILED);
+ return FALSE;
+ }
+ AfxEnableControlContainer();
+ // Standard initialization
+ // If you are not using these features and wish to reduce the size
+ // of your final executable, you should remove from the following
+ // the specific initialization routines you do not need
+ // Change the registry key under which our settings are stored
+ // TODO: You should modify this string to be something appropriate
+ // such as the name of your company or organization
+ SetRegistryKey(_T("Local AppWizard-Generated Applications"));
+ LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
+ // Register the application's document templates. Document templates
+ // serve as the connection between documents, frame windows and views
+ CMultiDocTemplate* pDocTemplate;
+ pDocTemplate = new CMultiDocTemplate(IDR_mfc1TYPE,
+ RUNTIME_CLASS(Cmfc1Doc),
+ RUNTIME_CLASS(CChildFrame), // custom MDI child frame
+ RUNTIME_CLASS(Cmfc1View));
+ if (!pDocTemplate)
+ return FALSE;
+ AddDocTemplate(pDocTemplate);
+ // create main MDI Frame window
+ CMainFrame* pMainFrame = new CMainFrame;
+ if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
+ return FALSE;
+ m_pMainWnd = pMainFrame;
+ // call DragAcceptFiles only if there's a suffix
+ // In an MDI app, this should occur immediately after setting m_pMainWnd
+ // Enable drag/drop open
+ m_pMainWnd->DragAcceptFiles();
+ // Enable DDE Execute open
+ EnableShellOpen();
+ RegisterShellFileTypes(TRUE);
+ // Parse command line for standard shell commands, DDE, file open
+ CCommandLineInfo cmdInfo;
+ ParseCommandLine(cmdInfo);
+ // Dispatch commands specified on the command line. Will return FALSE if
+ // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
+ if (!ProcessShellCommand(cmdInfo))
+ return FALSE;
+ // The main window has been initialized, so show and update it
+ pMainFrame->ShowWindow(m_nCmdShow);
+ pMainFrame->UpdateWindow();
+ return TRUE;
+}
+
+
+
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ enum { IDD = IDD_ABOUTBOX };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+// Implementation
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+// App command to run the dialog
+void Cmfc1App::OnAppAbout()
+{
+ CAboutDlg aboutDlg;
+ aboutDlg.DoModal();
+}
+
+
+// Cmfc1App message handlers
diff --git a/Tests/MFC/mfc1/mfc1.h b/Tests/MFC/mfc1/mfc1.h
new file mode 100644
index 0000000..c273601
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1.h
@@ -0,0 +1,31 @@
+// mfc1.h : main header file for the mfc1 application
+//
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// Cmfc1App:
+// See mfc1.cpp for the implementation of this class
+//
+
+class Cmfc1App : public CWinApp
+{
+public:
+ Cmfc1App();
+
+
+// Overrides
+public:
+ virtual BOOL InitInstance();
+
+// Implementation
+ afx_msg void OnAppAbout();
+ DECLARE_MESSAGE_MAP()
+};
+
+extern Cmfc1App theApp;
diff --git a/Tests/MFC/mfc1/mfc1.rc b/Tests/MFC/mfc1/mfc1.rc
new file mode 100644
index 0000000..346c5fb
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1.rc
@@ -0,0 +1,393 @@
+//Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\mfc1.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#include ""afxprint.rc"" // printing/print preview resources\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+IDR_MAINFRAME ICON "res\\mfc1.ico"
+IDR_mfc1TYPE ICON "res\\mfc1Doc.ico"
+#endif
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Toolbar
+//
+
+IDR_MAINFRAME TOOLBAR 16, 15
+BEGIN
+ BUTTON ID_FILE_NEW
+ BUTTON ID_FILE_OPEN
+ BUTTON ID_FILE_SAVE
+ SEPARATOR
+ BUTTON ID_EDIT_CUT
+ BUTTON ID_EDIT_COPY
+ BUTTON ID_EDIT_PASTE
+ SEPARATOR
+ BUTTON ID_FILE_PRINT
+ BUTTON ID_APP_ABOUT
+END
+
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MAINFRAME MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&New\tCtrl+N", ID_FILE_NEW
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM SEPARATOR
+ MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
+ MENUITEM SEPARATOR
+ MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "&Close", ID_FILE_CLOSE
+ MENUITEM "E&xit", ID_APP_EXIT
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
+ MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&About mfc1...", ID_APP_ABOUT
+ END
+END
+IDR_mfc1TYPE MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&New\tCtrl+N", ID_FILE_NEW
+ MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
+ MENUITEM "&Close", ID_FILE_CLOSE
+ MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
+ MENUITEM "Save &As...", ID_FILE_SAVE_AS
+ MENUITEM SEPARATOR
+ MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
+ MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
+ MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
+ MENUITEM SEPARATOR
+ MENUITEM "Recent File", ID_FILE_MRU_FILE1,GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", ID_APP_EXIT
+ END
+ POPUP "&Edit"
+ BEGIN
+ MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
+ MENUITEM SEPARATOR
+ MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
+ MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
+ MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
+ MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
+ END
+ POPUP "&Window"
+ BEGIN
+ MENUITEM "&New Window", ID_WINDOW_NEW
+ MENUITEM "&Cascade", ID_WINDOW_CASCADE
+ MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
+ MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&About mfc1...", ID_APP_ABOUT
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_MAINFRAME ACCELERATORS
+BEGIN
+ "N", ID_FILE_NEW, VIRTKEY,CONTROL
+ "O", ID_FILE_OPEN, VIRTKEY,CONTROL
+ "S", ID_FILE_SAVE, VIRTKEY,CONTROL
+ "P", ID_FILE_PRINT, VIRTKEY,CONTROL
+ "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL
+ "X", ID_EDIT_CUT, VIRTKEY,CONTROL
+ "C", ID_EDIT_COPY, VIRTKEY,CONTROL
+ "V", ID_EDIT_PASTE, VIRTKEY,CONTROL
+ VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT
+ VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT
+ VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL
+ VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT
+ VK_F6, ID_NEXT_PANE, VIRTKEY
+ VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT
+END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+#if _MSC_VER < 1300
+#define DS_SHELLFONT_FLAG 0
+#else
+#define DS_SHELLFONT_FLAG DS_SHELLFONT
+#endif
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
+CAPTION "About mfc1"
+STYLE DS_MODALFRAME | DS_SHELLFONT_FLAG | WS_POPUP | WS_CAPTION | WS_SYSMENU
+FONT 8, "MS Shell Dlg"
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
+ LTEXT "mfc1 Version 1.0",IDC_STATIC,40,10,119,8,
+ SS_NOPREFIX
+ LTEXT "Copyright (C) 2011",IDC_STATIC,40,25,119,8
+ DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "TODO: <Company name>"
+ VALUE "FileDescription", "TODO: <File description>"
+ VALUE "FileVersion", "1.0.0.1"
+ VALUE "InternalName", "mfc1.exe"
+ VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved."
+ VALUE "OriginalFilename","mfc1.exe"
+ VALUE "ProductName", "TODO: <Product name>"
+ VALUE "ProductVersion", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 1252
+ END
+END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 228
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 48
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+// Non-mac-targeting apps remove the two extra substrings
+ IDR_MAINFRAME "mfc1"
+ // has a file suffix - shell file type too
+ IDR_mfc1TYPE "\nmfc1\nmfc1\nmfc1 Files (*.mf1)\n.mf1\nmfc1.Document\nmfc1.Document"
+END
+STRINGTABLE
+BEGIN
+ AFX_IDS_APP_TITLE "mfc1"
+ AFX_IDS_IDLEMESSAGE "Ready"
+END
+STRINGTABLE
+BEGIN
+ ID_INDICATOR_EXT "EXT"
+ ID_INDICATOR_CAPS "CAP"
+ ID_INDICATOR_NUM "NUM"
+ ID_INDICATOR_SCRL "SCRL"
+ ID_INDICATOR_OVR "OVR"
+ ID_INDICATOR_REC "REC"
+END
+STRINGTABLE
+BEGIN
+ ID_FILE_NEW "Create a new document\nNew"
+ ID_FILE_OPEN "Open an existing document\nOpen"
+ ID_FILE_CLOSE "Close the active document\nClose"
+ ID_FILE_SAVE "Save the active document\nSave"
+ ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
+ ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
+ ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
+ ID_FILE_PRINT "Print the active document\nPrint"
+ ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
+ ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
+ ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
+ ID_FILE_MRU_FILE1 "Open this document"
+ ID_FILE_MRU_FILE2 "Open this document"
+ ID_FILE_MRU_FILE3 "Open this document"
+ ID_FILE_MRU_FILE4 "Open this document"
+ ID_FILE_MRU_FILE5 "Open this document"
+ ID_FILE_MRU_FILE6 "Open this document"
+ ID_FILE_MRU_FILE7 "Open this document"
+ ID_FILE_MRU_FILE8 "Open this document"
+ ID_FILE_MRU_FILE9 "Open this document"
+ ID_FILE_MRU_FILE10 "Open this document"
+ ID_FILE_MRU_FILE11 "Open this document"
+ ID_FILE_MRU_FILE12 "Open this document"
+ ID_FILE_MRU_FILE13 "Open this document"
+ ID_FILE_MRU_FILE14 "Open this document"
+ ID_FILE_MRU_FILE15 "Open this document"
+ ID_FILE_MRU_FILE16 "Open this document"
+ ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
+ ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
+ ID_WINDOW_NEW "Open another window for the active document\nNew Window"
+ ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
+ ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
+ ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
+ ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
+ ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
+ ID_EDIT_CLEAR "Erase the selection\nErase"
+ ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
+ ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
+ ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
+ ID_EDIT_FIND "Find the specified text\nFind"
+ ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
+ ID_EDIT_REPEAT "Repeat the last action\nRepeat"
+ ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
+ ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
+ ID_EDIT_UNDO "Undo the last action\nUndo"
+ ID_EDIT_REDO "Redo the previously undone action\nRedo"
+ ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
+ ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
+END
+
+STRINGTABLE
+BEGIN
+ AFX_IDS_SCSIZE "Change the window size"
+ AFX_IDS_SCMOVE "Change the window position"
+ AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
+ AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
+ AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
+ AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
+ AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
+ AFX_IDS_SCRESTORE "Restore the window to normal size"
+ AFX_IDS_SCTASKLIST "Activate Task List"
+ AFX_IDS_MDICHILD "Activate this window"
+ AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
+END
+
+#endif
+
+#ifdef _UNICODE
+IDR_MANIFEST RT_MANIFEST "res\\mfc1.manifest"
+#endif
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\\mfc1.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#include "afxprint.rc" // printing/print preview resources
+#endif
+#endif // not APSTUDIO_INVOKED
diff --git a/Tests/MFC/mfc1/mfc1.reg b/Tests/MFC/mfc1/mfc1.reg
new file mode 100644
index 0000000..9f3a86f
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1.reg
@@ -0,0 +1,13 @@
+REGEDIT
+; This .REG file may be used by your SETUP program.
+; If a SETUP program is not available, the entries below will be
+; registered in your InitInstance automatically with a call to
+; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.
+
+HKEY_CLASSES_ROOT\.mf1 = mfc1.Document
+HKEY_CLASSES_ROOT\mfc1.Document\shell\open\command = mfc1.EXE %1
+HKEY_CLASSES_ROOT\mfc1.Document\shell\open\ddeexec = [open("%1")]
+HKEY_CLASSES_ROOT\mfc1.Document\shell\open\ddeexec\application = mfc1
+ ; note: the application is optional
+ ; (it defaults to the app name in "command")
+HKEY_CLASSES_ROOT\mfc1.Document = mfc1.Document
diff --git a/Tests/MFC/mfc1/mfc1.sln b/Tests/MFC/mfc1/mfc1.sln
new file mode 100644
index 0000000..78bbe56
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mfc1", "mfc1.vcproj", "{06C08100-1145-4104-AEC3-6BC8C608B819}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Debug.ActiveCfg = Debug|Win32
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Debug.Build.0 = Debug|Win32
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Release.ActiveCfg = Release|Win32
+ {06C08100-1145-4104-AEC3-6BC8C608B819}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/Tests/MFC/mfc1/mfc1.vcproj b/Tests/MFC/mfc1/mfc1.vcproj
new file mode 100644
index 0000000..6df86e5
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1.vcproj
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="mfc1"
+ ProjectGUID="{06C08100-1145-4104-AEC3-6BC8C608B819}"
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\ChildFrm.cpp">
+ </File>
+ <File
+ RelativePath=".\MainFrm.cpp">
+ </File>
+ <File
+ RelativePath=".\mfc1.cpp">
+ </File>
+ <File
+ RelativePath=".\mfc1Doc.cpp">
+ </File>
+ <File
+ RelativePath=".\mfc1View.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\ChildFrm.h">
+ </File>
+ <File
+ RelativePath=".\MainFrm.h">
+ </File>
+ <File
+ RelativePath=".\mfc1.h">
+ </File>
+ <File
+ RelativePath=".\mfc1Doc.h">
+ </File>
+ <File
+ RelativePath=".\mfc1View.h">
+ </File>
+ <File
+ RelativePath=".\Resource.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ <File
+ RelativePath=".\res\mfc1.ico">
+ </File>
+ <File
+ RelativePath=".\mfc1.rc">
+ </File>
+ <File
+ RelativePath=".\res\mfc1.rc2">
+ </File>
+ <File
+ RelativePath=".\res\mfc1Doc.ico">
+ </File>
+ <File
+ RelativePath=".\res\Toolbar.bmp">
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\res\mfc1.manifest">
+ </File>
+ <File
+ RelativePath=".\mfc1.reg">
+ </File>
+ <File
+ RelativePath=".\ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Tests/MFC/mfc1/mfc1Doc.cpp b/Tests/MFC/mfc1/mfc1Doc.cpp
new file mode 100644
index 0000000..8767052
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1Doc.cpp
@@ -0,0 +1,78 @@
+// mfc1Doc.cpp : implementation of the Cmfc1Doc class
+//
+
+#include "stdafx.h"
+#include "mfc1.h"
+
+#include "mfc1Doc.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// Cmfc1Doc
+
+IMPLEMENT_DYNCREATE(Cmfc1Doc, CDocument)
+
+BEGIN_MESSAGE_MAP(Cmfc1Doc, CDocument)
+END_MESSAGE_MAP()
+
+
+// Cmfc1Doc construction/destruction
+
+Cmfc1Doc::Cmfc1Doc()
+{
+ // TODO: add one-time construction code here
+
+}
+
+Cmfc1Doc::~Cmfc1Doc()
+{
+}
+
+BOOL Cmfc1Doc::OnNewDocument()
+{
+ if (!CDocument::OnNewDocument())
+ return FALSE;
+
+ // TODO: add reinitialization code here
+ // (SDI documents will reuse this document)
+
+ return TRUE;
+}
+
+
+
+
+// Cmfc1Doc serialization
+
+void Cmfc1Doc::Serialize(CArchive& ar)
+{
+ if (ar.IsStoring())
+ {
+ // TODO: add storing code here
+ }
+ else
+ {
+ // TODO: add loading code here
+ }
+}
+
+
+// Cmfc1Doc diagnostics
+
+#ifdef _DEBUG
+void Cmfc1Doc::AssertValid() const
+{
+ CDocument::AssertValid();
+}
+
+void Cmfc1Doc::Dump(CDumpContext& dc) const
+{
+ CDocument::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// Cmfc1Doc commands
diff --git a/Tests/MFC/mfc1/mfc1Doc.h b/Tests/MFC/mfc1/mfc1Doc.h
new file mode 100644
index 0000000..92d8e35
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1Doc.h
@@ -0,0 +1,37 @@
+// mfc1Doc.h : interface of the Cmfc1Doc class
+//
+
+
+#pragma once
+
+class Cmfc1Doc : public CDocument
+{
+protected: // create from serialization only
+ Cmfc1Doc();
+ DECLARE_DYNCREATE(Cmfc1Doc)
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+ public:
+ virtual BOOL OnNewDocument();
+ virtual void Serialize(CArchive& ar);
+
+// Implementation
+public:
+ virtual ~Cmfc1Doc();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// Generated message map functions
+protected:
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/Tests/MFC/mfc1/mfc1View.cpp b/Tests/MFC/mfc1/mfc1View.cpp
new file mode 100644
index 0000000..06c7652
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1View.cpp
@@ -0,0 +1,99 @@
+// mfc1View.cpp : implementation of the Cmfc1View class
+//
+
+#include "stdafx.h"
+#include "mfc1.h"
+
+#include "mfc1Doc.h"
+#include "mfc1View.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// Cmfc1View
+
+IMPLEMENT_DYNCREATE(Cmfc1View, CView)
+
+BEGIN_MESSAGE_MAP(Cmfc1View, CView)
+ // Standard printing commands
+ ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
+ ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
+ ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
+END_MESSAGE_MAP()
+
+// Cmfc1View construction/destruction
+
+Cmfc1View::Cmfc1View()
+{
+ // TODO: add construction code here
+
+}
+
+Cmfc1View::~Cmfc1View()
+{
+}
+
+BOOL Cmfc1View::PreCreateWindow(CREATESTRUCT& cs)
+{
+ // TODO: Modify the Window class or styles here by modifying
+ // the CREATESTRUCT cs
+
+ return CView::PreCreateWindow(cs);
+}
+
+// Cmfc1View drawing
+
+void Cmfc1View::OnDraw(CDC* /*pDC*/)
+{
+ Cmfc1Doc* pDoc = GetDocument();
+ ASSERT_VALID(pDoc);
+ if (!pDoc)
+ return;
+
+ // TODO: add draw code for native data here
+}
+
+
+// Cmfc1View printing
+
+BOOL Cmfc1View::OnPreparePrinting(CPrintInfo* pInfo)
+{
+ // default preparation
+ return DoPreparePrinting(pInfo);
+}
+
+void Cmfc1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+ // TODO: add extra initialization before printing
+}
+
+void Cmfc1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+ // TODO: add cleanup after printing
+}
+
+
+// Cmfc1View diagnostics
+
+#ifdef _DEBUG
+void Cmfc1View::AssertValid() const
+{
+ CView::AssertValid();
+}
+
+void Cmfc1View::Dump(CDumpContext& dc) const
+{
+ CView::Dump(dc);
+}
+
+Cmfc1Doc* Cmfc1View::GetDocument() const // non-debug version is inline
+{
+ ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cmfc1Doc)));
+ return (Cmfc1Doc*)m_pDocument;
+}
+#endif //_DEBUG
+
+
+// Cmfc1View message handlers
diff --git a/Tests/MFC/mfc1/mfc1View.h b/Tests/MFC/mfc1/mfc1View.h
new file mode 100644
index 0000000..4244653
--- /dev/null
+++ b/Tests/MFC/mfc1/mfc1View.h
@@ -0,0 +1,48 @@
+// mfc1View.h : interface of the Cmfc1View class
+//
+
+
+#pragma once
+
+
+class Cmfc1View : public CView
+{
+protected: // create from serialization only
+ Cmfc1View();
+ DECLARE_DYNCREATE(Cmfc1View)
+
+// Attributes
+public:
+ Cmfc1Doc* GetDocument() const;
+
+// Operations
+public:
+
+// Overrides
+ public:
+ virtual void OnDraw(CDC* pDC); // overridden to draw this view
+virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+protected:
+ virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
+ virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
+ virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
+
+// Implementation
+public:
+ virtual ~Cmfc1View();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// Generated message map functions
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+#ifndef _DEBUG // debug version in mfc1View.cpp
+inline Cmfc1Doc* Cmfc1View::GetDocument() const
+ { return reinterpret_cast<Cmfc1Doc*>(m_pDocument); }
+#endif
diff --git a/Tests/MFC/mfc1/res/Toolbar.bmp b/Tests/MFC/mfc1/res/Toolbar.bmp
new file mode 100644
index 0000000..d501723
--- /dev/null
+++ b/Tests/MFC/mfc1/res/Toolbar.bmp
Binary files differ
diff --git a/Tests/MFC/mfc1/res/mfc1.ico b/Tests/MFC/mfc1/res/mfc1.ico
new file mode 100644
index 0000000..8a84ca3
--- /dev/null
+++ b/Tests/MFC/mfc1/res/mfc1.ico
Binary files differ
diff --git a/Tests/MFC/mfc1/res/mfc1.manifest b/Tests/MFC/mfc1/res/mfc1.manifest
new file mode 100644
index 0000000..b15d2f2
--- /dev/null
+++ b/Tests/MFC/mfc1/res/mfc1.manifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="X86"
+ name="Microsoft.Windows.mfc1"
+ type="win32"
+/>
+<description>Your app description here</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/Tests/MFC/mfc1/res/mfc1.rc2 b/Tests/MFC/mfc1/res/mfc1.rc2
new file mode 100644
index 0000000..62a3ab0
--- /dev/null
+++ b/Tests/MFC/mfc1/res/mfc1.rc2
@@ -0,0 +1,13 @@
+//
+// mfc1.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Tests/MFC/mfc1/res/mfc1Doc.ico b/Tests/MFC/mfc1/res/mfc1Doc.ico
new file mode 100644
index 0000000..2a1f1ae
--- /dev/null
+++ b/Tests/MFC/mfc1/res/mfc1Doc.ico
Binary files differ
diff --git a/Tests/MFC/mfc1/stdafx.cpp b/Tests/MFC/mfc1/stdafx.cpp
new file mode 100644
index 0000000..67fd1b5
--- /dev/null
+++ b/Tests/MFC/mfc1/stdafx.cpp
@@ -0,0 +1,5 @@
+// stdafx.cpp : source file that includes just the standard includes
+// mfc1.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
diff --git a/Tests/MFC/mfc1/stdafx.h b/Tests/MFC/mfc1/stdafx.h
new file mode 100644
index 0000000..35a678d
--- /dev/null
+++ b/Tests/MFC/mfc1/stdafx.h
@@ -0,0 +1,56 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// See http://msdn.microsoft.com/en-us/library/6sehtctf.aspx for more info
+// on WINVER and _WIN32_WINNT
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#if _MSC_VER < 1600
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#else
+#define WINVER 0x0501 // Target Windows XP and later with VS 10 and later
+#endif
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#if _MSC_VER < 1600
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#else
+#define _WIN32_WINNT 0x0501 // Target Windows XP and later with VS 10 and later
+#endif
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#if _MSC_VER < 1600
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#if _MSC_VER < 1600
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxdisp.h> // MFC Automation classes
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 01f6bea..ebfb4f5 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -13,7 +13,7 @@ add_definitions(-DFOO)
# create an executable and a library target, both requiring automoc:
add_library(codeeditorLib STATIC codeeditor.cpp)
-add_executable(foo main.cpp calwidget.cpp foo.cpp)
+add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp private_slot.cpp)
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
diff --git a/Tests/QtAutomoc/abc.cpp b/Tests/QtAutomoc/abc.cpp
new file mode 100644
index 0000000..4bbc769
--- /dev/null
+++ b/Tests/QtAutomoc/abc.cpp
@@ -0,0 +1,49 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 "abc.h"
+#include "abc_p.h"
+
+#include <stdio.h>
+
+class PrintAbc : public QObject
+{
+ Q_OBJECT
+ public:
+ PrintAbc():QObject() {}
+ public slots:
+ void print() const { printf("abc\n"); }
+};
+
+Abc::Abc()
+:QObject()
+{
+}
+
+
+void Abc::doAbc()
+{
+ PrintAbc pa;
+ pa.print();
+ AbcP abcP;
+ abcP.doAbcP();
+}
+
+// check that including the moc file for the cpp file and the header works:
+#include "abc.moc"
+#include "moc_abc.cpp"
+#include "moc_abc_p.cpp"
+
+// check that including a moc file from another header works:
+#include "moc_xyz.cpp"
diff --git a/Tests/QtAutomoc/abc.h b/Tests/QtAutomoc/abc.h
new file mode 100644
index 0000000..d1924b0
--- /dev/null
+++ b/Tests/QtAutomoc/abc.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 ABC_H
+#define ABC_H
+
+#include <QObject>
+
+class Abc : public QObject
+{
+ Q_OBJECT
+ public:
+ Abc();
+ public slots:
+ void doAbc();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/abc_p.h b/Tests/QtAutomoc/abc_p.h
new file mode 100644
index 0000000..952fff3
--- /dev/null
+++ b/Tests/QtAutomoc/abc_p.h
@@ -0,0 +1,30 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 ABC_P_H
+#define ABC_P_H
+
+#include <QObject>
+
+#include <stdio.h>
+
+class AbcP : public QObject
+{
+ Q_OBJECT
+ public:
+ AbcP() {}
+ public slots:
+ void doAbcP() { printf("I am private abc !\n"); }
+};
+
+#endif
diff --git a/Tests/QtAutomoc/bar.cpp b/Tests/QtAutomoc/bar.cpp
new file mode 100644
index 0000000..8be4815
--- /dev/null
+++ b/Tests/QtAutomoc/bar.cpp
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 "sub/bar.h"
+
+#include <stdio.h>
+
+Bar::Bar()
+:QObject()
+{
+}
+
+void Bar::doBar()
+{
+ printf("Hello bar !\n");
+}
+
+#include "sub/moc_bar.cpp"
diff --git a/Tests/QtAutomoc/blub.cpp b/Tests/QtAutomoc/blub.cpp
new file mode 100644
index 0000000..bd53972
--- /dev/null
+++ b/Tests/QtAutomoc/blub.cpp
@@ -0,0 +1,40 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 "blub.h"
+
+#include <stdio.h>
+
+class BlubBlub : public QObject
+{
+ Q_OBJECT
+ public:
+ BlubBlub():QObject() {}
+ public slots:
+ int getValue() const { return 13; }
+};
+
+Blub::Blub()
+{
+}
+
+
+void Blub::blubber()
+{
+ BlubBlub bb;
+ printf("Blub blub %d ! \n", bb.getValue());
+}
+
+// test the case that the wrong moc-file is included, it should
+// actually be "blub.moc"
+#include "moc_blub.cpp"
diff --git a/Tests/QtAutomoc/blub.h b/Tests/QtAutomoc/blub.h
new file mode 100644
index 0000000..1967bc1
--- /dev/null
+++ b/Tests/QtAutomoc/blub.h
@@ -0,0 +1,26 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 BLUB_H
+#define BLUB_H
+
+#include <QObject>
+
+class Blub
+{
+ public:
+ Blub();
+ void blubber();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutomoc/main.cpp
index b7cfb41..738f677 100644
--- a/Tests/QtAutomoc/main.cpp
+++ b/Tests/QtAutomoc/main.cpp
@@ -43,6 +43,11 @@
#include "codeeditor.h"
#include "calwidget.h"
#include "foo.h"
+#include "blub.h"
+#include "sub/bar.h"
+#include "abc.h"
+#include "xyz.h"
+#include "yaf.h"
int main(int argv, char **args)
{
@@ -58,5 +63,20 @@ int main(int argv, char **args)
Foo foo;
foo.doFoo();
+ Blub b;
+ b.blubber();
+
+ Bar bar;
+ bar.doBar();
+
+ Abc abc;
+ abc.doAbc();
+
+ Xyz xyz;
+ xyz.doXyz();
+
+ Yaf yaf;
+ yaf.doYaf();
+
return app.exec();
}
diff --git a/Tests/QtAutomoc/private_slot.cpp b/Tests/QtAutomoc/private_slot.cpp
new file mode 100644
index 0000000..1387a70
--- /dev/null
+++ b/Tests/QtAutomoc/private_slot.cpp
@@ -0,0 +1,21 @@
+
+#include "private_slot.h"
+
+class PrivateSlotPrivate
+{
+public:
+
+ void privateSlot()
+ {
+
+ }
+};
+
+PrivateSlot::PrivateSlot(QObject *parent)
+ : QObject(parent),
+ d(new PrivateSlotPrivate)
+{
+
+}
+
+#include "private_slot.moc"
diff --git a/Tests/QtAutomoc/private_slot.h b/Tests/QtAutomoc/private_slot.h
new file mode 100644
index 0000000..28e5448
--- /dev/null
+++ b/Tests/QtAutomoc/private_slot.h
@@ -0,0 +1,20 @@
+
+#ifndef PRIVATE_SLOT_H
+#define PRIVATE_SLOT_H
+
+#include <QObject>
+
+class PrivateSlotPrivate;
+
+class PrivateSlot : public QObject
+{
+ Q_OBJECT
+public:
+ PrivateSlot(QObject *parent = 0);
+
+private:
+ PrivateSlotPrivate * const d;
+ Q_PRIVATE_SLOT(d, void privateSlot())
+};
+
+#endif
diff --git a/Tests/QtAutomoc/sub/bar.h b/Tests/QtAutomoc/sub/bar.h
new file mode 100644
index 0000000..db56b8e
--- /dev/null
+++ b/Tests/QtAutomoc/sub/bar.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 BAR_H
+#define BAR_H
+
+#include <QObject>
+
+class Bar : public QObject
+{
+ Q_OBJECT
+ public:
+ Bar();
+ public slots:
+ void doBar();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/xyz.cpp b/Tests/QtAutomoc/xyz.cpp
new file mode 100644
index 0000000..a3562a3
--- /dev/null
+++ b/Tests/QtAutomoc/xyz.cpp
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 "xyz.h"
+
+#include <stdio.h>
+
+Xyz::Xyz()
+:QObject()
+{
+}
+
+
+void Xyz::doXyz()
+{
+ printf("This is xyz !\n");
+}
diff --git a/Tests/QtAutomoc/xyz.h b/Tests/QtAutomoc/xyz.h
new file mode 100644
index 0000000..8175d37
--- /dev/null
+++ b/Tests/QtAutomoc/xyz.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 XYZ_H
+#define XYZ_H
+
+#include <QObject>
+
+class Xyz : public QObject
+{
+ Q_OBJECT
+ public:
+ Xyz();
+ public slots:
+ void doXyz();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/yaf.cpp b/Tests/QtAutomoc/yaf.cpp
new file mode 100644
index 0000000..d278ab4
--- /dev/null
+++ b/Tests/QtAutomoc/yaf.cpp
@@ -0,0 +1,32 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 "yaf.h"
+#include "yaf_p.h"
+
+#include <stdio.h>
+
+Yaf::Yaf()
+{
+}
+
+
+void Yaf::doYaf()
+{
+ YafP yafP;
+ yafP.doYafP();
+}
+
+// check that including a moc file from a private header the wrong way works:
+#include "yaf_p.moc"
diff --git a/Tests/QtAutomoc/yaf.h b/Tests/QtAutomoc/yaf.h
new file mode 100644
index 0000000..8689f83
--- /dev/null
+++ b/Tests/QtAutomoc/yaf.h
@@ -0,0 +1,25 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 YAF_H
+#define YAF_H
+
+class Yaf
+{
+ public:
+ Yaf();
+ public:
+ void doYaf();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/yaf_p.h b/Tests/QtAutomoc/yaf_p.h
new file mode 100644
index 0000000..f0368ad
--- /dev/null
+++ b/Tests/QtAutomoc/yaf_p.h
@@ -0,0 +1,30 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ 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 YAF_P_H
+#define YAF_P_H
+
+#include <QObject>
+
+#include <stdio.h>
+
+class YafP : public QObject
+{
+ Q_OBJECT
+ public:
+ YafP() {}
+ public slots:
+ void doYafP() { printf("I am yet another file !\n"); }
+};
+
+#endif
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index 564db9f..378b529 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -173,6 +173,12 @@ ELSE(STAGE2)
TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4)
SET(install_target SimpleInstall)
+ SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
+ # Disable VERSION test until it is implemented in the Xcode generator.
+ IF(NOT XCODE)
+ SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
+ ENDIF(NOT XCODE)
+
# Make sure the test executable can run from the install tree.
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
@@ -293,11 +299,6 @@ ELSE(STAGE2)
ADDITIONAL_MAKE_CLEAN_FILES
"${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
- SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
- # Disable VERSION test until it is implemented in the Xcode generator.
- IF(NOT XCODE)
- SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
- ENDIF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index 564db9f..378b529 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -173,6 +173,12 @@ ELSE(STAGE2)
TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4)
SET(install_target SimpleInstall)
+ SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
+ # Disable VERSION test until it is implemented in the Xcode generator.
+ IF(NOT XCODE)
+ SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
+ ENDIF(NOT XCODE)
+
# Make sure the test executable can run from the install tree.
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
@@ -293,11 +299,6 @@ ELSE(STAGE2)
ADDITIONAL_MAKE_CLEAN_FILES
"${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
- SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
- # Disable VERSION test until it is implemented in the Xcode generator.
- IF(NOT XCODE)
- SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
- ENDIF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in
new file mode 100644
index 0000000..e95a4ff
--- /dev/null
+++ b/Utilities/KWIML/ABI.h.in
@@ -0,0 +1,466 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 Kitware, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Kitware, Inc. nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+============================================================================*/
+#ifndef @KWIML@_ABI_H
+#define @KWIML@_ABI_H
+/*
+This header defines macros with information about the C ABI.
+Only information that can be determined using the preprocessor at
+compilation time is available. No try-compile results may be added
+here. Instead we memorize results on platforms of interest.
+
+An includer may optionally define the following macros to suppress errors:
+
+ @KWIML@_ABI_NO_VERIFY = skip verification declarations
+ @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown
+ @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown
+ @KWIML@_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown
+
+An includer may test the following macros after inclusion:
+
+ @KWIML@_ABI_SIZEOF_DATA_PTR = sizeof(void*)
+ @KWIML@_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void))
+ @KWIML@_ABI_SIZEOF_FLOAT = sizeof(float)
+ @KWIML@_ABI_SIZEOF_DOUBLE = sizeof(double)
+ @KWIML@_ABI_SIZEOF_CHAR = sizeof(char)
+ @KWIML@_ABI_SIZEOF_SHORT = sizeof(short)
+ @KWIML@_ABI_SIZEOF_INT = sizeof(int)
+ @KWIML@_ABI_SIZEOF_LONG = sizeof(long)
+
+ @KWIML@_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type
+ Undefined if existence is unknown and error suppression macro
+ @KWIML@_ABI_NO_ERROR_LONG_LONG was defined.
+
+ @KWIML@_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not
+ Undefined if existence is unknown.
+
+ @KWIML@_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type)
+ Undefined otherwise.
+ @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type)
+ Undefined otherwise.
+ @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type
+ Undefined otherwise.
+
+ @KWIML@_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined
+ @KWIML@_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined
+ One of these is defined unless signedness of 'char' is unknown and
+ error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined.
+
+ @KWIML@_ABI_ENDIAN_ID_BIG = id for big-endian (always defined)
+ @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined)
+ @KWIML@_ABI_ENDIAN_ID = id of byte order of target CPU
+ Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE
+ unless byte order is unknown and error suppression macro
+ @KWIML@_ABI_NO_ERROR_ENDIAN was defined.
+
+We verify most results using dummy "extern" declarations that are
+invalid if the macros are wrong. Verification is disabled if
+suppression macro @KWIML@_ABI_NO_VERIFY was defined.
+*/
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR)
+# if defined(__SIZEOF_POINTER__)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__
+# elif defined(_SIZE_PTR)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3)
+# elif defined(_LP64) || defined(__LP64__)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(_ILP32)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 4
+# elif defined(__64BIT__) /* IBM XL */
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(_M_X64)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(__ia64)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(__sparcv9)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(__x86_64) || defined(__x86_64__)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(__amd64) || defined(__amd64__)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 8
+# elif defined(__i386) || defined(__i386__)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 4
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR)
+# define @KWIML@_ABI_SIZEOF_DATA_PTR 4
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR)
+# define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_CHAR)
+# define @KWIML@_ABI_SIZEOF_CHAR 1
+#endif
+
+#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED)
+# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */
+# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
+# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */
+# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
+# elif defined(_CHAR_SIGNED) /* IBM XL, others? */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */
+# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
+# elif defined(__GNUC__) /* GNU default */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */
+# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
+# elif defined(__PGIC__) /* PGI default */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(_MSC_VER) /* MSVC default */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# elif defined(__WATCOMC__) /* Watcom default */
+# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
+# elif defined(__BORLANDC__) /* Borland default */
+# define @KWIML@_ABI_CHAR_IS_SIGNED 1
+# endif
+#endif
+#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \
+ && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN)
+# error "Signedness of 'char' unknown."
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_SHORT)
+# if defined(__SIZEOF_SHORT__)
+# define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_SHORT)
+# define @KWIML@_ABI_SIZEOF_SHORT 2
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_INT)
+# if defined(__SIZEOF_INT__)
+# define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__
+# elif defined(_SIZE_INT)
+# define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3)
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_INT)
+# define @KWIML@_ABI_SIZEOF_INT 4
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_LONG)
+# if defined(__SIZEOF_LONG__)
+# define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__
+# elif defined(_SIZE_LONG)
+# define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3)
+# elif defined(__LONG_MAX__)
+# if __LONG_MAX__ == 0x7fffffff
+# define @KWIML@_ABI_SIZEOF_LONG 4
+# elif __LONG_MAX__>>32 == 0x7fffffff
+# define @KWIML@_ABI_SIZEOF_LONG 8
+# endif
+# elif defined(_MSC_VER) /* MSVC and Intel on Windows */
+# define @KWIML@_ABI_SIZEOF_LONG 4
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_LONG)
+# define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG)
+# if defined(__SIZEOF_LONG_LONG__)
+# define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
+# elif defined(__LONG_LONG_MAX__)
+# if __LONG_LONG_MAX__ == 0x7fffffff
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 4
+# elif __LONG_LONG_MAX__>>32 == 0x7fffffff
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# endif
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG)
+# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \
+ && !defined(_MSC_VER)
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__NO_LONG_LONG) /* EDG */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 0
+# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__PGIC__) /* PGI */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__WATCOMC__) /* Watcom */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__INTEL_COMPILER) /* Intel */
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# elif defined(__BORLANDC__) /* Borland */
+# if __BORLANDC__ >= 0x0560
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# else
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 0
+# endif
+# elif defined(_MSC_VER) /* Microsoft */
+# if _MSC_VER >= 1310
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 8
+# else
+# define @KWIML@_ABI_SIZEOF_LONG_LONG 0
+# endif
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG)
+# error "Existence of 'long long' unknown."
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF___INT64)
+# if defined(__INTEL_COMPILER)
+# define @KWIML@_ABI_SIZEOF___INT64 8
+# elif defined(_MSC_VER)
+# define @KWIML@_ABI_SIZEOF___INT64 8
+# elif defined(__BORLANDC__)
+# define @KWIML@_ABI_SIZEOF___INT64 8
+# else
+# define @KWIML@_ABI_SIZEOF___INT64 0
+# endif
+#endif
+
+#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
+# if @KWIML@_ABI_SIZEOF_LONG == 8
+# define @KWIML@_ABI___INT64_IS_LONG 1
+# elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
+# define @KWIML@_ABI___INT64_IS_LONG_LONG 1
+# else
+# define @KWIML@_ABI___INT64_IS_UNIQUE 1
+# endif
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_FLOAT)
+# if defined(__SIZEOF_FLOAT__)
+# define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_FLOAT)
+# define @KWIML@_ABI_SIZEOF_FLOAT 4
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE)
+# if defined(__SIZEOF_DOUBLE__)
+# define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__
+# endif
+#endif
+#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE)
+# define @KWIML@_ABI_SIZEOF_DOUBLE 8
+#endif
+
+/*--------------------------------------------------------------------------*/
+/* Identify possible endian cases. The macro @KWIML@_ABI_ENDIAN_ID will be
+ defined to one of these, or undefined if unknown. */
+#if !defined(@KWIML@_ABI_ENDIAN_ID_BIG)
+# define @KWIML@_ABI_ENDIAN_ID_BIG 4321
+#endif
+#if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE)
+# define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234
+#endif
+#if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE
+# error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE"
+#endif
+
+#if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */
+
+/* Use dedicated symbols if the compiler defines them. Do this first
+ because some architectures allow runtime byte order selection by
+ the operating system (values for such architectures below are
+ guesses for compilers that do not define a dedicated symbol).
+ Ensure that only one is defined in case the platform or a header
+ defines both as possible values for some third symbol. */
+#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+
+/* Alpha */
+#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+
+/* Arm */
+#elif defined(__arm__)
+# if !defined(__ARMEB__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+# else
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+# endif
+
+/* Intel x86 */
+#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+#elif defined(__MWERKS__) && defined(__INTEL__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+
+/* Intel x86-64 */
+#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+#elif defined(__amd64) || defined(__amd64__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+
+/* Intel Architecture-64 (Itanium) */
+#elif defined(__ia64) || defined(__ia64__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
+
+/* PowerPC */
+#elif defined(__powerpc) || defined(__powerpc__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* SPARC */
+#elif defined(__sparc) || defined(__sparc__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* HP/PA RISC */
+#elif defined(__hppa) || defined(__hppa__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* Motorola 68k */
+#elif defined(__m68k__) || defined(M68000)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* MIPS */
+#elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* RS/6000 */
+#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* System/370 */
+#elif defined(__370__) || defined(__THW_370__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* System/390 */
+#elif defined(__s390__) || defined(__s390x__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* z/Architecture */
+#elif defined(__SYSC_ZARCH__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
+/* Unknown CPU */
+#elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN)
+# error "Byte order of target CPU unknown."
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_ABI_NO_VERIFY)
+#define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y]
+#define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*)
+#if defined(__cplusplus)
+# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*)
+#else
+# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */
+#endif
+#define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3)
+#define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t))
+#define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y)
+#define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y)
+
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*);
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int));
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char);
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short);
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int);
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long);
+#if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long);
+#endif
+#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64);
+#endif
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float);
+@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double);
+
+#if defined(@KWIML@_ABI___INT64_IS_LONG)
+@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long);
+#elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG)
+@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long);
+#elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
+@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long);
+# if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0
+@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long);
+# endif
+#endif
+
+#if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED)
+@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0);
+#elif defined(@KWIML@_ABI_CHAR_IS_SIGNED)
+@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED, (char)0x80 < 0);
+#endif
+
+#undef @KWIML@_ABI__VERIFY_DIFF
+#undef @KWIML@_ABI__VERIFY_SAME
+#undef @KWIML@_ABI__VERIFY_SIZE
+#undef @KWIML@_ABI__VERIFY_BOOL
+#undef @KWIML@_ABI__VERIFY3
+#undef @KWIML@_ABI__VERIFY2
+#undef @KWIML@_ABI__VERIFY
+
+#endif
+
+#endif
diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt
new file mode 100644
index 0000000..6a8641a
--- /dev/null
+++ b/Utilities/KWIML/CMakeLists.txt
@@ -0,0 +1,79 @@
+#=============================================================================
+# Kitware Information Macro Library
+# Copyright 2010-2011 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.
+#=============================================================================
+
+# Import the KWIML directory tree into a subdirectory under a parent
+# project and configure the library as follows:
+#
+# SET(KWIML myIML)
+# SUBDIRS(KWIML)
+#
+# Optional settings are as follows:
+#
+# KWIML_HEADER_ROOT = build tree directory to hold KWIML headers.
+# Headers will go in a directory called "${KWIML}" under this root.
+# For example:
+#
+# SET(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR})
+# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
+#
+# KWIML_INSTALL_INCLUDE_DIR = install KWIML with "make install"
+# Specify a value relative to the install prefix and do NOT start with '/'.
+# KWIML_INSTALL_INCLUDE_OPTIONS = extra header installation options
+# Specify options for the install(FILES) command.
+#
+# KWIML_LABELS_TEST = list of labels for KWIML tests
+
+cmake_minimum_required(VERSION 2.6.3 FATAL_ERROR)
+
+#-----------------------------------------------------------------------------
+if(NOT DEFINED KWIML)
+ if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ message(FATAL_ERROR "Set KWIML namespace in parent directory!")
+ endif()
+ set(KWIML KWIML)
+ set(KWIML_STANDALONE 1)
+ project(KWIML)
+ include(CTest)
+ mark_as_advanced(BUILD_TESTING)
+endif()
+
+#-----------------------------------------------------------------------------
+get_property(KWIML_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach(lang ${KWIML_LANGUAGES})
+ set(KWIML_LANGUAGE_${lang} 1)
+endforeach()
+if(NOT KWIML_LANGUAGE_C AND NOT KWIML_LANGUAGE_CXX)
+ set(BUILD_TESTING OFF)
+endif()
+
+#-----------------------------------------------------------------------------
+if(NOT KWIML_HEADER_ROOT)
+ set(KWIML_HEADER_ROOT "${PROJECT_BINARY_DIR}")
+endif()
+set(KWIML_HEADER_DIR "${KWIML_HEADER_ROOT}/${KWIML}")
+include_directories(${KWIML_HEADER_ROOT})
+
+#-----------------------------------------------------------------------------
+foreach(h ABI INT)
+ set(header ${KWIML_HEADER_DIR}/${h}.h)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${h}.h.in ${header} @ONLY)
+ if(KWIML_INSTALL_INCLUDE_DIR)
+ install(FILES ${header}
+ DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML}
+ ${KWIML_INSTALL_INCLUDE_OPTIONS})
+ endif()
+endforeach()
+
+#-----------------------------------------------------------------------------
+if(BUILD_TESTING)
+ add_subdirectory(test)
+endif()
diff --git a/Utilities/KWIML/Copyright.txt b/Utilities/KWIML/Copyright.txt
new file mode 100644
index 0000000..c1e5ebc
--- /dev/null
+++ b/Utilities/KWIML/Copyright.txt
@@ -0,0 +1,30 @@
+Kitware Information Macro Library
+Copyright 2010-2011 Kitware, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+* Neither the name of Kitware, Inc. nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in
new file mode 100644
index 0000000..3c1f05d
--- /dev/null
+++ b/Utilities/KWIML/INT.h.in
@@ -0,0 +1,736 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 Kitware, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Kitware, Inc. nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+============================================================================*/
+#ifndef @KWIML@_INT_H
+#define @KWIML@_INT_H
+/*
+This header defines macros with information about sized integer types.
+Only information that can be determined using the preprocessor at
+compilation time is available. No try-compile results may be added
+here. Instead we memorize results on platforms of interest.
+
+An includer may optionally define the following macros to suppress errors:
+
+Input:
+ @KWIML@_INT_NO_VERIFY = skip verification declarations
+ @KWIML@_INT_NO_ERROR_INT64_T = type '@KWIML@_INT_int64_t' is optional (*)
+ @KWIML@_INT_NO_ERROR_UINT64_T = type '@KWIML@_INT_uint64_t' is optional (*)
+ @KWIML@_INT_NO_ERROR_INTPTR_T = type '@KWIML@_INT_intptr_t' is optional (*)
+ @KWIML@_INT_NO_ERROR_UINTPTR_T = type '@KWIML@_INT_uintptr_t' is optional (*)
+
+An includer may optionally define the following macros to override defaults.
+Either way, an includer may test these macros after inclusion:
+
+ @KWIML@_INT_HAVE_STDINT_H = include <stdint.h>
+ @KWIML@_INT_NO_STDINT_H = do not include <stdint.h>
+ @KWIML@_INT_HAVE_INTTYPES_H = include <inttypes.h>
+ @KWIML@_INT_NO_INTTYPES_H = do not include <inttypes.h>
+
+An includer may test the following macros after inclusion:
+
+ @KWIML@_INT_HAVE_INT#_T = type 'int#_t' is available
+ @KWIML@_INT_HAVE_UINT#_T = type 'uint#_t' is available
+ # = 8, 16, 32, 64, PTR
+
+ @KWIML@_INT_int#_t = signed integer type exactly # bits wide
+ @KWIML@_INT_uint#_t = unsigned integer type exactly # bits wide
+ # = 8, 16, 32, 64 (*), ptr (*)
+
+ @KWIML@_INT_NO_INT64_T = type '@KWIML@_INT_int64_t' not available
+ @KWIML@_INT_NO_UINT64_T = type '@KWIML@_INT_uint64_t' not available
+ @KWIML@_INT_NO_INTPTR_T = type '@KWIML@_INT_intptr_t' not available
+ @KWIML@_INT_NO_UINTPTR_T = type '@KWIML@_INT_uintptr_t' not available
+
+ @KWIML@_INT_INT#_C(c) = signed integer constant at least # bits wide
+ @KWIML@_INT_UINT#_C(c) = unsigned integer constant at least # bits wide
+ # = 8, 16, 32, 64 (*)
+
+ @KWIML@_INT_<fmt># = print or scan format, <fmt> in table below
+ # = 8, 16, 32, 64, PTR (*)
+
+ signed unsigned
+ ----------- ------------------------------
+ | decimal | decimal octal hexadecimal |
+ print | PRId PRIi | PRIu PRIo PRIx PRIX |
+ scan | SCNd SCNi | SCNu SCNo SCNx |
+ ----------- ------------------------------
+
+ The SCN*8 and SCN*64 format macros will not be defined on systems
+ with scanf implementations known not to support them.
+
+ @KWIML@_INT_BROKEN_INT64_C = macro INT64_C is incorrect if defined
+ @KWIML@_INT_BROKEN_UINT64_C = macro UINT64_C is incorrect if defined
+ Some compilers define integer constant macros incorrectly and
+ cannot handle literals as large as the integer type.
+
+ @KWIML@_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect
+ Some compilers have a flag to make 'char' (un)signed but do not account
+ for it while defining int8_t in the non-default case.
+
+ The broken cases do not affect correctness of the macros documented above.
+*/
+
+#include "ABI.h"
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_STDINT_H) /* Already defined. */
+#elif defined(@KWIML@_INT_NO_STDINT_H) /* Already defined. */
+#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */
+# define @KWIML@_INT_HAVE_STDINT_H 1
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# define @KWIML@_INT_HAVE_STDINT_H 1
+#elif defined(_MSC_VER) /* MSVC */
+# if _MSC_VER >= 1600
+# define @KWIML@_INT_HAVE_STDINT_H 1
+# else
+# define @KWIML@_INT_NO_STDINT_H 1
+# endif
+#elif defined(__BORLANDC__) /* Borland */
+# if __BORLANDC__ >= 0x560
+# define @KWIML@_INT_HAVE_STDINT_H 1
+# else
+# define @KWIML@_INT_NO_STDINT_H 1
+# endif
+#elif defined(__WATCOMC__) /* Watcom */
+# define @KWIML@_INT_NO_STDINT_H 1
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_INTTYPES_H) /* Already defined. */
+#elif defined(@KWIML@_INT_NO_INTTYPES_H) /* Already defined. */
+#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */
+# define @KWIML@_INT_HAVE_INTTYPES_H 1
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# define @KWIML@_INT_HAVE_INTTYPES_H 1
+#elif defined(_MSC_VER) /* MSVC */
+# define @KWIML@_INT_NO_INTTYPES_H 1
+#elif defined(__BORLANDC__) /* Borland */
+# define @KWIML@_INT_NO_INTTYPES_H 1
+#elif defined(__WATCOMC__) /* Watcom */
+# define @KWIML@_INT_NO_INTTYPES_H 1
+#else /* Assume it exists. */
+# define @KWIML@_INT_HAVE_INTTYPES_H 1
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_STDINT_H) && defined(@KWIML@_INT_NO_STDINT_H)
+# error "Both @KWIML@_INT_HAVE_STDINT_H and @KWIML@_INT_NO_STDINT_H defined!"
+#endif
+#if defined(@KWIML@_INT_HAVE_INTTYPES_H) && defined(@KWIML@_INT_NO_INTTYPES_H)
+# error "Both @KWIML@_INT_HAVE_INTTYPES_H and @KWIML@_INT_NO_INTTYPES_H defined!"
+#endif
+
+#if defined(@KWIML@_INT_HAVE_STDINT_H)
+# include <stdint.h>
+#endif
+#if defined(@KWIML@_INT_HAVE_INTTYPES_H)
+# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
+# define __STDC_FORMAT_MACROS
+# endif
+# include <inttypes.h>
+#endif
+
+#if defined(@KWIML@_INT_HAVE_STDINT_H) || defined(@KWIML@_INT_HAVE_INTTYPES_H)
+#define @KWIML@_INT_HAVE_INT8_T 1
+#define @KWIML@_INT_HAVE_UINT8_T 1
+#define @KWIML@_INT_HAVE_INT16_T 1
+#define @KWIML@_INT_HAVE_UINT16_T 1
+#define @KWIML@_INT_HAVE_INT32_T 1
+#define @KWIML@_INT_HAVE_UINT32_T 1
+#define @KWIML@_INT_HAVE_INT64_T 1
+#define @KWIML@_INT_HAVE_UINT64_T 1
+#define @KWIML@_INT_HAVE_INTPTR_T 1
+#define @KWIML@_INT_HAVE_UINTPTR_T 1
+#endif
+
+#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED)
+# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */
+#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED)
+# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_INT8_T) && !defined(@KWIML@_INT_BROKEN_INT8_T)
+# define @KWIML@_INT_int8_t int8_t
+#else
+# define @KWIML@_INT_int8_t signed char
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T)
+# define @KWIML@_INT_uint8_t uint8_t
+#else
+# define @KWIML@_INT_uint8_t unsigned char
+#endif
+
+#if defined(__INTEL_COMPILER)
+# if defined(_WIN32)
+# define @KWIML@_INT__NO_SCN8
+# endif
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# define @KWIML@_INT__NO_SCN8
+#elif defined(__HP_cc) || defined(__HP_aCC)
+# define @KWIML@_INT__NO_SCN8
+#elif defined(__BORLANDC__)
+# define @KWIML@_INT__NO_SCN8
+# define @KWIML@_INT__NO_SCN64
+#elif defined(_MSC_VER)
+# define @KWIML@_INT__NO_SCN8
+#elif defined(__WATCOMC__)
+# define @KWIML@_INT__NO_SCN8
+#endif
+
+/* 8-bit d, i */
+#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8)
+# define @KWIML@_INT_PRId8 PRId8
+#else
+# define @KWIML@_INT_PRId8 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8)
+# define @KWIML@_INT_SCNd8 SCNd8
+#elif !defined(@KWIML@_INT__NO_SCN8)
+# define @KWIML@_INT_SCNd8 "hhd"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8)
+# define @KWIML@_INT_PRIi8 PRIi8
+#else
+# define @KWIML@_INT_PRIi8 "i"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8)
+# define @KWIML@_INT_SCNi8 SCNi8
+#elif !defined(@KWIML@_INT__NO_SCN8)
+# define @KWIML@_INT_SCNi8 "hhi"
+#endif
+
+/* 8-bit o, u, x, X */
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8)
+# define @KWIML@_INT_PRIo8 PRIo8
+#else
+# define @KWIML@_INT_PRIo8 "o"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8)
+# define @KWIML@_INT_SCNo8 SCNo8
+#elif !defined(@KWIML@_INT__NO_SCN8)
+# define @KWIML@_INT_SCNo8 "hho"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8)
+# define @KWIML@_INT_PRIu8 PRIu8
+#else
+# define @KWIML@_INT_PRIu8 "u"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8)
+# define @KWIML@_INT_SCNu8 SCNu8
+#elif !defined(@KWIML@_INT__NO_SCN8)
+# define @KWIML@_INT_SCNu8 "hhu"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8)
+# define @KWIML@_INT_PRIx8 PRIx8
+#else
+# define @KWIML@_INT_PRIx8 "x"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8)
+# define @KWIML@_INT_SCNx8 SCNx8
+#elif !defined(@KWIML@_INT__NO_SCN8)
+# define @KWIML@_INT_SCNx8 "hhx"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8)
+# define @KWIML@_INT_PRIX8 PRIX8
+#else
+# define @KWIML@_INT_PRIX8 "X"
+#endif
+
+/* 8-bit constants */
+#if defined(INT8_C)
+# define @KWIML@_INT_INT8_C(c) INT8_C(c)
+#else
+# define @KWIML@_INT_INT8_C(c) c
+#endif
+#if defined(UINT8_C)
+# define @KWIML@_INT_UINT8_C(c) UINT8_C(c)
+#else
+# define @KWIML@_INT_UINT8_C(c) c ## u
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_INT16_T)
+# define @KWIML@_INT_int16_t int16_t
+#else
+# define @KWIML@_INT_int16_t signed short
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T)
+# define @KWIML@_INT_uint16_t uint16_t
+#else
+# define @KWIML@_INT_uint16_t unsigned short
+#endif
+
+/* 16-bit d, i */
+#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16)
+# define @KWIML@_INT_PRId16 PRId16
+#else
+# define @KWIML@_INT_PRId16 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16)
+# define @KWIML@_INT_SCNd16 SCNd16
+#else
+# define @KWIML@_INT_SCNd16 "hd"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16)
+# define @KWIML@_INT_PRIi16 PRIi16
+#else
+# define @KWIML@_INT_PRIi16 "i"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16)
+# define @KWIML@_INT_SCNi16 SCNi16
+#else
+# define @KWIML@_INT_SCNi16 "hi"
+#endif
+
+/* 16-bit o, u, x, X */
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16)
+# define @KWIML@_INT_PRIo16 PRIo16
+#else
+# define @KWIML@_INT_PRIo16 "o"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16)
+# define @KWIML@_INT_SCNo16 SCNo16
+#else
+# define @KWIML@_INT_SCNo16 "ho"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16)
+# define @KWIML@_INT_PRIu16 PRIu16
+#else
+# define @KWIML@_INT_PRIu16 "u"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16)
+# define @KWIML@_INT_SCNu16 SCNu16
+#else
+# define @KWIML@_INT_SCNu16 "hu"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16)
+# define @KWIML@_INT_PRIx16 PRIx16
+#else
+# define @KWIML@_INT_PRIx16 "x"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16)
+# define @KWIML@_INT_SCNx16 SCNx16
+#else
+# define @KWIML@_INT_SCNx16 "hx"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16)
+# define @KWIML@_INT_PRIX16 PRIX16
+#else
+# define @KWIML@_INT_PRIX16 "X"
+#endif
+
+/* 16-bit constants */
+#if defined(INT16_C)
+# define @KWIML@_INT_INT16_C(c) INT16_C(c)
+#else
+# define @KWIML@_INT_INT16_C(c) c
+#endif
+#if defined(UINT16_C)
+# define @KWIML@_INT_UINT16_C(c) UINT16_C(c)
+#else
+# define @KWIML@_INT_UINT16_C(c) c ## u
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_INT32_T)
+# define @KWIML@_INT_int32_t int32_t
+#else
+# define @KWIML@_INT_int32_t signed int
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T)
+# define @KWIML@_INT_uint32_t uint32_t
+#else
+# define @KWIML@_INT_uint32_t unsigned int
+#endif
+
+/* 32-bit d, i */
+#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32)
+# define @KWIML@_INT_PRId32 PRId32
+#else
+# define @KWIML@_INT_PRId32 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32)
+# define @KWIML@_INT_SCNd32 SCNd32
+#else
+# define @KWIML@_INT_SCNd32 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32)
+# define @KWIML@_INT_PRIi32 PRIi32
+#else
+# define @KWIML@_INT_PRIi32 "i"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32)
+# define @KWIML@_INT_SCNi32 SCNi32
+#else
+# define @KWIML@_INT_SCNi32 "i"
+#endif
+
+/* 32-bit o, u, x, X */
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32)
+# define @KWIML@_INT_PRIo32 PRIo32
+#else
+# define @KWIML@_INT_PRIo32 "o"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32)
+# define @KWIML@_INT_SCNo32 SCNo32
+#else
+# define @KWIML@_INT_SCNo32 "o"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32)
+# define @KWIML@_INT_PRIu32 PRIu32
+#else
+# define @KWIML@_INT_PRIu32 "u"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32)
+# define @KWIML@_INT_SCNu32 SCNu32
+#else
+# define @KWIML@_INT_SCNu32 "u"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32)
+# define @KWIML@_INT_PRIx32 PRIx32
+#else
+# define @KWIML@_INT_PRIx32 "x"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32)
+# define @KWIML@_INT_SCNx32 SCNx32
+#else
+# define @KWIML@_INT_SCNx32 "x"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32)
+# define @KWIML@_INT_PRIX32 PRIX32
+#else
+# define @KWIML@_INT_PRIX32 "X"
+#endif
+
+/* 32-bit constants */
+#if defined(INT32_C)
+# define @KWIML@_INT_INT32_C(c) INT32_C(c)
+#else
+# define @KWIML@_INT_INT32_C(c) c
+#endif
+#if defined(UINT32_C)
+# define @KWIML@_INT_UINT32_C(c) UINT32_C(c)
+#else
+# define @KWIML@_INT_UINT32_C(c) c ## u
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_INT64_T)
+# define @KWIML@_INT_int64_t int64_t
+#elif @KWIML@_ABI_SIZEOF_LONG == 8
+# define @KWIML@_INT_int64_t signed long
+#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
+# define @KWIML@_INT_int64_t signed long long
+#elif defined(@KWIML@_ABI_SIZEOF___INT64)
+# define @KWIML@_INT_int64_t signed __int64
+#elif defined(@KWIML@_INT_NO_ERROR_INT64_T)
+# define @KWIML@_INT_NO_INT64_T
+#else
+# error "No type known for 'int64_t'."
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T)
+# define @KWIML@_INT_uint64_t uint64_t
+#elif @KWIML@_ABI_SIZEOF_LONG == 8
+# define @KWIML@_INT_uint64_t unsigned long
+#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
+# define @KWIML@_INT_uint64_t unsigned long long
+#elif defined(@KWIML@_ABI_SIZEOF___INT64)
+# define @KWIML@_INT_uint64_t unsigned __int64
+#elif defined(@KWIML@_INT_NO_ERROR_UINT64_T)
+# define @KWIML@_INT_NO_UINT64_T
+#else
+# error "No type known for 'uint64_t'."
+#endif
+
+#if defined(__INTEL_COMPILER)
+#elif defined(__BORLANDC__)
+# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */
+# define @KWIML@_INT_BROKEN_INT64_C /* system macro defined incorrectly */
+# define @KWIML@_INT_BROKEN_UINT64_C /* system macro defined incorrectly */
+#elif defined(_MSC_VER) && _MSC_VER < 1400
+# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */
+#endif
+
+#if @KWIML@_ABI_SIZEOF_LONG == 8
+# define @KWIML@_INT__FMT64 "l"
+#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
+# if !defined(@KWIML@_INT__NO_FMTLL)
+# define @KWIML@_INT__FMT64 "ll"
+# else
+# define @KWIML@_INT__FMT64 "I64"
+# endif
+#elif defined(@KWIML@_ABI_SIZEOF___INT64)
+# if defined(__BORLANDC__)
+# define @KWIML@_INT__FMT64 "L"
+# else
+# define @KWIML@_INT__FMT64 "I64"
+# endif
+#endif
+
+/* 64-bit d, i */
+#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64)
+# define @KWIML@_INT_PRId64 PRId64
+#elif defined(@KWIML@_INT__FMT64)
+# define @KWIML@_INT_PRId64 @KWIML@_INT__FMT64 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64)
+# define @KWIML@_INT_SCNd64 SCNd64
+#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64)
+# define @KWIML@_INT_SCNd64 @KWIML@_INT__FMT64 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64)
+# define @KWIML@_INT_PRIi64 PRIi64
+#elif defined(@KWIML@_INT__FMT64)
+# define @KWIML@_INT_PRIi64 @KWIML@_INT__FMT64 "d"
+#endif
+#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64)
+# define @KWIML@_INT_SCNi64 SCNi64
+#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64)
+# define @KWIML@_INT_SCNi64 @KWIML@_INT__FMT64 "d"
+#endif
+
+/* 64-bit o, u, x, X */
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64)
+# define @KWIML@_INT_PRIo64 PRIo64
+#elif defined(@KWIML@_INT__FMT64)
+# define @KWIML@_INT_PRIo64 @KWIML@_INT__FMT64 "o"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64)
+# define @KWIML@_INT_SCNo64 SCNo64
+#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64)
+# define @KWIML@_INT_SCNo64 @KWIML@_INT__FMT64 "o"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64)
+# define @KWIML@_INT_PRIu64 PRIu64
+#elif defined(@KWIML@_INT__FMT64)
+# define @KWIML@_INT_PRIu64 @KWIML@_INT__FMT64 "u"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64)
+# define @KWIML@_INT_SCNu64 SCNu64
+#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64)
+# define @KWIML@_INT_SCNu64 @KWIML@_INT__FMT64 "u"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64)
+# define @KWIML@_INT_PRIx64 PRIx64
+#elif defined(@KWIML@_INT__FMT64)
+# define @KWIML@_INT_PRIx64 @KWIML@_INT__FMT64 "x"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64)
+# define @KWIML@_INT_SCNx64 SCNx64
+#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64)
+# define @KWIML@_INT_SCNx64 @KWIML@_INT__FMT64 "x"
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64)
+# define @KWIML@_INT_PRIX64 PRIX64
+#elif defined(@KWIML@_INT__FMT64)
+# define @KWIML@_INT_PRIX64 @KWIML@_INT__FMT64 "X"
+#endif
+
+/* 64-bit constants */
+#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(INT64_C) \
+ && !defined(@KWIML@_INT_BROKEN_INT64_C)
+# define @KWIML@_INT_INT64_C(c) INT64_C(c)
+#elif @KWIML@_ABI_SIZEOF_LONG == 8
+# define @KWIML@_INT_INT64_C(c) c ## l
+#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
+# define @KWIML@_INT_INT64_C(c) c ## ll
+#elif defined(@KWIML@_ABI_SIZEOF___INT64)
+# define @KWIML@_INT_INT64_C(c) c ## i64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(UINT64_C) \
+ && !defined(@KWIML@_INT_BROKEN_UINT64_C)
+# define @KWIML@_INT_UINT64_C(c) UINT64_C(c)
+#elif @KWIML@_ABI_SIZEOF_LONG == 8
+# define @KWIML@_INT_UINT64_C(c) c ## ul
+#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
+# define @KWIML@_INT_UINT64_C(c) c ## ull
+#elif defined(@KWIML@_ABI_SIZEOF___INT64)
+# define @KWIML@_INT_UINT64_C(c) c ## ui64
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if defined(@KWIML@_INT_HAVE_INTPTR_T)
+# define @KWIML@_INT_intptr_t intptr_t
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_intptr_t @KWIML@_INT_int32_t
+#elif !defined(@KWIML@_INT_NO_INT64_T)
+# define @KWIML@_INT_intptr_t @KWIML@_INT_int64_t
+#elif defined(@KWIML@_INT_NO_ERROR_INTPTR_T)
+# define @KWIML@_INT_NO_INTPTR_T
+#else
+# error "No type known for 'intptr_t'."
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T)
+# define @KWIML@_INT_uintptr_t uintptr_t
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint32_t
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint64_t
+#elif defined(@KWIML@_INT_NO_ERROR_UINTPTR_T)
+# define @KWIML@_INT_NO_UINTPTR_T
+#else
+# error "No type known for 'uintptr_t'."
+#endif
+
+#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR)
+# define @KWIML@_INT_PRIdPTR PRIdPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId64
+#endif
+#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR)
+# define @KWIML@_INT_SCNdPTR SCNdPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd64
+#endif
+#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR)
+# define @KWIML@_INT_PRIiPTR PRIiPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi64
+#endif
+#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR)
+# define @KWIML@_INT_SCNiPTR SCNiPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi64
+#endif
+
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR)
+# define @KWIML@_INT_PRIoPTR PRIoPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR)
+# define @KWIML@_INT_SCNoPTR SCNoPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR)
+# define @KWIML@_INT_PRIuPTR PRIuPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR)
+# define @KWIML@_INT_SCNuPTR SCNuPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR)
+# define @KWIML@_INT_PRIxPTR PRIxPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR)
+# define @KWIML@_INT_SCNxPTR SCNxPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx64
+#endif
+#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR)
+# define @KWIML@_INT_PRIXPTR PRIXPTR
+#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX32
+#elif !defined(@KWIML@_INT_NO_UINT64_T)
+# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX64
+#endif
+
+/*--------------------------------------------------------------------------*/
+#if !defined(@KWIML@_INT_NO_VERIFY)
+#define @KWIML@_INT__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y]
+#define @KWIML@_INT__VERIFY_BOOL(m, b) @KWIML@_INT__VERIFY(m##__VERIFY__, 2, (b)?2:3)
+#define @KWIML@_INT__VERIFY_TYPE(t, s) @KWIML@_INT__VERIFY(t##__VERIFY__, s, sizeof(t))
+#define @KWIML@_INT__VERIFY_SIGN(t, u, o) @KWIML@_INT__VERIFY_BOOL(t##__SIGN, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0)
+
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int8_t, 1);
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint8_t, 1);
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int16_t, 2);
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint16_t, 2);
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int32_t, 4);
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint32_t, 4);
+#if !defined(@KWIML@_INT_NO_INT64_T)
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int64_t, 8);
+#endif
+#if !defined(@KWIML@_INT_NO_UINT64_T)
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint64_t, 8);
+#endif
+#if !defined(@KWIML@_INT_NO_INTPTR_T)
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_intptr_t, sizeof(void*));
+#endif
+#if !defined(@KWIML@_INT_NO_UINTPTR_T)
+@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uintptr_t, sizeof(void*));
+#endif
+
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int8_t, @KWIML@_INT_uint8_t, <);
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint8_t, @KWIML@_INT_uint8_t, >);
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int16_t, @KWIML@_INT_uint16_t, <);
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint16_t, @KWIML@_INT_uint16_t, >);
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int32_t, @KWIML@_INT_uint32_t, <);
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint32_t, @KWIML@_INT_uint32_t, >);
+#if !defined(@KWIML@_INT_NO_INT64_T)
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int64_t, @KWIML@_INT_uint64_t, <);
+#endif
+#if !defined(@KWIML@_INT_NO_UINT64_T)
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint64_t, @KWIML@_INT_uint64_t, >);
+#endif
+#if !defined(@KWIML@_INT_NO_INTPTR_T)
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_intptr_t, @KWIML@_INT_uintptr_t, <);
+#endif
+#if !defined(@KWIML@_INT_NO_UINTPTR_T)
+@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uintptr_t, @KWIML@_INT_uintptr_t, >);
+#endif
+
+#undef @KWIML@_INT__VERIFY_SIGN
+#undef @KWIML@_INT__VERIFY_TYPE
+#undef @KWIML@_INT__VERIFY_BOOL
+#undef @KWIML@_INT__VERIFY
+
+#endif
+
+#endif
diff --git a/Utilities/KWIML/README.txt b/Utilities/KWIML/README.txt
new file mode 100644
index 0000000..6bdf859
--- /dev/null
+++ b/Utilities/KWIML/README.txt
@@ -0,0 +1,29 @@
+KWIML - The Kitware Information Macro Library
+
+KWIML provides header files that use preprocessor tests to detect and
+provide information about the compiler and its target architecture. The
+headers contain no configuration-time test results and thus may be
+installed into an architecture-independent include directory. This
+makes them suitable for use in the public interface of any package.
+
+This source tree is intended for distribution inside the source trees of
+other packages. In order to avoid name collisions among multiple
+packages the KWIML headers are configured with a per-package prefix on
+both the header locations and the macros they define. See comments in
+CMakeLists.txt for instructions to include KWIML inside another project.
+
+The entire KWIML source tree is distributed under the OSI-approved
+3-clause BSD License. Files used only for build and test purposes
+contain a copyright notice and reference Copyright.txt for details.
+Headers meant for installation and distribution outside the source tree
+come with full inlined copies of the copyright notice and license text.
+This makes them suitable for distribution with any package under
+compatible license terms.
+
+The following components are provided. See header comments for details:
+
+ ABI.h = Fundamental type size and representation
+ INT.h = Fixed-size integer types and format specifiers
+
+The "test" subdirectory builds tests that verify correctness of the
+information provided by each header.
diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt
new file mode 100644
index 0000000..a2359cc
--- /dev/null
+++ b/Utilities/KWIML/test/CMakeLists.txt
@@ -0,0 +1,70 @@
+#=============================================================================
+# Kitware Information Macro Library
+# Copyright 2010-2011 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.
+#=============================================================================
+
+set(test_defs KWIML_NAMESPACE=${KWIML})
+
+# Tell CMake how to follow dependencies of sources in this directory.
+set_property(DIRECTORY
+ PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
+ "KWIML_HEADER(%)=<${KWIML}/%>"
+ )
+
+# Suppress printf/scanf format warnings; we test if the sizes match.
+foreach(lang C CXX)
+ if(KWIML_LANGUAGE_${lang} AND "${CMAKE_${lang}_COMPILER_ID}" STREQUAL GNU)
+ set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format")
+ endif()
+endforeach()
+
+if(KWIML_LANGUAGE_C)
+ set(test_srcs test.c)
+else()
+ set(test_srcs test.cxx)
+endif()
+if(KWIML_LANGUAGE_C)
+ list(APPEND test_defs KWIML_LANGUAGE_C)
+ list(APPEND test_srcs
+ test_ABI_C.c
+ test_INT_C.c
+ test_include_C.c
+ )
+endif()
+if(KWIML_LANGUAGE_CXX)
+ list(APPEND test_defs KWIML_LANGUAGE_CXX)
+ list(APPEND test_srcs
+ test_ABI_CXX.cxx
+ test_INT_CXX.cxx
+ test_include_CXX.cxx
+ )
+endif()
+
+foreach(th test_ABI_endian test_INT_format)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${th}.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${th}.h @ONLY)
+endforeach()
+include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
+add_executable(${KWIML}_test ${test_srcs})
+set_property(TARGET ${KWIML}_test PROPERTY COMPILE_DEFINITIONS ${test_defs})
+set_property(TARGET ${KWIML}_test PROPERTY
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test)
+set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST})
+
+# Xcode 2.x forgets to create the output directory before linking
+# the individual architectures.
+if(CMAKE_OSX_ARCHITECTURES AND XCODE
+ AND NOT "${XCODE_VERSION}" MATCHES "^[^12]")
+ add_custom_command(
+ TARGET ${KWIML}_test
+ PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}"
+ )
+endif()
diff --git a/Utilities/KWIML/test/test.c b/Utilities/KWIML/test/test.c
new file mode 100644
index 0000000..131c81f
--- /dev/null
+++ b/Utilities/KWIML/test/test.c
@@ -0,0 +1,39 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int test_ABI_C(void);
+extern int test_INT_C(void);
+extern int test_ABI_CXX(void);
+extern int test_INT_CXX(void);
+extern int test_include_C(void);
+extern int test_include_CXX(void);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+int main(void)
+{
+ int result = 1;
+#ifdef KWIML_LANGUAGE_C
+ result = test_ABI_C() && result;
+ result = test_INT_C() && result;
+ result = test_include_C() && result;
+#endif
+#ifdef KWIML_LANGUAGE_CXX
+ result = test_ABI_CXX() && result;
+ result = test_INT_CXX() && result;
+ result = test_include_CXX() && result;
+#endif
+ return result? 0 : 1;
+}
diff --git a/Utilities/KWIML/test/test.cxx b/Utilities/KWIML/test/test.cxx
new file mode 100644
index 0000000..bf61421
--- /dev/null
+++ b/Utilities/KWIML/test/test.cxx
@@ -0,0 +1,12 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include "test.c"
diff --git a/Utilities/KWIML/test/test.h b/Utilities/KWIML/test/test.h
new file mode 100644
index 0000000..b87a0e7
--- /dev/null
+++ b/Utilities/KWIML/test/test.h
@@ -0,0 +1,37 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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 KWIML_NAMESPACE
+# error "Do not include test.h outside of KWIML test files."
+#endif
+
+#ifndef KWIML_TEST_H
+#define KWIML_TEST_H
+
+/*
+ Define KWIML_HEADER macro to help the test files include kwiml
+ headers from the configured namespace directory. The macro can be
+ used like this:
+
+ #include KWIML_HEADER(ABI.h)
+*/
+#define KWIML_HEADER(x) KWIML_HEADER0(KWIML_NAMESPACE/x)
+#define KWIML_HEADER0(x) KWIML_HEADER1(x)
+#define KWIML_HEADER1(x) <x>
+
+/* Quiet MS standard library deprecation warnings. */
+#ifndef _CRT_SECURE_NO_DEPRECATE
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+#else
+# error "test.h included multiple times."
+#endif
diff --git a/Utilities/KWIML/test/test_ABI_C.c b/Utilities/KWIML/test/test_ABI_C.c
new file mode 100644
index 0000000..3ca4ad3
--- /dev/null
+++ b/Utilities/KWIML/test/test_ABI_C.c
@@ -0,0 +1,22 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include "test.h"
+#include KWIML_HEADER(ABI.h)
+#include "test_ABI_endian.h"
+int test_ABI_C(void)
+{
+ if(!test_ABI_endian())
+ {
+ return 0;
+ }
+ return 1;
+}
diff --git a/Utilities/KWIML/test/test_ABI_CXX.cxx b/Utilities/KWIML/test/test_ABI_CXX.cxx
new file mode 100644
index 0000000..7ede20e
--- /dev/null
+++ b/Utilities/KWIML/test/test_ABI_CXX.cxx
@@ -0,0 +1,22 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include "test.h"
+#include KWIML_HEADER(ABI.h)
+#include "test_ABI_endian.h"
+extern "C" int test_ABI_CXX(void)
+{
+ if(!test_ABI_endian())
+ {
+ return 0;
+ }
+ return 1;
+}
diff --git a/Utilities/KWIML/test/test_ABI_endian.h.in b/Utilities/KWIML/test/test_ABI_endian.h.in
new file mode 100644
index 0000000..992baea
--- /dev/null
+++ b/Utilities/KWIML/test/test_ABI_endian.h.in
@@ -0,0 +1,47 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include <stdio.h>
+
+#ifdef __cplusplus
+# define LANG "C++ "
+#else
+# define LANG "C "
+#endif
+
+static int test_ABI_endian(void)
+{
+ int result = 1;
+ {
+#if defined(@KWIML@_ABI_ENDIAN_ID)
+ int expect;
+ union { short s; unsigned char c[sizeof(short)]; } x;
+ x.s = 1;
+ expect = (x.c[0] == 1 ?
+ @KWIML@_ABI_ENDIAN_ID_LITTLE : @KWIML@_ABI_ENDIAN_ID_BIG);
+ printf(LANG "@KWIML@_ABI_ENDIAN_ID: expected [%d], got [%d]",
+ expect, @KWIML@_ABI_ENDIAN_ID);
+ if(@KWIML@_ABI_ENDIAN_ID == expect)
+ {
+ printf(", PASSED\n");
+ }
+ else
+ {
+ printf(", FAILED\n");
+ result = 0;
+ }
+#else
+ printf(LANG "@KWIML@_ABI_ENDIAN_ID: unknown, FAILED\n");
+ result = 0;
+#endif
+ }
+ return result;
+}
diff --git a/Utilities/KWIML/test/test_INT_C.c b/Utilities/KWIML/test/test_INT_C.c
new file mode 100644
index 0000000..5513a0b
--- /dev/null
+++ b/Utilities/KWIML/test/test_INT_C.c
@@ -0,0 +1,22 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include "test.h"
+#include KWIML_HEADER(INT.h)
+#include "test_INT_format.h"
+int test_INT_C(void)
+{
+ if(!test_INT_format())
+ {
+ return 0;
+ }
+ return 1;
+}
diff --git a/Utilities/KWIML/test/test_INT_CXX.cxx b/Utilities/KWIML/test/test_INT_CXX.cxx
new file mode 100644
index 0000000..9f74e96
--- /dev/null
+++ b/Utilities/KWIML/test/test_INT_CXX.cxx
@@ -0,0 +1,22 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include "test.h"
+#include KWIML_HEADER(INT.h)
+#include "test_INT_format.h"
+extern "C" int test_INT_CXX(void)
+{
+ if(!test_INT_format())
+ {
+ return 0;
+ }
+ return 1;
+}
diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_INT_format.h.in
new file mode 100644
index 0000000..72a62f2
--- /dev/null
+++ b/Utilities/KWIML/test/test_INT_format.h.in
@@ -0,0 +1,188 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include <stdio.h>
+#include <string.h>
+
+#ifdef __cplusplus
+# define LANG "C++ "
+#else
+# define LANG "C "
+#endif
+
+#define VALUE(T, U) \
+ (@KWIML@_INT_##T)((@KWIML@_INT_##U)0xab << \
+ ((sizeof(@KWIML@_INT_##T)-1)<<3)) \
+
+#define TEST_C(C, V, PRI, T, U) \
+ { \
+ @KWIML@_INT_##T const x = VALUE(T, U); \
+ @KWIML@_INT_##T y = @KWIML@_INT_##C(V); \
+ printf(LANG "@KWIML@_INT_" #C ":" \
+ " expression [%"@KWIML@_INT_PRI##PRI"]," \
+ " literal [%"@KWIML@_INT_PRI##PRI"]", x, y); \
+ if(x == y) \
+ { \
+ printf(", PASSED\n"); \
+ } \
+ else \
+ { \
+ printf(", FAILED\n"); \
+ result = 0; \
+ } \
+ }
+
+#define TEST_PRI(PRI, T, U, STR) \
+ { \
+ @KWIML@_INT_##T const x = VALUE(T, U); \
+ char const* str = STR; \
+ sprintf(buf, "%"@KWIML@_INT_PRI##PRI, x); \
+ printf(LANG "@KWIML@_INT_PRI" #PRI ":" \
+ " expected [%s], got [%s]", str, buf); \
+ if(strcmp(str, buf) == 0) \
+ { \
+ printf(", PASSED\n"); \
+ } \
+ else \
+ { \
+ printf(", FAILED\n"); \
+ result = 0; \
+ } \
+ }
+
+#define TEST_SCN(SCN, T, U, STR) TEST_SCN2(SCN, SCN, T, U, STR)
+#define TEST_SCN2(PRI, SCN, T, U, STR) \
+ { \
+ @KWIML@_INT_##T const x = VALUE(T, U); \
+ @KWIML@_INT_##T y; \
+ char const* str = STR; \
+ if(sscanf(str, "%"@KWIML@_INT_SCN##SCN, &y) != 1) \
+ { \
+ y = 0; \
+ } \
+ printf(LANG "@KWIML@_INT_SCN" #SCN ":" \
+ " expected [%"@KWIML@_INT_PRI##PRI"]," \
+ " got [%"@KWIML@_INT_PRI##PRI"]", x, y); \
+ if(x == y) \
+ { \
+ printf(", PASSED\n"); \
+ } \
+ else \
+ { \
+ printf(", FAILED\n"); \
+ result = 0; \
+ } \
+ }
+
+#define TEST(FMT, T, U, STR) TEST2(FMT, FMT, T, U, STR)
+#define TEST2(PRI, SCN, T, U, STR) \
+ TEST_PRI(PRI, T, U, STR) \
+ TEST_SCN2(PRI, SCN, T, U, STR)
+
+static int test_INT_format(void)
+{
+ int result = 1;
+ char buf[256];
+ TEST_PRI(i8, int8_t, uint8_t, "-85")
+#if defined(@KWIML@_INT_SCNi8)
+ TEST_SCN(i8, int8_t, uint8_t, "-85")
+#endif
+ TEST_PRI(d8, int8_t, uint8_t, "-85")
+#if defined(@KWIML@_INT_SCNd8)
+ TEST_SCN(d8, int8_t, uint8_t, "-85")
+#endif
+ TEST_PRI(o8, uint8_t, uint8_t, "253")
+#if defined(@KWIML@_INT_SCNo8)
+ TEST_SCN(o8, uint8_t, uint8_t, "253")
+#endif
+ TEST_PRI(u8, uint8_t, uint8_t, "171")
+#if defined(@KWIML@_INT_SCNu8)
+ TEST_SCN(u8, uint8_t, uint8_t, "171")
+#endif
+ TEST_PRI(x8, uint8_t, uint8_t, "ab")
+ TEST_PRI(X8, uint8_t, uint8_t, "AB")
+#if defined(@KWIML@_INT_SCNx8)
+ TEST_SCN(x8, uint8_t, uint8_t, "ab")
+ TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB")
+#endif
+
+ TEST(i16, int16_t, uint16_t, "-21760")
+ TEST(d16, int16_t, uint16_t, "-21760")
+ TEST(o16, uint16_t, uint16_t, "125400")
+ TEST(u16, uint16_t, uint16_t, "43776")
+ TEST(x16, uint16_t, uint16_t, "ab00")
+ TEST2(X16, x16, uint16_t, uint16_t, "AB00")
+
+ TEST(i32, int32_t, uint32_t, "-1426063360")
+ TEST(d32, int32_t, uint32_t, "-1426063360")
+ TEST(o32, uint32_t, uint32_t, "25300000000")
+ TEST(u32, uint32_t, uint32_t, "2868903936")
+ TEST(x32, uint32_t, uint32_t, "ab000000")
+ TEST2(X32, x32, uint32_t, uint32_t, "AB000000")
+
+ TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560")
+#if defined(@KWIML@_INT_SCNi64)
+ TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560")
+#endif
+ TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560")
+#if defined(@KWIML@_INT_SCNd64)
+ TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560")
+#endif
+ TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000")
+#if defined(@KWIML@_INT_SCNo64)
+ TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000")
+#endif
+ TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056")
+#if defined(@KWIML@_INT_SCNu64)
+ TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056")
+#endif
+ TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000")
+ TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000")
+#if defined(@KWIML@_INT_SCNx64)
+ TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000")
+ TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000")
+#endif
+
+#if !defined(@KWIML@_INT_NO_INTPTR_T)
+# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+ TEST(iPTR, intptr_t, uint32_t, "-1426063360")
+ TEST(dPTR, intptr_t, uint32_t, "-1426063360")
+# else
+ TEST(iPTR, intptr_t, uint64_t, "-6124895493223874560")
+ TEST(dPTR, intptr_t, uint64_t, "-6124895493223874560")
+# endif
+#endif
+
+#if !defined(@KWIML@_INT_NO_UINTPTR_T)
+# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4
+ TEST(oPTR, uintptr_t, uintptr_t, "25300000000")
+ TEST(uPTR, uintptr_t, uintptr_t, "2868903936")
+ TEST(xPTR, uintptr_t, uintptr_t, "ab000000")
+ TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB000000")
+# else
+ TEST(oPTR, uintptr_t, uintptr_t, "1254000000000000000000")
+ TEST(uPTR, uintptr_t, uintptr_t, "12321848580485677056")
+ TEST(xPTR, uintptr_t, uintptr_t, "ab00000000000000")
+ TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB00000000000000")
+# endif
+#endif
+
+ TEST_C(INT8_C, -0x55, i8, int8_t, uint8_t)
+ TEST_C(UINT8_C, 0xAB, u8, uint8_t, uint8_t)
+ TEST_C(INT16_C, -0x5500, i16, int16_t, uint16_t)
+ TEST_C(UINT16_C, 0xAB00, u16, uint16_t, uint16_t)
+ TEST_C(INT32_C, -0x55000000, i32, int32_t, uint32_t)
+ TEST_C(UINT32_C, 0xAB000000, u32, uint32_t, uint32_t)
+ TEST_C(INT64_C, -0x5500000000000000, i64, int64_t, uint64_t)
+ TEST_C(UINT64_C, 0xAB00000000000000, u64, uint64_t, uint64_t)
+
+ return result;
+}
diff --git a/Utilities/KWIML/test/test_include_C.c b/Utilities/KWIML/test/test_include_C.c
new file mode 100644
index 0000000..fb3e4cf
--- /dev/null
+++ b/Utilities/KWIML/test/test_include_C.c
@@ -0,0 +1,22 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include <stdio.h>
+
+/* Test KWIML header inclusion after above system headers. */
+#include "test.h"
+#include KWIML_HEADER(ABI.h)
+#include KWIML_HEADER(INT.h)
+
+int test_include_C(void)
+{
+ return 1;
+}
diff --git a/Utilities/KWIML/test/test_include_CXX.cxx b/Utilities/KWIML/test/test_include_CXX.cxx
new file mode 100644
index 0000000..111311a
--- /dev/null
+++ b/Utilities/KWIML/test/test_include_CXX.cxx
@@ -0,0 +1,28 @@
+/*============================================================================
+ Kitware Information Macro Library
+ Copyright 2010-2011 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.
+============================================================================*/
+#include <string>
+
+#if defined(_MSC_VER) && defined(NDEBUG)
+// Use C++ runtime to avoid linker warning:
+// warning LNK4089: all references to 'MSVCP71.dll' discarded by /OPT:REF
+std::string test_include_CXX_use_stl_string;
+#endif
+
+/* Test KWIML header inclusion after above system headers. */
+#include "test.h"
+#include KWIML_HEADER(ABI.h)
+#include KWIML_HEADER(INT.h)
+
+extern "C" int test_include_CXX(void)
+{
+ return 1;
+}
diff --git a/Utilities/Release/dash2win64_cygwin.cmake b/Utilities/Release/dash2win64_cygwin.cmake
index da66002..74d5012 100644
--- a/Utilities/Release/dash2win64_cygwin.cmake
+++ b/Utilities/Release/dash2win64_cygwin.cmake
@@ -8,6 +8,7 @@ set(CPACK_SOURCE_GENERATORS "CygwinSource")
set(MAKE_PROGRAM "make")
set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release
CMAKE_Fortran_COMPILER_FULLPATH:FILEPATH=FALSE
+DART_TESTING_TIMEOUT:STRING=7200
")
set(CXX g++)
set(CC gcc)
diff --git a/bootstrap b/bootstrap
index c999888..3daac2a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -215,6 +215,7 @@ CMAKE_CXX_SOURCES="\
cmMakefileLibraryTargetGenerator \
cmMakefileTargetGenerator \
cmMakefileUtilityTargetGenerator \
+ cmNewLineStyle \
cmBootstrapCommands \
cmCommands \
cmTarget \