summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-10-13 10:52:34 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2006-10-13 10:52:34 -0400
commit72b38e3aa7ba5fa4a70144e05de36bc99fda173a (patch)
tree744005aab47678a2a742267a01799a8f53dd0cf7
parent8883613cc022d0ae2c96d84adf79dd82b74df658 (diff)
downloadcmake-72b38e3aa7ba5fa4a70144e05de36bc99fda173a.tar.gz
ENH: merge changes from the main tree to the 2.4 branch
-rw-r--r--CMakeLists.txt12
-rw-r--r--ChangeLog.manual109
-rw-r--r--Docs/cmake-indent.vim4
-rw-r--r--Docs/cmake-mode.el4
-rw-r--r--Docs/cmake-syntax.vim2
-rw-r--r--Modules/CMakeCXXInformation.cmake16
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake19
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake21
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake27
-rw-r--r--Modules/CMakeDetermineRCCompiler.cmake20
-rw-r--r--Modules/CMakeFortranInformation.cmake4
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake1
-rw-r--r--Modules/CMakeVCManifest.cmake30
-rw-r--r--Modules/COPYING-CMAKE-SCRIPTS22
-rw-r--r--Modules/CheckCCompilerFlag.cmake21
-rw-r--r--Modules/CheckCSourceCompiles.cmake10
-rw-r--r--Modules/CheckCSourceRuns.cmake68
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake21
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake8
-rw-r--r--Modules/CheckCXXSourceRuns.cmake68
-rw-r--r--Modules/FindASPELL.cmake40
-rw-r--r--Modules/FindBZip2.cmake43
-rw-r--r--Modules/FindDoxygen.cmake64
-rw-r--r--Modules/FindGLUT.cmake2
-rw-r--r--Modules/FindHSPELL.cmake42
-rw-r--r--Modules/FindJasper.cmake43
-rw-r--r--Modules/FindKDE3.cmake89
-rw-r--r--Modules/FindLibXml2.cmake59
-rw-r--r--Modules/FindLibXslt.cmake54
-rw-r--r--Modules/FindOpenSSL.cmake70
-rw-r--r--Modules/FindPNG.cmake13
-rw-r--r--Modules/FindPythonInterp.cmake3
-rw-r--r--Modules/FindPythonLibs.cmake13
-rw-r--r--Modules/FindQt3.cmake21
-rw-r--r--Modules/FindQt4.cmake233
-rw-r--r--Modules/FindRuby.cmake60
-rw-r--r--Modules/FindSDL.cmake1
-rw-r--r--Modules/FindTCL.cmake8
-rw-r--r--Modules/FindwxWidgets.cmake8
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake21
-rw-r--r--Modules/KDE3Macros.cmake79
-rw-r--r--Modules/Platform/AIX.cmake24
-rw-r--r--Modules/Platform/CYGWIN.cmake13
-rw-r--r--Modules/Platform/Darwin.cmake13
-rw-r--r--Modules/Platform/FreeBSD.cmake10
-rw-r--r--Modules/Platform/HP-UX.cmake33
-rw-r--r--Modules/Platform/IRIX.cmake16
-rw-r--r--Modules/Platform/IRIX64.cmake16
-rw-r--r--Modules/Platform/Linux.cmake11
-rw-r--r--Modules/Platform/QNX.cmake13
-rw-r--r--Modules/Platform/SunOS.cmake37
-rw-r--r--Modules/Platform/UnixPaths.cmake38
-rw-r--r--Modules/Platform/Windows-cl.cmake31
-rw-r--r--Modules/Platform/Windows-gcc.cmake11
-rw-r--r--Modules/Platform/gcc.cmake6
-rw-r--r--Modules/UseEcos.cmake42
-rw-r--r--Modules/UseQt4.cmake239
-rw-r--r--Modules/UseSWIG.cmake4
-rw-r--r--Modules/kde3uic.cmake2
-rw-r--r--Modules/readme.txt2
-rw-r--r--Source/CMakeLists.txt19
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx2
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.cxx267
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h1
-rw-r--r--Source/CPack/cmCPackZIPGenerator.cxx25
-rw-r--r--Source/CPack/cpack.cxx78
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx3
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx7
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx5
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx4
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx5
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx3
-rw-r--r--Source/CursesDialog/ccmake.cxx3
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx10
-rw-r--r--Source/MFCDialog/PropertyList.cpp24
-rw-r--r--Source/cmAddCustomCommandCommand.cxx59
-rw-r--r--Source/cmAddCustomCommandCommand.h28
-rw-r--r--Source/cmAddCustomTargetCommand.cxx49
-rw-r--r--Source/cmAddCustomTargetCommand.h26
-rw-r--r--Source/cmAddExecutableCommand.cxx9
-rw-r--r--Source/cmAddExecutableCommand.h7
-rw-r--r--Source/cmAddLibraryCommand.cxx9
-rw-r--r--Source/cmAddLibraryCommand.h7
-rw-r--r--Source/cmAddSubDirectoryCommand.cxx88
-rw-r--r--Source/cmAddTestCommand.h2
-rw-r--r--Source/cmBuildNameCommand.h6
-rw-r--r--Source/cmCPluginAPI.cxx22
-rw-r--r--Source/cmCommand.h9
-rw-r--r--Source/cmCommandArgumentLexer.cxx339
-rw-r--r--Source/cmCommandArgumentLexer.h10
-rw-r--r--Source/cmCommandArgumentLexer.in.l50
-rw-r--r--Source/cmCommandArgumentParser.cxx12
-rw-r--r--Source/cmCommandArgumentParser.y15
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx17
-rw-r--r--Source/cmCommandArgumentParserHelper.h3
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmCustomCommand.cxx62
-rw-r--r--Source/cmCustomCommand.h18
-rw-r--r--Source/cmDependsC.cxx129
-rw-r--r--Source/cmDependsC.h14
-rw-r--r--Source/cmDependsFortranLexer.cxx28
-rw-r--r--Source/cmDependsFortranLexer.in.l30
-rw-r--r--Source/cmDependsFortranParser.cxx3
-rw-r--r--Source/cmDependsFortranParser.y3
-rw-r--r--Source/cmDependsJavaLexer.cxx32
-rw-r--r--Source/cmDependsJavaLexer.in.l34
-rw-r--r--Source/cmDependsJavaParser.cxx3
-rw-r--r--Source/cmDependsJavaParser.y3
-rw-r--r--Source/cmDocumentation.cxx46
-rw-r--r--Source/cmElseIfCommand.cxx24
-rw-r--r--Source/cmElseIfCommand.h76
-rw-r--r--Source/cmEndMacroCommand.cxx27
-rw-r--r--Source/cmEndMacroCommand.h82
-rw-r--r--Source/cmExecProgramCommand.h6
-rw-r--r--Source/cmExprLexer.cxx34
-rw-r--r--Source/cmExprLexer.in.l32
-rw-r--r--Source/cmExprParser.cxx3
-rw-r--r--Source/cmExprParser.y3
-rw-r--r--Source/cmFileCommand.cxx778
-rw-r--r--Source/cmGetTargetPropertyCommand.h11
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx47
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx27
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx16
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx35
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h4
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx35
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx17
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h3
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx44
-rw-r--r--Source/cmIfCommand.cxx74
-rw-r--r--Source/cmIfCommand.h7
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx13
-rw-r--r--Source/cmIncludeDirectoryCommand.h7
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx27
-rw-r--r--Source/cmInstallCommand.cxx447
-rw-r--r--Source/cmInstallCommand.h63
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx61
-rw-r--r--Source/cmInstallDirectoryGenerator.h48
-rw-r--r--Source/cmInstallFilesCommand.cxx5
-rw-r--r--Source/cmInstallFilesCommand.h6
-rw-r--r--Source/cmInstallFilesGenerator.cxx15
-rw-r--r--Source/cmInstallFilesGenerator.h8
-rw-r--r--Source/cmInstallGenerator.cxx21
-rw-r--r--Source/cmInstallGenerator.h6
-rw-r--r--Source/cmInstallProgramsCommand.cxx4
-rw-r--r--Source/cmInstallProgramsCommand.h6
-rw-r--r--Source/cmInstallTargetGenerator.cxx44
-rw-r--r--Source/cmInstallTargetGenerator.h8
-rw-r--r--Source/cmInstallTargetsCommand.cxx4
-rw-r--r--Source/cmInstallTargetsCommand.h6
-rw-r--r--Source/cmLinkLibrariesCommand.h6
-rw-r--r--Source/cmListCommand.cxx87
-rw-r--r--Source/cmListCommand.h2
-rw-r--r--Source/cmListFileCache.cxx4
-rw-r--r--Source/cmListFileLexer.c25
-rw-r--r--Source/cmListFileLexer.in.l25
-rw-r--r--Source/cmLoadCommandCommand.cxx6
-rw-r--r--Source/cmLocalGenerator.cxx262
-rw-r--r--Source/cmLocalGenerator.h38
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx306
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h68
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx12
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx110
-rw-r--r--Source/cmLocalVisualStudio7Generator.h1
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx99
-rw-r--r--Source/cmLocalVisualStudioGenerator.h9
-rw-r--r--Source/cmMacroCommand.cxx7
-rw-r--r--Source/cmMakeDirectoryCommand.h11
-rw-r--r--Source/cmMakefile.cxx91
-rw-r--r--Source/cmMakefile.h34
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx13
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.h2
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx77
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx190
-rw-r--r--Source/cmMakefileTargetGenerator.h4
-rw-r--r--Source/cmMessageCommand.cxx13
-rw-r--r--Source/cmOrderLinkDirectories.cxx208
-rw-r--r--Source/cmOrderLinkDirectories.h39
-rw-r--r--Source/cmRemoveCommand.h10
-rw-r--r--Source/cmSetCommand.cxx2
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h5
-rw-r--r--Source/cmSetTargetPropertiesCommand.h7
-rw-r--r--Source/cmStandardIncludes.h23
-rw-r--r--Source/cmStandardLexer.h78
-rw-r--r--Source/cmSubdirCommand.h6
-rw-r--r--Source/cmSubdirDependsCommand.h6
-rw-r--r--Source/cmTarget.cxx48
-rw-r--r--Source/cmTryCompileCommand.cxx1
-rw-r--r--Source/cmVTKMakeInstantiatorCommand.h6
-rw-r--r--Source/cmVTKWrapJavaCommand.cxx7
-rw-r--r--Source/cmVTKWrapJavaCommand.h6
-rw-r--r--Source/cmVTKWrapPythonCommand.h6
-rw-r--r--Source/cmVTKWrapTclCommand.h6
-rw-r--r--Source/cmWin32ProcessExecution.cxx49
-rw-r--r--Source/cmake.cxx23
-rw-r--r--Source/cmake.h4
-rw-r--r--Source/cmakemain.cxx3
-rw-r--r--Source/kwsys/CMakeEmptyInputFile.in1
-rw-r--r--Source/kwsys/CMakeLists.txt111
-rw-r--r--Source/kwsys/CheckCXXSourceRuns.cmake62
-rw-r--r--Source/kwsys/CommandLineArguments.cxx2
-rw-r--r--Source/kwsys/Configure.h.in40
-rw-r--r--Source/kwsys/Directory.cxx5
-rw-r--r--Source/kwsys/Glob.cxx183
-rw-r--r--Source/kwsys/Glob.hxx.in23
-rw-r--r--Source/kwsys/IOStream.cxx270
-rw-r--r--Source/kwsys/IOStream.hxx.in148
-rw-r--r--Source/kwsys/Process.h.in32
-rw-r--r--Source/kwsys/ProcessUNIX.c154
-rw-r--r--Source/kwsys/ProcessWin32.c245
-rw-r--r--Source/kwsys/Registry.cxx4
-rw-r--r--Source/kwsys/SharedForward.h.in69
-rw-r--r--Source/kwsys/System.c460
-rw-r--r--Source/kwsys/System.h.in113
-rw-r--r--Source/kwsys/SystemTools.cxx120
-rw-r--r--Source/kwsys/SystemTools.hxx.in34
-rw-r--r--Source/kwsys/Terminal.c3
-rw-r--r--Source/kwsys/kwsysPlatformTests.cmake153
-rw-r--r--Source/kwsys/kwsysPlatformTestsC.c51
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx439
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx3
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx2
-rw-r--r--Source/kwsys/testProcess.c9
-rw-r--r--Source/kwsys/testSystemTools.cxx80
-rw-r--r--Tests/Complex/CMakeLists.txt42
-rw-r--r--Tests/Complex/Executable/A.cxx5
-rw-r--r--Tests/Complex/Executable/A.h4
-rw-r--r--Tests/Complex/Executable/A.hh2
-rw-r--r--Tests/Complex/Executable/A.txt1
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt21
-rw-r--r--Tests/Complex/Executable/complex.cxx27
-rw-r--r--Tests/Complex/Executable/notInAllExe.cxx10
-rw-r--r--Tests/Complex/Executable/testSystemDir.cxx3
-rw-r--r--Tests/Complex/Library/CMakeLists.txt31
-rw-r--r--Tests/Complex/Library/SystemDir/testSystemDir.h2
-rw-r--r--Tests/Complex/Library/TestLink.c8
-rw-r--r--Tests/Complex/Library/notInAllLib.cxx5
-rw-r--r--Tests/Complex/Library/test_preprocess.cmake7
-rw-r--r--Tests/Complex/cmTestConfigure.h.in3
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt42
-rw-r--r--Tests/ComplexOneConfig/Executable/A.cxx5
-rw-r--r--Tests/ComplexOneConfig/Executable/A.h4
-rw-r--r--Tests/ComplexOneConfig/Executable/A.hh2
-rw-r--r--Tests/ComplexOneConfig/Executable/A.txt1
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt21
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx27
-rw-r--r--Tests/ComplexOneConfig/Executable/notInAllExe.cxx10
-rw-r--r--Tests/ComplexOneConfig/Executable/testSystemDir.cxx3
-rw-r--r--Tests/ComplexOneConfig/Library/CMakeLists.txt31
-rw-r--r--Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h2
-rw-r--r--Tests/ComplexOneConfig/Library/TestLink.c8
-rw-r--r--Tests/ComplexOneConfig/Library/notInAllLib.cxx5
-rw-r--r--Tests/ComplexOneConfig/Library/test_preprocess.cmake7
-rw-r--r--Tests/ComplexOneConfig/cmTestConfigure.h.in3
-rw-r--r--Tests/ComplexRelativePaths/CMakeLists.txt42
-rw-r--r--Tests/ComplexRelativePaths/Executable/A.cxx5
-rw-r--r--Tests/ComplexRelativePaths/Executable/A.h4
-rw-r--r--Tests/ComplexRelativePaths/Executable/A.hh2
-rw-r--r--Tests/ComplexRelativePaths/Executable/A.txt1
-rw-r--r--Tests/ComplexRelativePaths/Executable/CMakeLists.txt21
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx27
-rw-r--r--Tests/ComplexRelativePaths/Executable/notInAllExe.cxx10
-rw-r--r--Tests/ComplexRelativePaths/Executable/testSystemDir.cxx3
-rw-r--r--Tests/ComplexRelativePaths/Library/CMakeLists.txt31
-rw-r--r--Tests/ComplexRelativePaths/Library/SystemDir/testSystemDir.h2
-rw-r--r--Tests/ComplexRelativePaths/Library/TestLink.c8
-rw-r--r--Tests/ComplexRelativePaths/Library/notInAllLib.cxx5
-rw-r--r--Tests/ComplexRelativePaths/Library/test_preprocess.cmake7
-rw-r--r--Tests/ComplexRelativePaths/cmTestConfigure.h.in3
-rw-r--r--Tests/CustomCommand/CMakeLists.txt80
-rw-r--r--Tests/CustomCommand/check_command_line.c.in34
-rw-r--r--Tests/OutOfBinary/CMakeLists.txt2
-rw-r--r--Tests/OutOfBinary/outlib.c2
-rw-r--r--Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt2
-rw-r--r--Tests/OutOfSource/OutOfSourceSubdir/simple.cxx7
-rw-r--r--Tests/OutOfSource/SubDir/CMakeLists.txt5
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt87
-rw-r--r--Tests/SimpleInstall/PackageScript.cmake10
-rw-r--r--Tests/SimpleInstall/scripts/.gitattributes1
-rwxr-xr-xTests/SimpleInstall/scripts/sample_script2
-rwxr-xr-xTests/SimpleInstall/scripts/sample_script.bat1
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt87
-rw-r--r--Tests/SimpleInstallS2/PackageScript.cmake10
-rw-r--r--Tests/SimpleInstallS2/scripts/.gitattributes1
-rwxr-xr-xTests/SimpleInstallS2/scripts/sample_script2
-rwxr-xr-xTests/SimpleInstallS2/scripts/sample_script.bat1
-rw-r--r--Tests/StringFileTest/CMakeLists.txt8
-rw-r--r--Tests/SystemInformation/SystemInformation.in18
-rw-r--r--Utilities/Release/README28
-rw-r--r--Utilities/cmcompress/CMakeLists.txt3
-rw-r--r--Utilities/cmcompress/cmcompress.c551
-rw-r--r--Utilities/cmcompress/cmcompress.h195
-rw-r--r--Utilities/cmcurl/CMakeLists.txt5
-rw-r--r--Utilities/cmtar/CMakeLists.txt11
-rw-r--r--Utilities/cmxmlrpc/CMakeLists.txt5
-rw-r--r--Utilities/cmxmlrpc/xmlrpc_curl_transport.c5
-rw-r--r--Utilities/cmzlib/CMakeLists.txt5
-rwxr-xr-xbootstrap66
309 files changed, 10119 insertions, 2365 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4eb3d5b09a..9e913edd1a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,9 +15,9 @@ SET(BUILD_SHARED_LIBS OFF)
# install tree.
SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
-SET(CMAKE_DATA_DIR "/share/CMake" CACHE STRING
+SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}" CACHE STRING
"Install location for data (relative to prefix).")
-SET(CMAKE_DOC_DIR "/doc/CMake" CACHE STRING
+SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION}" CACHE STRING
"Install location for documentation (relative to prefix).")
SET(CMAKE_MAN_DIR "/man" CACHE STRING
"Install location for man pages (relative to prefix).")
@@ -88,12 +88,18 @@ SET(CMAKE_CURL_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/Utilities")
SET(CMAKE_CURL_LIBRARIES "cmcurl")
#-----------------------------------------------------------------------------
-# Build Curl library for CTest.
+# Build Tar library for CTest.
SUBDIRS(Utilities/cmtar)
SET(CMAKE_TAR_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar")
SET(CMAKE_TAR_LIBRARIES "cmtar")
#-----------------------------------------------------------------------------
+# Build Compress library for CTest.
+SUBDIRS(Utilities/cmcompress)
+SET(CMAKE_COMPRESS_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress")
+SET(CMAKE_COMPRESS_LIBRARIES "cmcompress")
+
+#-----------------------------------------------------------------------------
# Build expat library for CMake and CTest.
SUBDIRS(Utilities/cmexpat)
SET(CMAKE_EXPAT_INCLUDES
diff --git a/ChangeLog.manual b/ChangeLog.manual
index 5cb3c87751..3c5217f208 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,112 @@
+Changes in CMake 2.4.4
+
+* CMake Version numbers on module directory
+
+* elseif added
+
+* Fix docs in CheckCSourceCompiles CheckCXXSourceCompiles and diagnostic
+ output.
+
+* added Check(C/CXX)SourceRuns.cmake, CheckCXXCompilerFlag.cmake, Check
+
+* add static and shared flags to make sure the specified versions of
+ libraries are used with -static -lfoo -shared -lbar
+
+* Search for the compiler only once and store a full path. avoids problems
+ with PATH changes in cmake re-runs.
+
+* make sure manifest files are generated with VS 8
+
+* added FindASPELL.cmake, FindBZip2.cmake FindHPELL.cmake, FindJasper.cmake
+ FindLibXml2.cmake, FindLibXslt.cmake, FindOpenSSL.cmake
+
+* fix for bug#3646 GLUT not Glut for framework name
+
+* many fixes for FindKDE3.cmake
+
+* Better FindPNG that honors REQUIRED and looks in more places.
+
+* Support to find python 2.5
+
+* Find Qt3 better
+
+* Find Qt4 better and work with qmake and qmake-qt4 on the same machine.
+
+* Much better FindRuby.cmake
+
+* More stuff marked as advanced in FindTcl and FindSDL
+
+* FindwxWidgets runs shell script wx-config with sh
+
+* Support for cpack and vs8 install libraries
+
+* Darwin shared library create and Fortran now work
+
+* Support for isystem directories INCLUDE_DIRECTORIES (SYSTEM)
+
+* Targets in makefiles to create pre-processed files and assembly files
+ can be turned off with these variables:
+ CMAKE_SKIP_PREPROCESSED_SOURCE_RULES CMAKE_SKIP_ASSEMBLY_SOURCE_RULES
+
+* Support for QNX
+
+* Better default search paths for unix and FIND_* stuff
+
+* Use link /lib and not lib to create static libraries with MS
+
+* Useqt4 works with static qt4 and other fixes
+
+* UseSwig.cmake interface to add extra dependencies.
+
+* Added APPEND option to ADD_CUSTOM_COMMAND, Added VERBATIM option to
+ ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET
+
+* add NOT_IN_ALL option for ADD_LIBRARY and ADD_EXECUTABLE
+
+* Fix automatic computation of binary path to work for subdirectories of out
+ of source directories. This addresses bug#3592.
+
+* --debug-ouput to cmake that gives stack trace to message send error commands.
+ The stack trace is no longer there without it.
+
+* + can be in a variable
+
+* Do not replace @VAR@ syntax in list files. This addresses bug #2722
+
+* much faster depend scanning
+
+* do depends on system include directories
+
+* Permission and install directory fixes
+
+* New target property <CONFIG>_LOCATION (Debug, Release, etc)
+
+* fix exclude from all in VS
+
+* fix code completion problem in KDevelop
+
+* Define MSYS when using msys generator
+
+* fix referencece to projects outside the build tree VS 7,8
+
+* Fix ZERO_CHECK to not always try and rebuild
+
+* Fix Xcode universal binary rebuild problem
+
+* add FILE_IS_NEWER to if command
+
+* Add OPTIONAL to INSTALL command fix bug@2922
+
+* add SORT and REVERSE to LIST command
+
+* fix for seg fault bug #3815
+
+* add SYBOLIC as a source file property see SET_SOURCE_FILES_PROPERTIES
+
+* fix ctest valgrind if no coverage is done
+
+* better message if bogus generator is specified.
+
Changes in CMake 2.4.3
* fix for 3557 - Under MSVC8 hardcoded TargetEnvironment for MIDL Compiler
diff --git a/Docs/cmake-indent.vim b/Docs/cmake-indent.vim
index a1ad832f24..b54a8d87a2 100644
--- a/Docs/cmake-indent.vim
+++ b/Docs/cmake-indent.vim
@@ -65,8 +65,8 @@ fun! CMakeGetIndent(lnum)
\ ')\s*' .
\ '\(' . cmake_regex_comment . '\)\?$'
- let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|WHILE\)\s*('
- let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ENDWHILE\)\s*('
+ let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\)\s*('
+ let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\)\s*('
" Add
if previous_line =~? cmake_indent_comment_line " Handle comments
diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el
index 160f0ecb52..a32f02b6dc 100644
--- a/Docs/cmake-mode.el
+++ b/Docs/cmake-mode.el
@@ -55,9 +55,9 @@
"\\|" "[ \t\r\n]"
"\\)*"))
(defconst cmake-regex-block-open
- "^\\(IF\\|MACRO\\|FOREACH\\|ELSE\\|WHILE\\)$")
+ "^\\(IF\\|MACRO\\|FOREACH\\|ELSE\\|ELSEIF\\|WHILE\\)$")
(defconst cmake-regex-block-close
- "^[ \t]*\\(ENDIF\\|ENDFOREACH\\|ENDMACRO\\|ELSE\\|ENDWHILE\\)[ \t]*(")
+ "^[ \t]*\\(ENDIF\\|ENDFOREACH\\|ENDMACRO\\|ELSE\\|ELSEIF\\|ENDWHILE\\)[ \t]*(")
;------------------------------------------------------------------------------
diff --git a/Docs/cmake-syntax.vim b/Docs/cmake-syntax.vim
index 302417e5ff..4dd5c3a115 100644
--- a/Docs/cmake-syntax.vim
+++ b/Docs/cmake-syntax.vim
@@ -49,7 +49,7 @@ syn region cmakeArguments start=/\s*(/ end=/)/
syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_REMOVE VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WRAP_EXCLUDE_FILES
\ nextgroup=cmakeArgument
syn keyword cmakeStatement
- \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDIF ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE ENDMACRO
+ \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDIF ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE ENDMACRO
\ nextgroup=cmakeArgumnts
"syn match cmakeMacro /^\s*[A-Z_]\+/ nextgroup=cmakeArgumnts
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 8d05933eda..4e03bf3aba 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -72,10 +72,6 @@ IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
-IF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS)
- SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS ${CMAKE_SHARED_MODULE_LINK_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS)
-
IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG)
SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_FLAG})
ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG)
@@ -84,6 +80,18 @@ IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP)
SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP})
ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP)
+# Initialize CXX link type selection flags from C versions.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS
+ ${CMAKE_${type}_LINK_STATIC_C_FLAGS})
+ ENDIF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
+ IF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS
+ ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS})
+ ENDIF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
+ENDFOREACH(type)
+
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 4d7ced5b56..03b019ab24 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -28,17 +28,18 @@ IF(NOT CMAKE_C_COMPILER)
ENDIF(NOT CMAKE_C_COMPILER_INIT)
ENDIF(CMAKE_GENERATOR_CC)
- # if no compiler has been specified yet, then look for one
- IF(NOT CMAKE_C_COMPILER_INIT)
- # if not in the envionment then search for the compiler in the path
+ # finally list compilers to try
+ IF(CMAKE_C_COMPILER_INIT)
+ SET(CMAKE_C_COMPILER_LIST ${CMAKE_C_COMPILER_INIT})
+ ELSE(CMAKE_C_COMPILER_INIT)
SET(CMAKE_C_COMPILER_LIST gcc cc cl bcc xlc)
- FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES ${CMAKE_C_COMPILER_LIST} )
- GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT
- ${CMAKE_C_COMPILER_FULLPATH} NAME)
- SET(CMAKE_C_COMPILER_FULLPATH "${CMAKE_C_COMPILER_FULLPATH}" CACHE INTERNAL "full path to the compiler cmake found")
- ENDIF(NOT CMAKE_C_COMPILER_INIT)
+ ENDIF(CMAKE_C_COMPILER_INIT)
- SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler")
+ # Find the compiler.
+ FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C compiler")
+ IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
+ SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE)
+ ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)
ENDIF(NOT CMAKE_C_COMPILER)
MARK_AS_ADVANCED(CMAKE_C_COMPILER)
GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_C_COMPILER}"
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 79683f5950..ed909ce9a6 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -28,17 +28,18 @@ IF(NOT CMAKE_CXX_COMPILER)
ENDIF(NOT CMAKE_CXX_COMPILER_INIT)
ENDIF(CMAKE_GENERATOR_CXX)
- # if no compiler has been found yet, then try to find one
- IF(NOT CMAKE_CXX_COMPILER_INIT)
- # if not in the envionment then search for the compiler in the path
+ # finally list compilers to try
+ IF(CMAKE_CXX_COMPILER_INIT)
+ SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_CXX_COMPILER_INIT})
+ ELSE(CMAKE_CXX_COMPILER_INIT)
SET(CMAKE_CXX_COMPILER_LIST c++ g++ CC aCC cl bcc xlC)
- FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES ${CMAKE_CXX_COMPILER_LIST})
- GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT
- ${CMAKE_CXX_COMPILER_FULLPATH} NAME)
- SET(CMAKE_CXX_COMPILER_FULLPATH "${CMAKE_CXX_COMPILER_FULLPATH}" CACHE INTERNAL "full path to the compiler cmake found")
- ENDIF(NOT CMAKE_CXX_COMPILER_INIT)
- SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_INIT}
- CACHE STRING "C++ compiler")
+ ENDIF(CMAKE_CXX_COMPILER_INIT)
+
+ # Find the compiler.
+ FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES ${CMAKE_CXX_COMPILER_LIST} DOC "C++ compiler")
+ IF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER)
+ SET(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER_INIT}" CACHE FILEPATH "C++ compiler" FORCE)
+ ENDIF(CMAKE_CXX_COMPILER_INIT AND NOT CMAKE_CXX_COMPILER)
ENDIF(NOT CMAKE_CXX_COMPILER)
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER)
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index edec369763..232f6e8c4d 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -25,10 +25,10 @@ IF(NOT CMAKE_Fortran_COMPILER)
ENDIF(NOT CMAKE_Fortran_COMPILER_INIT)
ENDIF(CMAKE_GENERATOR_FC)
-
- # if no compiler has been specified yet, then look for one
- IF(NOT CMAKE_Fortran_COMPILER_INIT)
- # if not in the envionment then search for the compiler in the path
+ # finally list compilers to try
+ IF(CMAKE_Fortran_COMPILER_INIT)
+ SET(CMAKE_Fortran_COMPILER_LIST ${CMAKE_Fortran_COMPILER_INIT})
+ ELSE(CMAKE_Fortran_COMPILER_INIT)
# Known compilers:
# f77/f90/f95: generic compiler names
# g77: GNU Fortran 77 compiler
@@ -51,16 +51,17 @@ IF(NOT CMAKE_Fortran_COMPILER)
# NOTE for testing purposes this list is DUPLICATED in
# CMake/Source/CMakeLists.txt, IF YOU CHANGE THIS LIST,
# PLEASE UPDATE THAT FILE AS WELL!
- SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95
- lf95 xlf95 fort gfortran f90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 )
- FIND_PROGRAM(CMAKE_Fortran_COMPILER_FULLPATH NAMES ${CMAKE_Fortran_COMPILER_LIST} )
- GET_FILENAME_COMPONENT(CMAKE_Fortran_COMPILER_INIT
- ${CMAKE_Fortran_COMPILER_FULLPATH} NAME)
- SET(CMAKE_Fortran_COMPILER_FULLPATH "${CMAKE_Fortran_COMPILER_FULLPATH}"
- CACHE INTERNAL "full path to the compiler cmake found")
- ENDIF(NOT CMAKE_Fortran_COMPILER_INIT)
+ SET(CMAKE_Fortran_COMPILER_LIST
+ ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran f90
+ pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77
+ )
+ ENDIF(CMAKE_Fortran_COMPILER_INIT)
- SET(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_INIT} CACHE STRING "Fortran compiler")
+ # Find the compiler.
+ FIND_PROGRAM(CMAKE_Fortran_COMPILER NAMES ${CMAKE_Fortran_COMPILER_LIST} DOC "Fortran compiler")
+ IF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER)
+ SET(CMAKE_Fortran_COMPILER "${CMAKE_Fortran_COMPILER_INIT}" CACHE FILEPATH "Fortran compiler" FORCE)
+ ENDIF(CMAKE_Fortran_COMPILER_INIT AND NOT CMAKE_Fortran_COMPILER)
ENDIF(NOT CMAKE_Fortran_COMPILER)
MARK_AS_ADVANCED(CMAKE_Fortran_COMPILER)
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake
index e48f21f17b..b90f604e85 100644
--- a/Modules/CMakeDetermineRCCompiler.cmake
+++ b/Modules/CMakeDetermineRCCompiler.cmake
@@ -25,18 +25,18 @@ IF(NOT CMAKE_RC_COMPILER)
ENDIF(NOT CMAKE_RC_COMPILER_INIT)
ENDIF(CMAKE_GENERATOR_RC)
-
- # if no compiler has been specified yet, then look for one
- IF(NOT CMAKE_RC_COMPILER_INIT)
+ # finally list compilers to try
+ IF(CMAKE_RC_COMPILER_INIT)
+ SET(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT})
+ ELSE(CMAKE_RC_COMPILER_INIT)
SET(CMAKE_RC_COMPILER_LIST rc)
- FIND_PROGRAM(CMAKE_RC_COMPILER_FULLPATH NAMES ${CMAKE_RC_COMPILER_LIST} )
- GET_FILENAME_COMPONENT(CMAKE_RC_COMPILER_INIT
- ${CMAKE_RC_COMPILER_FULLPATH} NAME)
- SET(CMAKE_RC_COMPILER_FULLPATH "${CMAKE_RC_COMPILER_FULLPATH}"
- CACHE INTERNAL "full path to the compiler cmake found")
- ENDIF(NOT CMAKE_RC_COMPILER_INIT)
+ ENDIF(CMAKE_RC_COMPILER_INIT)
- SET(CMAKE_RC_COMPILER ${CMAKE_RC_COMPILER_INIT} CACHE STRING "RC compiler")
+ # Find the compiler.
+ FIND_PROGRAM(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler")
+ IF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER)
+ SET(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE)
+ ENDIF(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER)
ENDIF(NOT CMAKE_RC_COMPILER)
MARK_AS_ADVANCED(CMAKE_RC_COMPILER)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 80a8e7a612..3413c052e9 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -63,10 +63,6 @@ IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS)
SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS)
-IF(NOT CMAKE_SHARED_MODULE_LINK_Fortran_FLAGS)
- SET(CMAKE_SHARED_MODULE_LINK_Fortran_FLAGS ${CMAKE_SHARED_MODULE_LINK_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_MODULE_LINK_Fortran_FLAGS)
-
IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG)
SET(CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG})
ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG)
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index 099c45e1ff..53905eb89a 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -30,7 +30,6 @@ ENDIF(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
- SET(CMAKE_SHARED_MODULE_LINK_C_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
ENDIF(NOT CMAKE_MODULE_EXISTS)
diff --git a/Modules/CMakeVCManifest.cmake b/Modules/CMakeVCManifest.cmake
new file mode 100644
index 0000000000..6675f99d7b
--- /dev/null
+++ b/Modules/CMakeVCManifest.cmake
@@ -0,0 +1,30 @@
+
+# Leave the first line of this file empty so this module will not be
+# included in the documentation.
+
+# This script is invoked from Windows-cl.cmake and passed the TARGET
+# variable on the command line.
+
+# Conditionally embed the manifest in the executable if it exists.
+IF(EXISTS "${TARGET}.manifest")
+ # Construct the manifest embedding command.
+ SET(CMD
+ mt ${CMAKE_CL_NOLOGO} /manifest ${TARGET}.manifest
+ /outputresource:${TARGET}
+ )
+
+ # Run the embedding command.
+ EXECUTE_PROCESS(COMMAND ${CMD}\;\#2 RESULT_VARIABLE RESULT)
+
+ # Check whether the command failed.
+ IF(NOT "${RESULT}" MATCHES "^0$")
+ # The embedding failed remove the target and the manifest.
+ FILE(REMOVE ${TARGET} ${TARGET}.manifest)
+
+ # Describe the failure in a message.
+ STRING(REGEX REPLACE ";" " " CMD "${CMD}")
+ MESSAGE(FATAL_ERROR
+ "Failed to embed manifest in ${TARGET} using command \"${CMD};#2\""
+ )
+ ENDIF(NOT "${RESULT}" MATCHES "^0$")
+ENDIF(EXISTS "${TARGET}.manifest")
diff --git a/Modules/COPYING-CMAKE-SCRIPTS b/Modules/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000000..4b417765f3
--- /dev/null
+++ b/Modules/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+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 copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
new file mode 100644
index 0000000000..b084399af4
--- /dev/null
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -0,0 +1,21 @@
+# - Check whether the C compiler supports a given flag.
+# CHECK_C_COMPILER_FLAG(FLAG VARIABLE)
+#
+# FLAG - the compiler flag
+# VARIABLE - variable to store the result
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckCSourceCompiles)
+
+MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
+ SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+ CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
+ SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+ENDMACRO (CHECK_C_COMPILER_FLAG)
+
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 767b2af276..f2716eb525 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -2,7 +2,7 @@
# CHECK_C_SOURCE_COMPILES(SOURCE VAR)
# - macro which checks if the source code compiles
# SOURCE - source code to try to compile
-# VAR - variable to store size if the type exists.
+# VAR - variable to store whether the source code compiled
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
@@ -41,16 +41,16 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
IF(${VAR})
- SET(${VAR} 1 CACHE INTERNAL "Test ${FUNCTION}")
+ SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
MESSAGE(STATUS "Performing Test ${VAR} - Success")
- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
ELSE(${VAR})
MESSAGE(STATUS "Performing Test ${VAR} - Failed")
- SET(${VAR} "" CACHE INTERNAL "Test ${FUNCTION}")
- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
+ SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
new file mode 100644
index 0000000000..d843e9a8a1
--- /dev/null
+++ b/Modules/CheckCSourceRuns.cmake
@@ -0,0 +1,68 @@
+# - Check if the source code provided in the SOURCE argument compiles and runs.
+# CHECK_C_SOURCE_RUNS(SOURCE VAR)
+# - macro which checks if the source code runs
+# SOURCE - source code to try to compile
+# VAR - variable to store size if the type exists.
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+
+MACRO(CHECK_C_SOURCE_RUNS SOURCE VAR)
+ IF("${VAR}" MATCHES "^${VAR}$")
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
+ "${SOURCE}\n")
+
+ MESSAGE(STATUS "Performing Test ${VAR}")
+ TRY_RUN(${VAR} ${VAR}_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+ # if it did not compile make the return value fail code of 1
+ IF(NOT ${VAR}_COMPILED)
+ SET(${VAR} 1)
+ ENDIF(NOT ${VAR}_COMPILED)
+ # if the return value was 0 then it worked
+ SET(result_var ${${VAR}})
+ IF("${result_var}" EQUAL 0)
+ SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+ MESSAGE(STATUS "Performing Test ${VAR} - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE("${result_var}" EQUAL 0)
+ MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${result_var}\n"
+ "Source file was:\n${SOURCE}\n")
+ ENDIF("${result_var}" EQUAL 0)
+ ENDIF("${VAR}" MATCHES "^${VAR}$")
+ENDMACRO(CHECK_C_SOURCE_RUNS)
+
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
new file mode 100644
index 0000000000..43ea9a64e5
--- /dev/null
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -0,0 +1,21 @@
+# - Check whether the CXX compiler supports a given flag.
+# CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE)
+#
+# FLAG - the compiler flag
+# VARIABLE - variable to store the result
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckCXXSourceCompiles)
+
+MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
+ SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+ CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
+ SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+ENDMACRO (CHECK_CXX_COMPILER_FLAG)
+
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index d8b8960940..3921c8910f 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -1,8 +1,8 @@
# - Check if the source code provided in the SOURCE argument compiles.
# CHECK_CXX_SOURCE_COMPILES(SOURCE VAR)
-# - macro which checks if the source code compiles\
+# - macro which checks if the source code compiles
# SOURCE - source code to try to compile
-# VAR - variable to store size if the type exists.
+# VAR - variable to store whether the source code compiled
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
@@ -41,7 +41,7 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
IF(${VAR})
- SET(${VAR} 1 CACHE INTERNAL "Test ${FUNCTION}")
+ SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
MESSAGE(STATUS "Performing Test ${VAR} - Success")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
@@ -49,7 +49,7 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
"Source file was:\n${SOURCE}\n")
ELSE(${VAR})
MESSAGE(STATUS "Performing Test ${VAR} - Failed")
- SET(${VAR} "" CACHE INTERNAL "Test ${FUNCTION}")
+ SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
new file mode 100644
index 0000000000..04ae7a964f
--- /dev/null
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -0,0 +1,68 @@
+# - Check if the source code provided in the SOURCE argument compiles and runs.
+# CHECK_CXX_SOURCE_RUNS(SOURCE VAR)
+# - macro which checks if the source code compiles
+# SOURCE - source code to try to compile
+# VAR - variable to store size if the type exists.
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+
+MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
+ IF("${VAR}" MATCHES "^${VAR}$")
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
+ "${SOURCE}\n")
+
+ MESSAGE(STATUS "Performing Test ${VAR}")
+ TRY_RUN(${VAR} ${VAR}_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+ # if it did not compile make the return value fail code of 1
+ IF(NOT ${VAR}_COMPILED)
+ SET(${VAR} 1)
+ ENDIF(NOT ${VAR}_COMPILED)
+ # if the return value was 0 then it worked
+ SET(result_var ${${VAR}})
+ IF("${result_var}" EQUAL 0)
+ SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+ MESSAGE(STATUS "Performing Test ${VAR} - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE("${result_var}" EQUAL 0)
+ MESSAGE(STATUS "Performing Test ${VAR} - Failed")
+ SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${${VAR}}\n"
+ "Source file was:\n${SOURCE}\n")
+ ENDIF("${result_var}" EQUAL 0)
+ ENDIF("${VAR}" MATCHES "^${VAR}$")
+ENDMACRO(CHECK_CXX_SOURCE_RUNS)
+
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
new file mode 100644
index 0000000000..978407d6b7
--- /dev/null
+++ b/Modules/FindASPELL.cmake
@@ -0,0 +1,40 @@
+# - Try to find ASPELL
+# Once done this will define
+#
+# ASPELL_FOUND - system has ASPELL
+# ASPELL_INCLUDE_DIR - the ASPELL include directory
+# ASPELL_LIBRARIES - The libraries needed to use ASPELL
+# ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+ # Already in cache, be silent
+ SET(ASPELL_FIND_QUIETLY TRUE)
+ENDIF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+
+FIND_PATH(ASPELL_INCLUDE_DIR aspell.h )
+
+FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15)
+
+IF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+ SET(ASPELL_FOUND TRUE)
+ELSE (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+ SET(ASPELL_FOUND FALSE)
+ENDIF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+
+IF (ASPELL_FOUND)
+ IF (NOT ASPELL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found ASPELL: ${ASPELL_LIBRARIES}")
+ ENDIF (NOT ASPELL_FIND_QUIETLY)
+ELSE (ASPELL_FOUND)
+ IF (ASPELL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find ASPELL")
+ ENDIF (ASPELL_FIND_REQUIRED)
+ENDIF (ASPELL_FOUND)
+
+MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES)
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
new file mode 100644
index 0000000000..c8464249be
--- /dev/null
+++ b/Modules/FindBZip2.cmake
@@ -0,0 +1,43 @@
+# - Try to find BZip2
+# Once done this will define
+#
+# BZIP2_FOUND - system has BZip2
+# BZIP2_INCLUDE_DIR - the BZip2 include directory
+# BZIP2_LIBRARIES - Link these to use BZip2
+# BZIP2_DEFINITIONS - Compiler switches required for using BZip2
+# BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+ SET(BZip2_FIND_QUIETLY TRUE)
+ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+
+FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
+
+FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
+
+IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+ SET(BZIP2_FOUND TRUE)
+ INCLUDE(CheckLibraryExists)
+ CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+ELSE (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+ SET(BZIP2_FOUND FALSE)
+ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+
+IF (BZIP2_FOUND)
+ IF (NOT BZip2_FIND_QUIETLY)
+ MESSAGE(STATUS "Found BZip2: ${BZIP2_LIBRARIES}")
+ ENDIF (NOT BZip2_FIND_QUIETLY)
+ELSE (BZIP2_FOUND)
+ IF (BZip2_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find BZip2")
+ ENDIF (BZip2_FIND_REQUIRED)
+ENDIF (BZIP2_FOUND)
+
+MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)
+
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index 6e6531a039..fff6e4d2b1 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -1,41 +1,79 @@
-# - this module looks for Doxygen and the path to Graphiz's dot
+# - This module looks for Doxygen and the path to Graphiz's dot
+# Doxygen is a documentation generation tool see http://www.doxygen.org
# With the OS X GUI version, it likes to be installed to /Applications and
# it contains the doxygen executable in the bundle. In the versions I've
# seen, it is located in Resources, but in general, more often binaries are
# located in MacOS.
-FIND_PROGRAM(DOXYGEN
- doxygen
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
+IF (NOT DOXYGEN_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for doxygen...")
+ENDIF (NOT DOXYGEN_FIND_QUIETLY)
+
+FIND_PROGRAM(DOXYGEN_EXECUTABLE
+ NAMES doxygen
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\doxygen_is1;Inno Setup: App Path]/bin"
/Applications/Doxygen.app/Contents/Resources
/Applications/Doxygen.app/Contents/MacOS
+ DOC "Doxygen documentation generation tool (http://www.doxygen.org)"
)
+IF (DOXYGEN_EXECUTABLE)
+ SET (DOXYGEN_FOUND "YES")
+ IF (NOT DOXYGEN_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for doxygen... - found ${DOXYGEN_EXECUTABLE}")
+ ENDIF (NOT DOXYGEN_FIND_QUIETLY)
+ELSE (DOXYGEN_EXECUTABLE)
+ IF (NOT DOXYGEN_FIND_QUIETLY)
+ IF (DOXYGEN_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Looking for doxygen... - NOT found")
+ ELSE (DOXYGEN_FIND_REQUIRED)
+ MESSAGE(STATUS "Looking for doxygen... - NOT found")
+ ENDIF (DOXYGEN_FIND_REQUIRED)
+ ENDIF (NOT DOXYGEN_FIND_QUIETLY)
+ENDIF (DOXYGEN_EXECUTABLE)
+
# In the older versions of OS X Doxygen, dot was included with the
# Doxygen bundle. But the new versions place make you download Graphviz.app
# which contains dot in its bundle.
-FIND_PROGRAM(DOT
- dot
- "$ENV{ProgramFiles}/ATT/Graphviz/bin"
+IF (NOT DOXYGEN_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for dot tool...")
+ENDIF (NOT DOXYGEN_FIND_QUIETLY)
+
+FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE
+ NAMES dot
+ PATHS "$ENV{ProgramFiles}/ATT/Graphviz/bin"
"C:/Program Files/ATT/Graphviz/bin"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
/Applications/Graphviz.app/Contents/MacOS
/Applications/Doxygen.app/Contents/Resources
/Applications/Doxygen.app/Contents/MacOS
+ DOC "Graphiz Dot tool for using Doxygen"
)
+IF (NOT DOXYGEN_FIND_QUIETLY)
+ IF (DOXYGEN_DOT_EXECUTABLE)
+ MESSAGE(STATUS "Looking for dot tool... - found ${DOXYGEN_DOT_EXECUTABLE}")
+ ELSE (DOXYGEN_DOT_EXECUTABLE)
+ MESSAGE(STATUS "Looking for dot tool... - NOT found")
+ ENDIF (DOXYGEN_DOT_EXECUTABLE)
+ENDIF (NOT DOXYGEN_FIND_QUIETLY)
+
+
# The Doxyfile wants the path to Dot, not the entire path and executable
-# so for convenience, I'll add another search for DOT_PATH.
-FIND_PATH(DOT_PATH
+# so for convenience, I'll add another search for DOXYGEN_DOT_PATH.
+FIND_PATH(DOXYGEN_DOT_PATH
dot
"C:/Program Files/ATT/Graphviz/bin"
[HKEY_LOCAL_MACHINE\\SOFTWARE\\ATT\\Graphviz;InstallPath]/bin
/Applications/Graphviz.app/Contents/MacOS
/Applications/Doxygen.app/Contents/Resources
/Applications/Doxygen.app/Contents/MacOS
+ DOC "Path to the Graphviz Dot tool"
)
MARK_AS_ADVANCED(
- DOT
- DOT_PATH
- DOXYGEN
-)
+ DOXYGEN_FOUND,
+ DOXYGEN_EXECUTABLE,
+ DOXYGEN_DOT_FOUND,
+ DOXYGEN_DOT_EXECUTABLE,
+ DOXYGEN_DOT_PATH,
+ )
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index e88a55f10f..f6fa551848 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -45,7 +45,7 @@ ELSE (WIN32)
/System/Library/Frameworks/GLUT.framework/Versions/A/Headers
${OPENGL_LIBRARY_DIR}
)
- SET(GLUT_glut_LIBRARY "-framework Glut" CACHE STRING "GLUT library for OSX")
+ SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
ELSE (APPLE)
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
new file mode 100644
index 0000000000..a2b93a77de
--- /dev/null
+++ b/Modules/FindHSPELL.cmake
@@ -0,0 +1,42 @@
+# - Try to find HSPELL
+# Once done this will define
+#
+# HSPELL_FOUND - system has HSPELL
+# HSPELL_INCLUDE_DIR - the HSPELL include directory
+# HSPELL_LIBRARIES - The libraries needed to use HSPELL
+# HSPELL_DEFINITIONS - Compiler switches required for using HSPELL
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
+ # Already in cache, be silent
+ SET(HSPELL_FIND_QUIETLY TRUE)
+ENDIF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
+
+
+FIND_PATH(HSPELL_INCLUDE_DIR hspell.h )
+
+FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell )
+
+IF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
+ SET(HSPELL_FOUND TRUE)
+ELSE (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
+ SET(HSPELL_FOUND FALSE)
+ENDIF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES)
+
+IF (HSPELL_FOUND)
+ IF (NOT HSPELL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found HSPELL: ${HSPELL_LIBRARIES}")
+ ENDIF (NOT HSPELL_FIND_QUIETLY)
+ELSE (HSPELL_FOUND)
+ IF (HSPELL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find HSPELL")
+ ENDIF (HSPELL_FIND_REQUIRED)
+ENDIF (HSPELL_FOUND)
+
+MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)
+
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
new file mode 100644
index 0000000000..ac284c3735
--- /dev/null
+++ b/Modules/FindJasper.cmake
@@ -0,0 +1,43 @@
+# - Try to find the Jasper JPEG2000 library
+# Once done this will define
+#
+# JASPER_FOUND - system has Jasper
+# JASPER_INCLUDE_DIR - the Jasper include directory
+# JASPER_LIBRARIES - The libraries needed to use Jasper
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+FIND_PACKAGE(JPEG)
+
+IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES)
+ # Already in cache, be silent
+ SET(Jasper_FIND_QUIETLY TRUE)
+ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES)
+
+FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h)
+
+FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper)
+
+IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
+ SET(JASPER_FOUND TRUE)
+ SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
+ELSE (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
+ SET(JASPER_FOUND FALSE)
+ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
+
+
+IF (JASPER_FOUND)
+ IF (NOT Jasper_FIND_QUIETLY)
+ MESSAGE(STATUS "Found jasper: ${JASPER_LIBRARIES}")
+ ENDIF (NOT Jasper_FIND_QUIETLY)
+ELSE (JASPER_FOUND)
+ IF (Jasper_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find jasper library")
+ ENDIF (Jasper_FIND_REQUIRED)
+ENDIF (JASPER_FOUND)
+
+MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY)
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index b2e702c9d0..f1545a02b3 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -5,7 +5,7 @@
# KDE3_INCLUDE_DIR - the KDE include directory
# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES()
# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES()
-# QT_AND_KDECORE_LIBRARIES - this contains both the Qt and the kdecore library
+# QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library
# KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable
# KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable
# KDE3_KCFGC_EXECUTABLE - the kconfig_compiler executable
@@ -98,56 +98,101 @@ ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD)
#SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
#SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
+# all calls to FIND_PROGRAM/PATH/LIBRARY() follow the same scheme:
+# at first try some special paths with the argument "NO_DEFAULT_PATH"
+# so only these paths are checked
+# this is followed by a second call to FIND_PROGRAM/PATH/LIBRARY()
+# but this time without any paths and without NO_DEFAULT_PATH
+# this second call will do nothing if the first call already found
+# what it was looking for, if not, it will search only in the default
+# directories (/usr, /usr/local, etc.)
+
#now try to find some kde stuff
+FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config PATHS
+ $ENV{KDEDIR}/bin
+ /opt/kde3/bin
+ /opt/kde/bin
+ NO_DEFAULT_PATH
+ )
+
+
+FIND_PROGRAM(KDECONFIG_EXECUTABLE kde-config)
+
+
+SET(KDE3PREFIX)
+IF(KDECONFIG_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE kde_config_version )
-#at first the KDE include direcory
+ STRING(REGEX MATCH "KDE: .\\." kde_version ${kde_config_version})
+ IF (${kde_version} MATCHES "KDE: 3\\.")
+ EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix
+ OUTPUT_VARIABLE kdedir )
+ STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}")
+
+ ENDIF (${kde_version} MATCHES "KDE: 3\\.")
+ENDIF(KDECONFIG_EXECUTABLE)
+
+
+
+# at first the KDE include direcory
# kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore
FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h
$ENV{KDEDIR}/include
- /opt/kde/include
+ ${KDE3PREFIX}/include
/opt/kde3/include
- /usr/local/include
- /usr/include/
+ /opt/kde/include
/usr/include/kde
/usr/local/include/kde
-)
+ NO_DEFAULT_PATH
+ )
+
+FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h)
#now the KDE library directory
FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore
PATHS
$ENV{KDEDIR}/lib
- /opt/kde/lib
+ ${KDE3PREFIX}/lib
/opt/kde3/lib
- /usr/lib
- /usr/local/lib
+ /opt/kde/lib
+ NO_DEFAULT_PATH
)
-GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH )
+FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore)
-#now the KDE service types directory
-#FIND_PATH(KDE3_SERVICETYPES_DIR ktexteditor.desktop
-# $ENV{KDEDIR}/share/servicetypes/
-# /opt/kde/share/servicetypes/
-# /opt/kde3/share/servicetypes/
-#)
+GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH )
#now search for the dcop utilities
-FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAME dcopidl PATHS
+FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl PATHS
$ENV{KDEDIR}/bin
- /opt/kde/bin
+ ${KDE3PREFIX}/bin
/opt/kde3/bin
+ /opt/kde/bin
+ NO_DEFAULT_PATH
)
-FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAME dcopidl2cpp PATHS
+FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl)
+
+FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp PATHS
$ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ /opt/kde3/bin
/opt/kde/bin
- /opt/kde3/bin)
+ NO_DEFAULT_PATH
+ )
-FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS
+FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp)
+
+FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler PATHS
$ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ /opt/kde3/bin
/opt/kde/bin
- /opt/kde3/bin)
+ NO_DEFAULT_PATH
+ )
+FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler)
# KDE3Macros.cmake contains all the KDE specific macros
INCLUDE(KDE3Macros)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
new file mode 100644
index 0000000000..b45d7293ba
--- /dev/null
+++ b/Modules/FindLibXml2.cmake
@@ -0,0 +1,59 @@
+# - Try to find LibXml2
+# Once done this will define
+#
+# LIBXML2_FOUND - system has LibXml2
+# LIBXML2_INCLUDE_DIR - the LibXml2 include directory
+# LIBXML2_LIBRARIES - the libraries needed to use LibXml2
+# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
+#
+# Copyright (c) 2006, Alexander Neundorf <neundorf@kde.org>
+# This code is available under the BSD license, see licenses/BSD for details.
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
+ # in cache already
+ SET(LibXml2_FIND_QUIETLY TRUE)
+ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
+
+IF (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ INCLUDE(UsePkgConfig)
+ PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags _LibXml2Cflags)
+ SET(LIBXML2_DEFINITIONS ${_LibXml2Cflags})
+ENDIF (NOT WIN32)
+
+FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
+ PATHS
+ ${_LibXml2IncDir}
+ PATH_SUFFIXES libxml2
+ )
+
+FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
+ PATHS
+ ${_LibXml2LinkDir}
+ )
+
+IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
+ SET(LIBXML2_FOUND TRUE)
+ELSE (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
+ SET(LIBXML2_FOUND FALSE)
+ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
+
+IF (LIBXML2_FOUND)
+ IF (NOT LibXml2_FIND_QUIETLY)
+ MESSAGE(STATUS "Found LibXml2: ${LIBXML2_LIBRARIES}")
+ ENDIF (NOT LibXml2_FIND_QUIETLY)
+ELSE (LIBXML2_FOUND)
+ IF (LibXml2_FIND_REQUIRED)
+ MESSAGE(SEND_ERROR "Could NOT find LibXml2")
+ ENDIF (LibXml2_FIND_REQUIRED)
+ENDIF (LIBXML2_FOUND)
+
+MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES)
+
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
new file mode 100644
index 0000000000..fcebd0c120
--- /dev/null
+++ b/Modules/FindLibXslt.cmake
@@ -0,0 +1,54 @@
+# - Try to find LibXslt
+# Once done this will define
+#
+# LIBXSLT_FOUND - system has LibXslt
+# LIBXSLT_INCLUDE_DIR - the LibXslt include directory
+# LIBXSLT_LIBRARIES - Link these to LibXslt
+# LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
+ # in cache already
+ SET(LibXslt_FIND_QUIETLY TRUE)
+ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
+
+IF (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ INCLUDE(UsePkgConfig)
+ PKGCONFIG(libxslt _LibXsltIncDir _LibXsltLinkDir _LibXsltLinkFlags _LibXsltCflags)
+ SET(LIBXSLT_DEFINITIONS ${_LibXsltCflags})
+ENDIF (NOT WIN32)
+
+FIND_PATH(LIBXSLT_INCLUDE_DIR libxslt/xslt.h
+ ${_LibXsltIncDir}
+ )
+
+FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt
+ PATHS
+ ${_LibXsltLinkDir}
+ )
+
+IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
+ SET(LIBXSLT_FOUND TRUE)
+ELSE (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
+ SET(LIBXSLT_FOUND FALSE)
+ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
+
+IF (LIBXSLT_FOUND)
+ IF (NOT LibXslt_FIND_QUIETLY)
+ MESSAGE(STATUS "Found LibXslt: ${LIBXSLT_LIBRARIES}")
+ ENDIF (NOT LibXslt_FIND_QUIETLY)
+ELSE (LIBXSLT_FOUND)
+ IF (LibXslt_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find LibXslt")
+ ENDIF (LibXslt_FIND_REQUIRED)
+ENDIF (LIBXSLT_FOUND)
+
+MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES)
+
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
new file mode 100644
index 0000000000..0172df83c6
--- /dev/null
+++ b/Modules/FindOpenSSL.cmake
@@ -0,0 +1,70 @@
+# - Try to find the OpenSSL encryption library
+# Once done this will define
+#
+# OPENSSL_FOUND - system has the OpenSSL library
+# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
+# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF(OPENSSL_LIBRARIES)
+ SET(OpenSSL_FIND_QUIETLY TRUE)
+ENDIF(OPENSSL_LIBRARIES)
+
+IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ SET(LIB_FOUND 1)
+ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+
+FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h )
+
+IF(WIN32 AND MSVC)
+ # /MD and /MDd are the standard values - if somone wants to use
+ # others, the libnames have to change here too
+ # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
+
+ FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32)
+ FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32)
+
+ IF(MSVC_IDE)
+ IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG})
+ ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ MESSAGE(FATAL_ERROR "Could not find the debug and release version of openssl")
+ ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
+ ELSE(MSVC_IDE)
+ STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG})
+ ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE})
+ ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ ENDIF(MSVC_IDE)
+ MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
+ELSE(WIN32 AND MSVC)
+
+ FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD )
+
+ENDIF(WIN32 AND MSVC)
+
+IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
+ SET(OPENSSL_FOUND TRUE)
+ELSE(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
+ SET(OPENSSL_FOUND FALSE)
+ENDIF (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)
+
+IF (OPENSSL_FOUND)
+ IF (NOT OpenSSL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found OpenSSL: ${OPENSSL_LIBRARIES}")
+ ENDIF (NOT OpenSSL_FIND_QUIETLY)
+ELSE (OPENSSL_FOUND)
+ IF (OpenSSL_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could NOT find OpenSSL")
+ ENDIF (OpenSSL_FIND_REQUIRED)
+ENDIF (OPENSSL_FOUND)
+
+MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
+
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index f078242346..797dd02542 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -12,10 +12,13 @@
# PNG depends on Zlib
INCLUDE(FindZLIB)
+SET(PNG_FOUND "NO")
+
IF(ZLIB_FOUND)
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
/usr/local/include
/usr/include
+ /usr/local/include/libpng # OpenBSD
)
SET(PNG_NAMES ${PNG_NAMES} png libpng)
@@ -42,4 +45,14 @@ IF(ZLIB_FOUND)
ENDIF(ZLIB_FOUND)
+IF (PNG_FOUND)
+ IF (NOT PNG_FIND_QUIETLY)
+ MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}")
+ ENDIF (NOT PNG_FIND_QUIETLY)
+ELSE (PNG_FOUND)
+ IF (PNG_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find PNG library")
+ ENDIF (PNG_FIND_REQUIRED)
+ENDIF (PNG_FOUND)
+
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index c0c58058b4..44a932d96c 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -7,8 +7,9 @@
#
FIND_PROGRAM(PYTHON_EXECUTABLE
- NAMES python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
+ NAMES python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 9379ff48af..3c07225f60 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -12,8 +12,10 @@ INCLUDE(CMakeFindFrameworks)
IF(WIN32)
FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
- NAMES python24_d python23_d python22_d python21_d python20_d python
+ NAMES python25_d python24_d python23_d python22_d python21_d python20_d python
PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/libs/Debug
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/libs
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs/Debug
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs/Debug
@@ -32,7 +34,8 @@ IF(WIN32)
ENDIF(WIN32)
FIND_LIBRARY(PYTHON_LIBRARY
- NAMES python24 python2.4
+ NAMES python25 python2.5
+ python24 python2.4
python23 python2.3
python22 python2.2
python21 python2.1
@@ -41,6 +44,7 @@ FIND_LIBRARY(PYTHON_LIBRARY
python15 python1.5
PATHS
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/libs
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/libs
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/libs
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/libs
@@ -50,6 +54,7 @@ FIND_LIBRARY(PYTHON_LIBRARY
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/libs
PATH_SUFFIXES
+ python2.5/config
python2.4/config
python2.3/config
python2.2/config
@@ -67,7 +72,7 @@ CMAKE_FIND_FRAMEWORKS(Python)
SET(PYTHON_FRAMEWORK_INCLUDES)
IF(Python_FRAMEWORKS)
IF(NOT PYTHON_INCLUDE_PATH)
- FOREACH(version 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
+ FOREACH(version 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
FOREACH(dir ${Python_FRAMEWORKS})
SET(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
${dir}/Versions/${version}/include/python${version})
@@ -81,6 +86,7 @@ FIND_PATH(PYTHON_INCLUDE_PATH
PATHS
${PYTHON_FRAMEWORK_INCLUDES}
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]/include
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]/include
@@ -90,6 +96,7 @@ FIND_PATH(PYTHON_INCLUDE_PATH
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]/include
PATH_SUFFIXES
+ python2.5
python2.4
python2.3
python2.2
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 3fb188d9e2..592631893f 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -28,10 +28,9 @@ FIND_PATH(QT_INCLUDE_DIR qt.h
$ENV{QTDIR}/include
${GLOB_PATHS_BIN}
/usr/local/qt/include
- /usr/local/include
/usr/lib/qt/include
+ /usr/lib/qt3/include
/usr/include/qt
- /usr/include
/usr/share/qt3/include
C:/Progra~1/qt/include
/usr/include/qt3
@@ -61,7 +60,7 @@ IF (QT_MT_REQUIRED)
FIND_LIBRARY(QT_QT_LIBRARY
NAMES
qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib}
- qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321
+ qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3
PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
@@ -69,9 +68,9 @@ IF (QT_MT_REQUIRED)
$ENV{QTDIR}/lib
${GLOB_PATHS_LIB}
/usr/local/qt/lib
- /usr/local/lib
/usr/lib/qt/lib
- /usr/lib
+ /usr/lib/qt3/lib
+ /usr/lib/qt3/lib64
/usr/share/qt3/lib
C:/Progra~1/qt/lib
/usr/X11R6/lib
@@ -82,7 +81,7 @@ ELSE (QT_MT_REQUIRED)
NAMES
qt qt-${qt_version_str_lib} qt-edu${qt_version_str_lib}
qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib}
- qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321
+ qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3
PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
@@ -90,9 +89,9 @@ ELSE (QT_MT_REQUIRED)
$ENV{QTDIR}/lib
${GLOB_PATHS_LIB}
/usr/local/qt/lib
- /usr/local/lib
/usr/lib/qt/lib
- /usr/lib
+ /usr/lib/qt3/lib
+ /usr/lib/qt3/lib64
/usr/share/qt3/lib
C:/Progra~1/qt/lib
/usr/X11R6/lib
@@ -113,8 +112,8 @@ FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY
$ENV{QTDIR}/lib
${GLOB_PATHS_LIB}
/usr/local/qt/lib
- /usr/local/lib
- /usr/lib
+ /usr/lib/qt3/lib
+ /usr/lib/qt3/lib64
/usr/share/qt3/lib
C:/Progra~1/qt/lib
/usr/X11R6/lib
@@ -138,6 +137,7 @@ FIND_PROGRAM(QT_MOC_EXECUTABLE
${GLOB_PATHS_BIN}
/usr/local/qt/bin
/usr/lib/qt/bin
+ /usr/lib/qt3/bin
/usr/share/qt3/bin
C:/Progra~1/qt/bin
/usr/X11R6/bin
@@ -162,6 +162,7 @@ FIND_PROGRAM(QT_UIC_EXECUTABLE uic
${GLOB_PATHS_BIN}
/usr/local/qt/bin
/usr/lib/qt/bin
+ /usr/lib/qt3/bin
/usr/share/qt3/bin
C:/Progra~1/qt/bin
/usr/X11R6/bin
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 3b11596526..d910747730 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -19,6 +19,9 @@
# QT_USE_QTOPENGL
# QT_USE_QTSQL
# QT_USE_QTXML
+# QT_USE_QTSVG
+# QT_USE_QTTEST
+# QT_USE_QTUITOOLS
#
# All the libraries required are stored in a variable called QT_LIBRARIES.
# Add this variable to your TARGET_LINK_LIBRARIES.
@@ -45,6 +48,7 @@
# QT_QTXML_FOUND True if QtXml was found.
# QT_QTSVG_FOUND True if QtSvg was found.
# QT_QTTEST_FOUND True if QtTest was found.
+# QT_QTUITOOLS_FOUND True if QtUiTools was found.
#
# QT_DEFINITIONS Definitions to use when compiling code that uses Qt.
#
@@ -167,26 +171,48 @@ SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
SET( QT_DEFINITIONS "")
-IF (WIN32)
- SET(QT_DEFINITIONS -DQT_DLL)
-ENDIF(WIN32)
-
# check for qmake
FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt4 PATHS
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
$ENV{QTDIR}/bin
-)
+ )
SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
+## macro for asking qmake to process pro files
+MACRO(QT_QUERY_QMAKE outvar invar)
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro
+ "message(CMAKE_MESSAGE<$$${invar}>)")
+ EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
+ WORKING_DIRECTORY
+ ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake
+ OUTPUT_VARIABLE _qmake_query_output
+ ERROR_VARIABLE _qmake_query_output )
+ FILE(REMOVE_RECURSE
+ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")
+ STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}")
+ENDMACRO(QT_QUERY_QMAKE)
+
IF (QT_QMAKE_EXECUTABLE)
SET(QT4_QMAKE_FOUND FALSE)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
-
+ # check for qt3 qmake and then try and find qmake-qt4 in the path
+ IF("${QTVERSION}" MATCHES "Unknown")
+ SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
+ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake-qt4 PATHS
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+ $ENV{QTDIR}/bin
+ )
+ IF(QT_QMAKE_EXECUTABLE)
+ EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
+ ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
+ ENDIF(QT_QMAKE_EXECUTABLE)
+ ENDIF("${QTVERSION}" MATCHES "Unknown")
# check that we found the Qt4 qmake, Qt3 qmake output won't match here
STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}")
IF (qt_version_tmp)
@@ -226,7 +252,6 @@ IF (QT_QMAKE_EXECUTABLE)
ELSE (found_vers LESS req_vers)
SET(QT4_QMAKE_FOUND TRUE)
ENDIF (found_vers LESS req_vers)
-
ENDIF (qt_version_tmp)
ENDIF (QT_QMAKE_EXECUTABLE)
@@ -391,7 +416,7 @@ IF (QT4_QMAKE_FOUND)
)
# Set QT_QTUITOOLS_INCLUDE_DIR
- FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtTest
+ FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtUiTools
PATHS
${QT_INCLUDE_DIR}/QtUiTools
${QT_LIBRARY_DIR}/QtUiTools.framework/Headers
@@ -467,11 +492,9 @@ IF (QT4_QMAKE_FOUND)
# Set QT_INCLUDES
SET( QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default )
-
-
# Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore." as part of the filename
FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH )
- FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+ FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
# Set QT_QT3SUPPORT_LIBRARY
FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
@@ -523,7 +546,7 @@ IF (QT4_QMAKE_FOUND)
IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
- MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check CMakeFiles/CMakeError.log for more details.")
+ MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
@@ -535,6 +558,14 @@ IF (QT4_QMAKE_FOUND)
FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+ # Set QT_QTMAIN_LIBRARY
+ IF(WIN32)
+ FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain PATHS ${QT_LIBRARY_DIR}
+ NO_DEFAULT_PATH)
+ FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmaind PATHS ${QT_LIBRARY_DIR}
+ NO_DEFAULT_PATH)
+ ENDIF(WIN32)
+
############################################
#
# Check the existence of the libraries.
@@ -557,13 +588,16 @@ IF (QT4_QMAKE_FOUND)
SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG})
SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG})
ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
-
IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
- IF(NOT MSVC)
- SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE})
- ELSE(NOT MSVC)
+ # if the generator supports configuration types then set
+ # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+ IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
- ENDIF(NOT MSVC)
+ ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+ # then just use the release libraries
+ SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} )
+ ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
@@ -582,7 +616,10 @@ IF (QT4_QMAKE_FOUND)
ENDMACRO (_QT4_ADJUST_LIB_VARS)
IF(WIN32)
+ # there is no include for qtmain but adjust macro needs it set
+ SET(QT_QTMAIN_INCLUDE_DIR 1)
_QT4_ADJUST_LIB_VARS(QTMAIN)
+ SET(QT_QTMAIN_INCLUDE_DIR )
ENDIF(WIN32)
@@ -603,6 +640,8 @@ IF (QT4_QMAKE_FOUND)
_QT4_ADJUST_LIB_VARS(QTUITOOLS)
_QT4_ADJUST_LIB_VARS(QTTEST)
+
+
#######################################
#
# Check the executables of Qt
@@ -612,23 +651,8 @@ IF (QT4_QMAKE_FOUND)
# find moc and uic using qmake
- FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro
- "message(MOC<$$QMAKE_MOC>)
- message(UIC<$$QMAKE_UIC>)
- ")
-
- EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
- WORKING_DIRECTORY
- ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake
- OUTPUT_VARIABLE _moc_OUTPUT
- ERROR_VARIABLE _moc_OUTPUT )
- FILE(REMOVE_RECURSE
- "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")
-
- STRING(REGEX REPLACE
- ".*MOC<([^>]+).*" "\\1" QT_MOC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" )
- STRING(REGEX REPLACE
- ".*UIC<([^>]+).*" "\\1" QT_UIC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" )
+ QT_QUERY_QMAKE(QT_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC")
+ QT_QUERY_QMAKE(QT_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC")
FILE(TO_CMAKE_PATH
"${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL)
@@ -820,23 +844,142 @@ IF (QT4_QMAKE_FOUND)
ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
SET(QT_FOUND ${QT4_FOUND})
-
#######################################
#
- # System dependent settings
+ # Qt configuration
#
#######################################
- # for unix add X11 stuff
- IF(UNIX)
- # on OS X X11 may not be required
- IF (Q_WS_X11)
- FIND_PACKAGE(X11)
- ENDIF (Q_WS_X11)
- FIND_PACKAGE(Threads)
- SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
- ENDIF(UNIX)
+ IF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
+ FILE(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents)
+ STRING(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG ${_qconfig_FILE_contents})
+ STRING(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG ${_qconfig_FILE_contents})
+ ENDIF(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
+ ###############################################
+ #
+ # configuration/system dependent settings
+ #
+ ###############################################
+
+ SET(QT_GUI_LIB_DEPENDENCIES "")
+ SET(QT_CORE_LIB_DEPENDENCIES "")
+
+ # shared build needs -DQT_SHARED
+ IF(NOT QT_CONFIG MATCHES "static")
+ # warning currently only qconfig.pri on Windows potentially contains "static"
+ # so QT_SHARED might not get defined properly on Mac/X11 (which seems harmless right now)
+ # Trolltech said they'd consider exporting it for all platforms in future releases.
+ SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_SHARED)
+ ENDIF(NOT QT_CONFIG MATCHES "static")
+
+ ## system png
+ IF(QT_QCONFIG MATCHES "system-png")
+ FIND_LIBRARY(QT_PNG_LIBRARY NAMES png)
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY})
+ MARK_AS_ADVANCED(QT_PNG_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "system-png")
+
+ # for X11, get X11 library directory
+ IF(Q_WS_X11)
+ QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11")
+ ENDIF(Q_WS_X11)
+
+ ## X11 SM
+ IF(QT_QCONFIG MATCHES "x11sm")
+ # ask qmake where the x11 libs are
+ FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11})
+ FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY})
+ MARK_AS_ADVANCED(QT_X11_SM_LIBRARY)
+ MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "x11sm")
+
+ ## Xi
+ IF(QT_QCONFIG MATCHES "tablet")
+ FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY})
+ MARK_AS_ADVANCED(QT_XI_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "tablet")
+
+ ## Xrender
+ IF(QT_QCONFIG MATCHES "xrender")
+ FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY})
+ MARK_AS_ADVANCED(QT_XRENDER_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "xrender")
+
+ ## Xrandr
+ IF(QT_QCONFIG MATCHES "xrandr")
+ FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY})
+ MARK_AS_ADVANCED(QT_XRANDR_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "xrandr")
+
+ ## Xcursor
+ IF(QT_QCONFIG MATCHES "xcursor")
+ FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY})
+ MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "xcursor")
+
+ ## Xinerama
+ IF(QT_QCONFIG MATCHES "xinerama")
+ FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY})
+ MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "xinerama")
+
+ ## system-freetype
+ IF(QT_QCONFIG MATCHES "system-freetype")
+ FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype)
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY})
+ MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "system-freetype")
+
+ ## fontconfig
+ IF(QT_QCONFIG MATCHES "fontconfig")
+ FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig)
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY})
+ MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "fontconfig")
+
+ ## system-zlib
+ IF(QT_QCONFIG MATCHES "system-zlib")
+ FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z)
+ SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY})
+ MARK_AS_ADVANCED(QT_ZLIB_LIBRARY)
+ ENDIF(QT_QCONFIG MATCHES "system-zlib")
+
+ IF(Q_WS_X11)
+ # X11 libraries Qt absolutely depends on
+ QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11")
+ SEPARATE_ARGUMENTS(QT_LIBS_X11)
+ FOREACH(QT_X11_LIB ${QT_LIBS_X11})
+ STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}")
+ SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY")
+ FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11})
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}})
+ ENDFOREACH(QT_X11_LIB)
+
+ QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD")
+ SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD})
+
+ QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD")
+ SET (QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD})
+
+ ENDIF(Q_WS_X11)
+
+ IF(Q_WS_WIN)
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} Imm32 Winmm)
+ SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} Ws2_32)
+ ENDIF(Q_WS_WIN)
+
+ IF(Q_WS_MAC)
+ SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} "-framework Carbon" "-framework QuickTime")
+ SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} "-framework ApplicationServices")
+ ENDIF(Q_WS_MAC)
+
#######################################
#
# compatibility settings
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 5052614fd4..943b1319c3 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -1,34 +1,54 @@
-# - Find ruby
-# This module finds if RUBY is installed and determines where the include files
+# - Find Ruby
+# This module finds if Ruby is installed and determines where the include files
# and libraries are. It also determines what the name of the library is. This
# code sets the following variables:
#
# RUBY_INCLUDE_PATH = path to where ruby.h can be found
# RUBY_EXECUTABLE = full path to the ruby binary
-#
-SET(RUBY_POSSIBLE_INCLUDE_PATHS
- /usr/lib/ruby/1.8/i386-linux
- )
+# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
-SET(RUBY_POSSIBLE_LIB_PATHS
- /usr/lib
- )
-FIND_PATH(RUBY_INCLUDE_PATH ruby.h
- ${RUBY_POSSIBLE_INCLUDE_PATHS})
+if(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+ # Already in cache, be silent
+ set(RUBY_FIND_QUIETLY TRUE)
+endif (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+
+# RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
+# RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
+# RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
+# RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
+# RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
+
+FIND_PROGRAM(RUBY_EXECUTABLE NAMES ruby ruby1.8 ruby18 )
+
+EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['archdir']"
+ OUTPUT_VARIABLE RUBY_ARCH_DIR)
-FIND_LIBRARY(RUBY_LIBRARY
- NAMES ruby1.8
- PATHS ${RUBY_POSSIBLE_LIB_PATHS}
- )
-FIND_PROGRAM(RUBY_EXECUTABLE
- NAMES ruby1.8
+EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['libdir']"
+ OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_PATH)
+
+EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['rubylibdir']"
+ OUTPUT_VARIABLE RUBY_RUBY_LIB_PATH)
+
+# remove the new lines from the output by replacing them with empty strings
+STRING(REPLACE "\n" "" RUBY_ARCH_DIR "${RUBY_ARCH_DIR}")
+STRING(REPLACE "\n" "" RUBY_POSSIBLE_LIB_PATH "${RUBY_POSSIBLE_LIB_PATH}")
+STRING(REPLACE "\n" "" RUBY_RUBY_LIB_PATH "${RUBY_RUBY_LIB_PATH}")
+
+
+FIND_PATH(RUBY_INCLUDE_PATH
+ NAMES ruby.h
PATHS
- /usr/bin
- /usr/local/bin
-)
+ ${RUBY_ARCH_DIR}
+ /usr/lib/ruby/1.8/i586-linux-gnu/ )
+
+FIND_LIBRARY(RUBY_LIBRARY
+ NAMES ruby
+ PATHS ${RUBY_POSSIBLE_LIB_PATH}
+ )
MARK_AS_ADVANCED(
RUBY_EXECUTABLE
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index 21b96dfa23..62766d6ede 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -159,3 +159,4 @@ IF(SDL_LIBRARY_TEMP)
SET(SDL_FOUND "YES")
ENDIF(SDL_LIBRARY_TEMP)
+MARK_AS_ADVANCED(SDL_LIBRARY_TEMP)
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 79a4611bd0..d43b75d86c 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -137,8 +137,9 @@ IF (WIN32)
${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
MARK_AS_ADVANCED(TK_INTERNAL_PATH)
+ENDIF(WIN32)
- MARK_AS_ADVANCED(
+MARK_AS_ADVANCED(
TCL_TCLSH_PATH
TK_WISH_PATH
TCL_INCLUDE_PATH
@@ -147,13 +148,10 @@ IF (WIN32)
TCL_LIBRARY_DEBUG
TK_LIBRARY
TK_LIBRARY_DEBUG
- )
-ENDIF(WIN32)
-
-MARK_AS_ADVANCED(
TCL_STUB_LIBRARY
TCL_STUB_LIBRARY_DEBUG
TK_STUB_LIBRARY
+ TK_STUB_LIBRARY
TK_STUB_LIBRARY_DEBUG
)
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 7e0fb3387b..fc0bbb53d3 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -539,8 +539,8 @@ ELSE(WIN32_STYLE_FIND)
SET(wxWidgets_FOUND TRUE)
# run the wx-config program to get cxxflags
- EXEC_PROGRAM(${wxWidgets_CONFIG_EXECUTABLE}
- ARGS "--cxxflags"
+ EXEC_PROGRAM(sh
+ ARGS "${wxWidgets_CONFIG_EXECUTABLE} --cxxflags"
OUTPUT_VARIABLE wxWidgets_CXX_FLAGS
RETURN_VALUE RET)
IF(RET EQUAL 0)
@@ -583,8 +583,8 @@ ELSE(WIN32_STYLE_FIND)
# be useful here...
#STRING(REPLACE ";" "," wxWidgets_USE_LIBS "${wxWidgets_USE_LIBS}")
STRING(REGEX REPLACE ";" "," wxWidgets_USE_LIBS "${wxWidgets_USE_LIBS}")
- EXEC_PROGRAM(${wxWidgets_CONFIG_EXECUTABLE}
- ARGS "--libs ${wxWidgets_USE_LIBS}"
+ EXEC_PROGRAM(sh
+ ARGS "${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_USE_LIBS}"
OUTPUT_VARIABLE wxWidgets_LIBRARIES
RETURN_VALUE RET)
IF(RET EQUAL 0)
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 8d431bfcd5..4ffdb1b3f4 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -17,9 +17,20 @@ IF(MSVC)
)
ENDIF(MSVC71)
IF(MSVC80)
+ # Find the runtime library redistribution directory.
+ FIND_PATH(MSVC80_REDIST_DIR NAMES x86/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/redist"
+ )
+ MARK_AS_ADVANCED(MSVC80_REDIST_DIR)
+ SET(MSVC80_CRT_DIR "${MSVC80_REDIST_DIR}/x86/Microsoft.VC80.CRT")
+
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
SET(__install__libs
- "${SYSTEMROOT}/system32/msvcp80.dll"
- "${SYSTEMROOT}/system32/msvcr80.dll"
+ "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest"
+ "${MSVC80_CRT_DIR}/msvcm80.dll"
+ "${MSVC80_CRT_DIR}/msvcp80.dll"
+ "${MSVC80_CRT_DIR}/msvcr80.dll"
)
ENDIF(MSVC80)
IF(CMAKE_INSTALL_MFC_LIBRARIES)
@@ -34,8 +45,12 @@ IF(MSVC)
)
ENDIF(MSVC71)
IF(MSVC80)
+ SET(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/x86/Microsoft.VC80.MFC")
+ # Install the manifest that allows DLLs to be loaded from the
+ # directory containing the executable.
SET(__install__libs ${__install__libs}
- "${SYSTEMROOT}/system32/mfc80.dll"
+ "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest"
+ "${MSVC80_MFC_DIR}/mfc80.dll"
)
ENDIF(MSVC80)
ENDIF(CMAKE_INSTALL_MFC_LIBRARIES)
diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake
index 0c2ae191ab..6866fe2835 100644
--- a/Modules/KDE3Macros.cmake
+++ b/Modules/KDE3Macros.cmake
@@ -1,4 +1,4 @@
-
+#
# See FindKDE3.cmake for documentation.
#
@@ -36,9 +36,10 @@ MACRO(KDE3_ADD_DCOP_SKELS _sources)
ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
- ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} > ${_kidl}
+ ARGS ${_tmp_FILE} > ${_kidl}
DEPENDS ${_tmp_FILE}
)
+
ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
IF (NOT HAVE_${_basename}_SKEL_RULE)
@@ -75,8 +76,8 @@ MACRO(KDE3_ADD_DCOP_STUBS _sources)
ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
- ARGS ${tmp_FILE} > ${_kidl}
- DEPENDS ${tmp_FILE}
+ ARGS ${_tmp_FILE} > ${_kidl}
+ DEPENDS ${_tmp_FILE}
)
ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
@@ -163,13 +164,14 @@ MACRO(KDE3_ADD_UI_FILES _sources )
ADD_CUSTOM_COMMAND(OUTPUT ${_header}
COMMAND ${QT_UIC_EXECUTABLE}
- ARGS -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
+ ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
DEPENDS ${_tmp_FILE}
)
ADD_CUSTOM_COMMAND(OUTPUT ${_src}
COMMAND ${CMAKE_COMMAND}
ARGS
+ -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer
-DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
-DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
-DKDE_UIC_CPP_FILE:FILEPATH=${_src}
@@ -236,49 +238,64 @@ MACRO(KDE3_AUTOMOC)
ENDFOREACH (_current_FILE)
ENDMACRO(KDE3_AUTOMOC)
+# only used internally by KDE3_INSTALL_ICONS
+MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME)
-MACRO(KDE3_INSTALL_ICONS _theme)
- ADD_CUSTOM_TARGET(install_icons )
- SET_TARGET_PROPERTIES(install_icons PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake )
- FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "# icon installations rules\n")
- FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "SET(CMAKE_BACKWARDS_COMPATIBILITY \"2.2\") \n")
-
- FILE(GLOB _icons *.png)
- FOREACH(_current_ICON ${_icons} )
- STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
- STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
- STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
-
+ # if the string doesn't match the pattern, the result is the full string, so all three have the same content
+ IF (NOT ${_group} STREQUAL ${_install_NAME} )
SET(_icon_GROUP "actions")
- IF(${_group} STREQUAL "mime")
+ IF (${_group} STREQUAL "mime")
SET(_icon_GROUP "mimetypes")
- ENDIF(${_group} STREQUAL "mime")
+ ENDIF (${_group} STREQUAL "mime")
- IF(${_group} STREQUAL "filesys")
+ IF (${_group} STREQUAL "filesys")
SET(_icon_GROUP "filesystems")
- ENDIF(${_group} STREQUAL "filesys")
+ ENDIF (${_group} STREQUAL "filesys")
- IF(${_group} STREQUAL "device")
+ IF (${_group} STREQUAL "device")
SET(_icon_GROUP "devices")
- ENDIF(${_group} STREQUAL "device")
+ ENDIF (${_group} STREQUAL "device")
- IF(${_group} STREQUAL "app")
+ IF (${_group} STREQUAL "app")
SET(_icon_GROUP "apps")
- ENDIF(${_group} STREQUAL "app")
+ ENDIF (${_group} STREQUAL "app")
- IF(${_group} STREQUAL "action")
+ IF (${_group} STREQUAL "action")
SET(_icon_GROUP "actions")
- ENDIF(${_group} STREQUAL "action")
+ ENDIF (${_group} STREQUAL "action")
# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
- SET(_ICON_INSTALL_NAME ${CMAKE_INSTALL_PREFIX}/share/icons/${_theme}/${_size}x${_size}/${_icon_GROUP}/${_name})
- FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "message(STATUS \"Installing ${_ICON_INSTALL_NAME}\") \n")
- FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "CONFIGURE_FILE( ${_current_ICON} ${_ICON_INSTALL_NAME} COPYONLY) \n")
+ INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} )
+ ENDIF (NOT ${_group} STREQUAL ${_install_NAME} )
+
+ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE)
+
+
+MACRO (KDE3_INSTALL_ICONS _theme )
+ SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons")
+ # first the png icons
+ FILE(GLOB _icons *.png)
+ FOREACH (_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
+ _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
+ ${_defaultpath}/${_theme}/${_size}x${_size}
+ ${_group} ${_current_ICON} ${_name})
+ ENDFOREACH (_current_ICON)
+ # and now the svg icons
+ FILE(GLOB _icons *.svgz)
+ FOREACH (_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}")
+ _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
+ ${_defaultpath}/${_theme}/scalable
+ ${_group} ${_current_ICON} ${_name})
ENDFOREACH (_current_ICON)
-ENDMACRO(KDE3_INSTALL_ICONS)
+ENDMACRO (KDE3_INSTALL_ICONS)
MACRO(KDE3_INSTALL_LIBTOOL_FILE _target)
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake
index be02529c3d..b83a9b6a47 100644
--- a/Modules/Platform/AIX.cmake
+++ b/Modules/Platform/AIX.cmake
@@ -31,3 +31,27 @@ ELSE(CMAKE_COMPILER_IS_GNUCC)
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+
+
+# since .a can be a static or shared library on AIX, we can not do this.
+# at some point if we wanted it, we would have to figure out if a .a is
+# static or shared, then we could add this back:
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+#FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+# SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-bstatic")
+# SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-bdynamic")
+#ENDFOREACH(type)
diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake
index c7ccd986b7..fe34bfc563 100644
--- a/Modules/Platform/CYGWIN.cmake
+++ b/Modules/Platform/CYGWIN.cmake
@@ -27,4 +27,17 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>")
+
+# Shared libraries on cygwin can be named with their version number.
+SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 884690a451..e26c6f2126 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -45,8 +45,15 @@ IF(NOT XCODE)
# soname computation.
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name")
+ SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name")
ENDIF(NOT XCODE)
+# Xcode does not support -isystem yet.
+IF(XCODE)
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
+ SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ENDIF(XCODE)
+
SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS -w)
@@ -55,6 +62,8 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
+SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
+ "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_CREATE_SHARED_MODULE
"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
@@ -62,6 +71,10 @@ SET(CMAKE_CXX_CREATE_SHARED_MODULE
SET(CMAKE_C_CREATE_SHARED_MODULE
"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+SET(CMAKE_Fortran_CREATE_SHARED_MODULE
+ "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+
+
SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES /usr/local/include)
# default to searching for frameworks first
diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake
index 7ce53454b0..3970acf469 100644
--- a/Modules/Platform/FreeBSD.cmake
+++ b/Modules/Platform/FreeBSD.cmake
@@ -8,4 +8,14 @@ IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,")
ENDIF(EXISTS /usr/include/dlfcn.h)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake
index 8c149edcdc..f7fd3f0265 100644
--- a/Modules/Platform/HP-UX.cmake
+++ b/Modules/Platform/HP-UX.cmake
@@ -71,3 +71,36 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
# set flags for gcc support
INCLUDE(Platform/UnixPaths)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+
+# Initialize C and CXX link type selection flags. These flags are
+# used when building a shared library, shared module, or executable
+# that links to other libraries to select whether to use the static or
+# shared versions of the libraries. Note that C modules and shared
+# libs are built using ld directly so we leave off the "-Wl," portion.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default")
+ENDFOREACH(type)
+FOREACH(type EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")
+ENDFOREACH(type)
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive")
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default")
+ENDFOREACH(type)
+
diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake
index 776bb4a7dc..54522804af 100644
--- a/Modules/Platform/IRIX.cmake
+++ b/Modules/Platform/IRIX.cmake
@@ -15,3 +15,19 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
# set flags for gcc support
INCLUDE(Platform/UnixPaths)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake
index fbd35a69e0..1229947822 100644
--- a/Modules/Platform/IRIX64.cmake
+++ b/Modules/Platform/IRIX64.cmake
@@ -44,3 +44,19 @@ IF(NOT CMAKE_COMPILER_IS_GNUCC)
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
INCLUDE(Platform/UnixPaths)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE>"
+ "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
+ )
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index 6ae2ed51d5..498e49126a 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -7,4 +7,15 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,")
+SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
index 740aff710f..e85b571be2 100644
--- a/Modules/Platform/QNX.cmake
+++ b/Modules/Platform/QNX.cmake
@@ -1,6 +1,10 @@
# GCC is the default compiler on QNX 6.3.
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
+# The QNX GCC does not seem to have -isystem so remove the flag.
+SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
+SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
@@ -9,3 +13,12 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
index 0d3f183c54..aa1e9337e0 100644
--- a/Modules/Platform/SunOS.cmake
+++ b/Modules/Platform/SunOS.cmake
@@ -61,3 +61,40 @@ ELSE(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_CXX_COMPILER)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(Platform/UnixPaths)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+IF(CMAKE_COMPILER_IS_GNUCC)
+ FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ ENDFOREACH(type)
+ELSE(CMAKE_COMPILER_IS_GNUCC)
+ FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
+ ENDFOREACH(type)
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bdynamic")
+ ENDFOREACH(type)
+ELSE(CMAKE_COMPILER_IS_GNUCXX)
+ FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic")
+ ENDFOREACH(type)
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
index 5515a303a9..b6232e995c 100644
--- a/Modules/Platform/UnixPaths.cmake
+++ b/Modules/Platform/UnixPaths.cmake
@@ -1,6 +1,32 @@
-SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /usr/include
- /usr/local/include /usr/local /opt/local/include /usr/X11R6/include /usr/include/X11 /usr/pkg/include)
-SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /lib /usr/lib /usr/local/lib
- /usr/lib/w32api /usr/X11R6/lib /opt/local/lib /opt/csw/lib /opt/lib /usr/pkg/lib)
-SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} /bin /usr/bin /usr/local/bin
- /usr/pkg/bin /sbin)
+SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH}
+ # Standard
+ /include /usr/include /usr/local/include
+
+ # Windows API on Cygwin
+ /usr/include/w32api
+
+ # X11
+ /usr/X11R6/include /usr/include/X11
+
+ # Other
+ /opt/local/include /usr/pkg/include
+ )
+
+SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}
+ # Standard
+ /lib /usr/lib /usr/local/lib
+
+ # Windows API on Cygwin
+ /usr/lib/w32api
+
+ # X11
+ /usr/X11R6/lib /usr/lib/X11
+
+ # Other
+ /opt/local/lib /usr/pkg/lib
+ /opt/csw/lib /opt/lib
+ )
+
+SET(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH}
+ /bin /usr/bin /usr/local/bin /usr/pkg/bin /sbin
+ )
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index ba306adc8e..0005aa4242 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -24,7 +24,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_LIBRARY}")
# create a C++ static library
-SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "link /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
# create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
@@ -44,6 +44,18 @@ SET(CMAKE_C_LINK_EXECUTABLE
SET(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> /Fd<TARGET_PDB> -link <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE
+ "<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
+ "<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
+
+SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
+ "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> /TP /FAs /FoNUL /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
+
SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows)
SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console)
@@ -198,16 +210,20 @@ ENDIF(CMAKE_FORCE_WIN64)
IF(MSVC80)
# for 2005 make sure the manifest is put in the dll with mt
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
- "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2")
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ )
SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared library
SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared module just copy the shared library rule
SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_LIBRARY}")
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}"
- "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2")
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ )
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}"
- "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2")
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ )
+
SET(CMAKE_BUILD_TYPE_INIT Debug)
SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
@@ -220,6 +236,7 @@ IF(MSVC80)
SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST")
ELSE(MSVC80)
IF(CMAKE_USING_VC_FREE_TOOLS)
MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available")
@@ -257,9 +274,11 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
# set the stack size and the machine type
IF(CMAKE_CL_64)
- SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:x64")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:x64")
ELSE(CMAKE_CL_64)
- SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:I386")
ENDIF(CMAKE_CL_64)
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp
diff --git a/Modules/Platform/Windows-gcc.cmake b/Modules/Platform/Windows-gcc.cmake
index b3bf19f59d..a5152b3b17 100644
--- a/Modules/Platform/Windows-gcc.cmake
+++ b/Modules/Platform/Windows-gcc.cmake
@@ -34,3 +34,14 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> <OBJECTS> <LINK_LIBRARIES>")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+IF(MSYS OR MINGW)
+ FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ ENDFOREACH(type)
+ENDIF(MSYS OR MINGW)
diff --git a/Modules/Platform/gcc.cmake b/Modules/Platform/gcc.cmake
index 6543f5c03f..7d3235b416 100644
--- a/Modules/Platform/gcc.cmake
+++ b/Modules/Platform/gcc.cmake
@@ -4,6 +4,9 @@ IF(CMAKE_COMPILER_IS_GNUCC)
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+ SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ SET (CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
IF(CMAKE_COMPILER_IS_GNUCXX)
@@ -12,5 +15,8 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+ SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
+ SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+ SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/Modules/UseEcos.cmake b/Modules/UseEcos.cmake
index a61c48471e..7979831005 100644
--- a/Modules/UseEcos.cmake
+++ b/Modules/UseEcos.cmake
@@ -1,10 +1,13 @@
# - This module defines variables and macros required to build eCos application.
# This file contains the following macros:
# ECOS_ADD_INCLUDE_DIRECTORIES() - add the eCos include dirs
+# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an eCos executable
+# ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts the path of the source files and puts the result into VAR
+#
+# Macros for selecting the toolchain:
# ECOS_USE_ARM_ELF_TOOLS() - enable the ARM ELF toolchain for the directory where it is called
+# ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF toolchain for the directory where it is called
# ECOS_USE_PPC_EABI_TOOLS() - enable the PowerPC toolchain for the directory where it is called
-# ECOS_ADD_EXECUTABLE(name source1 ... sourceN ) - create an executable for eCos
-# ECOS_ADJUST_DIRECTORY(source1 ... sourceN )
#
# It contains the following variables:
# ECOS_DEFINITIONS
@@ -78,6 +81,21 @@ MACRO (ECOS_USE_PPC_EABI_TOOLS)
SET(ECOS_ARCH_PREFIX "powerpc-eabi-")
ENDMACRO (ECOS_USE_PPC_EABI_TOOLS)
+#usage: ECOS_USE_I386_ELF_TOOLS()
+MACRO (ECOS_USE_I386_ELF_TOOLS)
+ SET(CMAKE_CXX_COMPILER "i386-elf-c++")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ SET(CMAKE_C_COMPILER "i386-elf-gcc")
+ SET(CMAKE_AR "i386-elf-ar")
+ SET(CMAKE_RANLIB "i386-elf-ranlib")
+#for linking
+ SET(ECOS_LD_MCPU "")
+#for compiling
+ ADD_DEFINITIONS()
+#for the obj-tools
+ SET(ECOS_ARCH_PREFIX "i386-elf-")
+ENDMACRO (ECOS_USE_I386_ELF_TOOLS)
+
#since the actual sources are located one level upwards
#a "../" has to be prepended in front of every source file
@@ -150,20 +168,14 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME )
SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> ${_ecos_EXTRA_LIBS} -nostdlib -nostartfiles -L${CMAKE_CURRENT_SOURCE_DIR}/ecos/install/lib -Ttarget.ld ${ECOS_LD_MCPU}")
ADD_EXECUTABLE(${_exe_NAME} ${ARGN})
-
-#under win32 the ".exe" suffix is appended to the binary name, copy it so that it exists also without the prefix
-#otherwise the following custom commands don't work
- IF(WIN32)
- ADD_CUSTOM_COMMAND(TARGET ${_exe_NAME} POST_BUILD COMMAND cp ARGS ${_exe_NAME}.exe ${_exe_NAME}_ )
- ADD_CUSTOM_COMMAND(TARGET ${_exe_NAME} POST_BUILD COMMAND mv ARGS ${_exe_NAME}_ ${_exe_NAME} )
- ENDIF(WIN32)
+ SET_TARGET_PROPERTIES(${_exe_NAME} PROPERTIES SUFFIX ".elf")
#create a binary file
ADD_CUSTOM_COMMAND(
TARGET ${_exe_NAME}
POST_BUILD
COMMAND ${ECOS_ARCH_PREFIX}objcopy
- ARGS -O binary ${_exe_NAME} ${_exe_NAME}.bin
+ ARGS -O binary ${_exe_NAME}.elf ${_exe_NAME}.bin
)
#and an srec file
@@ -171,11 +183,11 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME )
TARGET ${_exe_NAME}
POST_BUILD
COMMAND ${ECOS_ARCH_PREFIX}objcopy
- ARGS -O srec ${_exe_NAME} ${_exe_NAME}.srec
+ ARGS -O srec ${_exe_NAME}.elf ${_exe_NAME}.srec
)
#add the created files to the make_clean_files
- SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};${_exe_NAME};${_exe_NAME}.bin;${_exe_NAME}.srec;${_exe_NAME}.lst;)
+ SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};${_exe_NAME}.bin;${_exe_NAME}.srec;${_exe_NAME}.lst;)
SET_DIRECTORY_PROPERTIES(
PROPERTIES
@@ -192,11 +204,11 @@ MACRO(ECOS_ADD_EXECUTABLE _exe_NAME )
ADD_CUSTOM_TARGET( listing
COMMAND echo -e \"\\n--- Symbols sorted by address ---\\n\" > ${_exe_NAME}.lst
- COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${_exe_NAME} >> ${_exe_NAME}.lst
+ COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -n ${_exe_NAME}.elf >> ${_exe_NAME}.lst
COMMAND echo -e \"\\n--- Symbols sorted by size ---\\n\" >> ${_exe_NAME}.lst
- COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${_exe_NAME} >> ${_exe_NAME}.lst
+ COMMAND ${ECOS_ARCH_PREFIX}nm -S -C -r --size-sort ${_exe_NAME}.elf >> ${_exe_NAME}.lst
COMMAND echo -e \"\\n--- Full assembly listing ---\\n\" >> ${_exe_NAME}.lst
- COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${_exe_NAME} >> ${_exe_NAME}.lst )
+ COMMAND ${ECOS_ARCH_PREFIX}objdump -S -x -d -C ${_exe_NAME}.elf >> ${_exe_NAME}.lst )
ENDMACRO(ECOS_ADD_EXECUTABLE)
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index 62a1edf539..938edb69a5 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -10,209 +10,82 @@ INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
SET(QT_LIBRARIES "")
-IF (NOT QT_DONT_USE_QTCORE)
- IF (QT_QTCORE_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTCORE_INCLUDE_DIR})
- ADD_DEFINITIONS(-DQT_CORE_LIB)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTCORE_LIBRARY}"
- debug "${QT_QTCORE_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTCORE_LIBRARY}" )
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- IF (UNIX)
- IF (CMAKE_DL_LIBS)
- SET (QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_DL_LIBS})
- ENDIF (CMAKE_DL_LIBS)
- ENDIF (UNIX)
- ELSE (QT_QTCORE_FOUND)
- MESSAGE("QtCore library not found.")
- ENDIF (QT_QTCORE_FOUND)
-ENDIF (NOT QT_DONT_USE_QTCORE)
+IF (QT_USE_QTMAIN)
+ IF (WIN32)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
+ ENDIF (WIN32)
+ENDIF (QT_USE_QTMAIN)
-IF (NOT QT_DONT_USE_QTGUI)
- IF (QT_QTGUI_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTGUI_INCLUDE_DIR})
- ADD_DEFINITIONS(-DQT_GUI_LIB)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTGUI_LIBRARY}"
- debug "${QT_QTGUI_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTGUI_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- IF (UNIX)
- IF (X11_FOUND)
- SET (QT_LIBRARIES ${QT_LIBRARIES} ${X11_LIBRARIES})
- ENDIF (X11_FOUND)
- ENDIF (UNIX)
- ELSE (QT_QTGUI_FOUND)
- MESSAGE("QtGui library not found.")
- ENDIF (QT_QTGUI_FOUND)
-ENDIF (NOT QT_DONT_USE_QTGUI)
+# Macro for setting up compile flags for Qt modules
+MACRO(QT_MODULE_SETUP module)
+ IF (QT_QT${module}_FOUND)
+ ADD_DEFINITIONS(-DQT_${module}_LIB)
+ INCLUDE_DIRECTORIES(${QT_QT${module}_INCLUDE_DIR})
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT${module}_LIBRARY})
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
+ ELSE (QT_QT${module}_FOUND)
+ MESSAGE("Qt ${module} library not found.")
+ ENDIF (QT_QT${module}_FOUND)
+ENDMACRO(QT_MODULE_SETUP)
+
+
+# Qt modules (in order of dependence)
IF (QT_USE_QT3SUPPORT)
- IF (QT_QT3SUPPORT_FOUND)
- INCLUDE_DIRECTORIES(${QT_QT3SUPPORT_INCLUDE_DIR})
+ QT_MODULE_SETUP(3SUPPORT)
ADD_DEFINITIONS(-DQT3_SUPPORT)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QT3SUPPORT_LIBRARY}"
- debug "${QT_QT3SUPPORT_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QT3SUPPORT_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QT3SUPPORT_FOUND)
- MESSAGE("Qt3Support library not found.")
- ENDIF (QT_QT3SUPPORT_FOUND)
ENDIF (QT_USE_QT3SUPPORT)
+IF (QT_USE_QTOPENGL)
+ QT_MODULE_SETUP(OPENGL)
+ENDIF (QT_USE_QTOPENGL)
+
IF (QT_USE_QTASSISTANT)
- IF (QT_QTASSISTANT_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTASSISTANT_INCLUDE_DIR})
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTASSISTANT_LIBRARY}"
- debug "${QT_QTASSISTANT_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTASSISTANT_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTASSISTANT_FOUND)
- MESSAGE("QtAssistant library not found.")
- ENDIF (QT_QTASSISTANT_FOUND)
+ QT_MODULE_SETUP(ASSISTANT)
ENDIF (QT_USE_QTASSISTANT)
IF (QT_USE_QTDESIGNER)
- IF (QT_QTDESIGNER_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTDESIGNER_INCLUDE_DIR})
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTDESIGNER_LIBRARY}"
- debug "${QT_QTDESIGNER_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTDESIGNER_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTDESIGNER_FOUND)
- MESSAGE("QtDesigner library not found.")
- ENDIF (QT_QTDESIGNER_FOUND)
+ QT_MODULE_SETUP(DESIGNER)
ENDIF (QT_USE_QTDESIGNER)
-IF (QT_USE_QTMAIN)
- IF (WIN32)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTMAIN_LIBRARY}"
- debug "${QT_QTMAIN_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTMAIN_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ENDIF (WIN32)
-ENDIF (QT_USE_QTMAIN)
-
IF (QT_USE_QTMOTIF)
- IF (QT_QTMOTIF_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTMOTIF_INCLUDE_DIR})
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTMOTIF_LIBRARY}"
- debug "${QT_QTMOTIF_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTMOTIF_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTMOTIF_FOUND)
- MESSAGE("QtMotif library not found.")
- ENDIF (QT_QTMOTIF_FOUND)
+ QT_MODULE_SETUP(MOTIF)
ENDIF (QT_USE_QTMOTIF)
-IF (QT_USE_QTNETWORK)
- IF (QT_QTNETWORK_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTNETWORK_INCLUDE_DIR})
- ADD_DEFINITIONS(-DQT_NETWORK_LIB)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTNETWORK_LIBRARY}"
- debug "${QT_QTNETWORK_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTNETWORK_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTNETWORK_FOUND)
- MESSAGE("QtNetwork library not found.")
- ENDIF (QT_QTNETWORK_FOUND)
-ENDIF (QT_USE_QTNETWORK)
-
IF (QT_USE_QTNSPLUGIN)
- IF (QT_QTNSPLUGIN_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTNSPLUGIN_INCLUDE_DIR})
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTNSPLUGIN_LIBRARY}"
- debug "${QT_QTNSPLUGIN_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTNSPLUGIN_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTNSPLUGIN_FOUND)
- MESSAGE("QtNsPlugin library not found.")
- ENDIF (QT_QTNSPLUGIN_FOUND)
+ QT_MODULE_SETUP(NSPLUGIN)
ENDIF (QT_USE_QTNSPLUGIN)
-IF (QT_USE_QTOPENGL)
- IF (QT_QTOPENGL_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTOPENGL_INCLUDE_DIR})
- ADD_DEFINITIONS(-DQT_OPENGL_LIB)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTOPENGL_LIBRARY}"
- debug "${QT_QTOPENGL_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTOPENGL_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTOPENGL_FOUND)
- MESSAGE("QtOpenGL library not found.")
- ENDIF (QT_QTOPENGL_FOUND)
-ENDIF (QT_USE_QTOPENGL)
+IF (QT_USE_QTSVG)
+ QT_MODULE_SETUP(SVG)
+ENDIF (QT_USE_QTSVG)
-IF (QT_USE_QTSQL)
- IF (QT_QTSQL_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTSQL_INCLUDE_DIR})
- ADD_DEFINITIONS(-DQT_SQL_LIB)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTSQL_LIBRARY}"
- debug "${QT_QTSQL_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTSQL_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTSQL_FOUND)
- MESSAGE("QtSql library not found.")
- ENDIF (QT_QTSQL_FOUND)
-ENDIF (QT_USE_QTSQL)
+IF (QT_USE_QTUITOOLS)
+ QT_MODULE_SETUP(UITOOLS)
+ENDIF (QT_USE_QTUITOOLS)
+
+IF (NOT QT_DONT_USE_QTGUI)
+ QT_MODULE_SETUP(GUI)
+ENDIF (NOT QT_DONT_USE_QTGUI)
+
+IF (QT_USE_QTTEST)
+ QT_MODULE_SETUP(TEST)
+ENDIF (QT_USE_QTTEST)
IF (QT_USE_QTXML)
- IF (QT_QTXML_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTXML_INCLUDE_DIR})
- ADD_DEFINITIONS(-DQT_XML_LIB)
- IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES}
- optimized "${QT_QTXML_LIBRARY}"
- debug "${QT_QTXML_LIBRARY_DEBUG}"
- )
- ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_QTXML_LIBRARY}")
- ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- ELSE (QT_QTXML_FOUND)
- MESSAGE("QtXml library not found.")
- ENDIF (QT_QTXML_FOUND)
+ QT_MODULE_SETUP(XML)
ENDIF (QT_USE_QTXML)
+IF (QT_USE_QTSQL)
+ QT_MODULE_SETUP(SQL)
+ENDIF (QT_USE_QTSQL)
+
+IF (QT_USE_QTNETWORK)
+ QT_MODULE_SETUP(NETWORK)
+ENDIF (QT_USE_QTNETWORK)
+
+IF (NOT QT_DONT_USE_QTCORE)
+ QT_MODULE_SETUP(CORE)
+ENDIF (NOT QT_DONT_USE_QTCORE)
+
+
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index b107d6c8bb..fee83a53dd 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -12,6 +12,8 @@
# special flags to all swig calls.
# Another special variable is CMAKE_SWIG_OUTDIR, it allows one to specify
# where to write all the swig generated module (swig -outdir option)
+# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
+# to specify extra dependencies for the generated modules.
SET(SWIG_CXX_EXTENSION "cxx")
SET(SWIG_EXTRA_LIBRARIES "")
@@ -145,6 +147,7 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
MAIN_DEPENDENCY "${swig_source_file_fullname}"
+ DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
COMMENT "Swig source")
ELSE(CMAKE_SWIG_OUTDIR)
ADD_CUSTOM_COMMAND(
@@ -160,6 +163,7 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
-o "${swig_generated_file_fullname}"
"${swig_source_file_fullname}"
MAIN_DEPENDENCY "${swig_source_file_fullname}"
+ DEPENDS ${SWIG_MODULE_${name}_EXTRA_DEPS}
COMMENT "Swig source")
ENDIF(CMAKE_SWIG_OUTDIR)
SET_SOURCE_FILES_PROPERTIES("${swig_generated_file_fullname}"
diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake
index f41b2a3b62..0dbbbcf1db 100644
--- a/Modules/kde3uic.cmake
+++ b/Modules/kde3uic.cmake
@@ -5,7 +5,7 @@
EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE}
- -nounload -tr tr2i18n
+ -L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n
-impl ${KDE_UIC_H_FILE}
${KDE_UIC_FILE}
OUTPUT_VARIABLE _uic_CONTENTS
diff --git a/Modules/readme.txt b/Modules/readme.txt
index b9bd805d3d..4c31b6b691 100644
--- a/Modules/readme.txt
+++ b/Modules/readme.txt
@@ -16,7 +16,7 @@ XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command.
XXX_YY_FOUND If False, optional YY part of XXX sytem is not available.
XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX.
-You do not have to provide all of the above variables. You should provide XXX_FOUND under most circumstances. If XXX is a library, then XXX_LIBRARIES, should also be defined, and XXX_INCLUDE_DIR should usually be defined (I guess libm.a might be an exception)
+You do not have to provide all of the above variables. You should provide XXX_FOUND under most circumstances. If XXX is a library, then XXX_LIBRARIES, should also be defined, and XXX_INCLUDE_DIRS should usually be defined (I guess libm.a might be an exception)
The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in users' CMake Caches to control stuff.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 71ed0d46ee..483ac82cb7 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -19,6 +19,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_ZLIB_INCLUDES}
${CMAKE_EXPAT_INCLUDES}
${CMAKE_TAR_INCLUDES}
+ ${CMAKE_COMPRESS_INCLUDES}
)
# let cmake know it is supposed to use it
@@ -122,6 +123,8 @@ SET(SRCS
cmInstallScriptGenerator.cxx
cmInstallTargetGenerator.h
cmInstallTargetGenerator.cxx
+ cmInstallDirectoryGenerator.h
+ cmInstallDirectoryGenerator.cxx
cmListFileCache.cxx
cmListFileCache.h
cmListFileLexer.c
@@ -215,11 +218,13 @@ ENDIF (WIN32)
# create a library used by the command line and the GUI
ADD_LIBRARY(CMakeLib ${SRCS})
-TARGET_LINK_LIBRARIES(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES})
+TARGET_LINK_LIBRARIES(CMakeLib cmsys
+ ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
+ ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES})
# On Apple we need Carbon
IF(APPLE)
- TARGET_LINK_LIBRARIES(CMakeLib "-framework Carbon")
+ TARGET_LINK_LIBRARIES(CMakeLib "-framework CoreFoundation")
ENDIF(APPLE)
# On some platforms we need the rpcrt4 library for the VS 7 generators.
@@ -592,7 +597,7 @@ IF(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/Complex"
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
- --build-project complex
+ --build-project Complex
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin"
--build-options
@@ -605,7 +610,7 @@ IF(BUILD_TESTING)
"${CMake_SOURCE_DIR}/Tests/ComplexOneConfig"
"${CMake_BINARY_DIR}/Tests/ComplexOneConfig"
--build-generator ${CMAKE_TEST_GENERATOR}
- --build-project complex
+ --build-project Complex
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
--build-options
@@ -691,7 +696,7 @@ IF(BUILD_TESTING)
"${CMake_SOURCE_DIR}/Tests/Testing"
"${CMake_BINARY_DIR}/Tests/Testing"
--build-generator ${CMAKE_TEST_GENERATOR}
- --build-project testing
+ --build-project Testing
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Testing/bin"
--test-command testing
@@ -702,7 +707,7 @@ IF(BUILD_TESTING)
"${CMake_SOURCE_DIR}/Tests/Wrapping"
"${CMake_BINARY_DIR}/Tests/Wrapping"
--build-generator ${CMAKE_TEST_GENERATOR}
- --build-project wrapping
+ --build-project Wrapping
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--test-command wrapping
@@ -856,7 +861,7 @@ IF(BUILD_TESTING)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLine"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-project Linkline
+ --build-project LinkLine
--test-command Exec
)
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index bac5d74c81..8b1c879981 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -248,7 +248,7 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(const char* topdir,
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
{
- kwsys_stl::string fullPath = topdir;
+ cmsys_stl::string fullPath = topdir;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
if(cmsys::SystemTools::FileIsDirectory(fullPath.c_str()) &&
diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx
index b9110056f7..65ff6a7d14 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.cxx
+++ b/Source/CPack/cmCPackTarCompressGenerator.cxx
@@ -26,19 +26,25 @@
#include "cmCPackLog.h"
#include <cmsys/SystemTools.hxx>
+#include <cmcompress/cmcompress.h>
+#include <libtar/libtar.h>
+#include <memory> // auto_ptr
+#include <fcntl.h>
+#include <errno.h>
-// Includes needed for implementation of RenameFile. This is not in
-// system tools because it is not implemented robustly enough to move
-// files across directories.
-#ifdef _WIN32
-# include <windows.h>
-# include <sys/stat.h>
-#endif
+//----------------------------------------------------------------------
+class cmCPackTarCompressGeneratorForward
+{
+public:
+ static int GenerateHeader(cmCPackTarCompressGenerator* gg, std::ostream* os)
+ {
+ return gg->GenerateHeader(os);
+ }
+};
//----------------------------------------------------------------------
cmCPackTarCompressGenerator::cmCPackTarCompressGenerator()
{
- this->Compress = false;
}
//----------------------------------------------------------------------
@@ -47,123 +53,192 @@ cmCPackTarCompressGenerator::~cmCPackTarCompressGenerator()
}
//----------------------------------------------------------------------
-int cmCPackTarCompressGenerator::InitializeInternal()
+class cmCPackTarCompress_Data
{
- this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
- std::vector<std::string> path;
- std::string pkgPath = cmSystemTools::FindProgram("compress", path, false);
- if ( pkgPath.empty() )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find Compress" << std::endl);
- return 0;
- }
- this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
- << pkgPath.c_str()
- << std::endl);
+public:
+ cmCPackTarCompress_Data(cmCPackTarCompressGenerator* gen) :
+ OutputStream(0), Generator(gen) {}
+ std::ostream* OutputStream;
+ cmCPackTarCompressGenerator* Generator;
+ cmcompress_stream CMCompressStream;
+};
- return this->Superclass::InitializeInternal();
+//----------------------------------------------------------------------
+extern "C" {
+ // For cmTar
+ int cmCPackTarCompress_Data_Open(void *client_data, const char* name,
+ int oflags, mode_t mode);
+ ssize_t cmCPackTarCompress_Data_Write(void *client_data, void *buff,
+ size_t n);
+ int cmCPackTarCompress_Data_Close(void *client_data);
+
+ // For cmCompress
+ int cmCPackTarCompress_Compress_Output(void* cdata, const char* data,
+ int len);
}
+
//----------------------------------------------------------------------
-int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
- const char* toplevel, const std::vector<std::string>& files)
+int cmCPackTarCompress_Data_Open(void *client_data, const char* pathname,
+ int, mode_t)
{
- std::string packageDirFileName
- = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
- packageDirFileName += ".tar";
- std::string output;
- int retVal = -1;
- if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
- toplevel, files) )
+ cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data;
+
+ if ( !cmcompress_compress_initialize(&mydata->CMCompressStream) )
{
- return 0;
+ return -1;
}
- cmOStringStream dmgCmd1;
- dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
- << "\" \"" << packageDirFileName
- << "\"";
- retVal = -1;
- int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
- &retVal, toplevel, this->GeneratorVerbose, 0);
- if ( !res || retVal )
+ mydata->CMCompressStream.client_data = mydata;
+ mydata->CMCompressStream.output_stream = cmCPackTarCompress_Compress_Output;
+
+ cmGeneratedFileStream* gf = new cmGeneratedFileStream;
+ // Open binary
+ gf->Open(pathname, false, true);
+ mydata->OutputStream = gf;
+ if ( !*mydata->OutputStream )
{
- std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
- tmpFile += "/CompressCompress.log";
- cmGeneratedFileStream ofs(tmpFile.c_str());
- ofs << "# Run command: " << dmgCmd1.str().c_str() << std::endl
- << "# Output:" << std::endl
- << output.c_str() << std::endl;
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running Compress command: "
- << dmgCmd1.str().c_str() << std::endl
- << "Please check " << tmpFile.c_str() << " for errors" << std::endl);
- return 0;
+ return -1;
}
- std::string compressOutFile = packageDirFileName + ".Z";
- if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
+ if ( !cmcompress_compress_start(&mydata->CMCompressStream) )
{
- if ( !this->RenameFile(compressOutFile.c_str(), outFileName) )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \""
- << compressOutFile.c_str() << "\" to \""
- << outFileName << std::endl);
- return 0;
+ return -1;
}
+
+
+ if ( !cmCPackTarCompressGeneratorForward::GenerateHeader(
+ mydata->Generator,gf))
+ {
+ return -1;
}
- return 1;
+ return 0;
}
-//----------------------------------------------------------------------------
-int cmCPackTarCompressGenerator::RenameFile(const char* oldname,
- const char* newname)
+//----------------------------------------------------------------------
+ssize_t cmCPackTarCompress_Data_Write(void *client_data, void *buff, size_t n)
{
-#ifdef _WIN32
- /* On Windows the move functions will not replace existing files.
- Check if the destination exists. */
- struct stat newFile;
- if(stat(newname, &newFile) == 0)
+ cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data;
+
+ if ( !cmcompress_compress(&mydata->CMCompressStream, buff, n) )
{
- /* The destination exists. We have to replace it carefully. The
- MoveFileEx function does what we need but is not available on
- Win9x. */
- OSVERSIONINFO osv;
- DWORD attrs;
-
- /* Make sure the destination is not read only. */
- attrs = GetFileAttributes(newname);
- if(attrs & FILE_ATTRIBUTE_READONLY)
+ return 0;
+ }
+ return n;
+}
+
+//----------------------------------------------------------------------
+int cmCPackTarCompress_Data_Close(void *client_data)
+{
+ cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data;
+
+ if ( !cmcompress_compress_finalize(&mydata->CMCompressStream) )
{
- SetFileAttributes(newname, attrs & ~FILE_ATTRIBUTE_READONLY);
+ delete mydata->OutputStream;
+ return -1;
}
- /* Check the windows version number. */
- osv.dwOSVersionInfoSize = sizeof(osv);
- GetVersionEx(&osv);
- if(osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+ delete mydata->OutputStream;
+ mydata->OutputStream = 0;
+ return (0);
+}
+
+//----------------------------------------------------------------------
+int cmCPackTarCompressGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
+ return this->Superclass::InitializeInternal();
+}
+
+//----------------------------------------------------------------------
+int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl);
+ cmCPackTarCompress_Data mydata(this);
+ TAR *t;
+ char buf[TAR_MAXPATHLEN];
+ char pathname[TAR_MAXPATHLEN];
+
+ tartype_t compressType = {
+ (openfunc_t)cmCPackTarCompress_Data_Open,
+ (closefunc_t)cmCPackTarCompress_Data_Close,
+ (readfunc_t)0,
+ (writefunc_t)cmCPackTarCompress_Data_Write,
+ &mydata
+ };
+
+ // Ok, this libtar is not const safe. for now use auto_ptr hack
+ char* realName = new char[ strlen(outFileName) + 1 ];
+ std::auto_ptr<char> realNamePtr(realName);
+ strcpy(realName, outFileName);
+ int flags = O_WRONLY | O_CREAT;
+ if (tar_open(&t, realName,
+ &compressType,
+ flags, 0644,
+ (this->GeneratorVerbose?TAR_VERBOSE:0)
+ | 0) == -1)
{
- /* This is Win9x. There is no MoveFileEx implementation. We
- cannot quite rename the file atomically. Just delete the
- destination and then move the file. */
- DeleteFile(newname);
- return MoveFile(oldname, newname);
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
+ << strerror(errno) << std::endl);
+ return 0;
}
- else
+
+ std::vector<std::string>::const_iterator fileIt;
+ for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
+ {
+ std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str());
+ strncpy(pathname, fileIt->c_str(), sizeof(pathname));
+ pathname[sizeof(pathname)-1] = 0;
+ strncpy(buf, rp.c_str(), sizeof(buf));
+ buf[sizeof(buf)-1] = 0;
+ if (tar_append_tree(t, pathname, buf) != 0)
{
- /* This is not Win9x. Use the MoveFileEx implementation. */
- return MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING);
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Problem with tar_append_tree(\"" << buf << "\", \""
+ << pathname << "\"): "
+ << strerror(errno) << std::endl);
+ tar_close(t);
+ return 0;
+ }
+ }
+ if (tar_append_eof(t) != 0)
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): "
+ << strerror(errno) << std::endl);
+ tar_close(t);
+ return 0;
}
+
+ if (tar_close(t) != 0)
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): "
+ << strerror(errno) << std::endl);
+ return 0;
}
- else
+ return 1;
+}
+
+//----------------------------------------------------------------------
+int cmCPackTarCompress_Compress_Output(void* client_data,
+ const char* data, int data_length)
+{
+ cmcompress_stream *cstream = static_cast<cmcompress_stream*>(client_data);
+ cmCPackTarCompress_Data *mydata
+ = static_cast<cmCPackTarCompress_Data*>(cstream->client_data);
+ mydata->OutputStream->write(data, data_length);
+
+ if ( !mydata->OutputStream )
{
- /* The destination does not exist. Just move the file. */
- return MoveFile(oldname, newname);
+ return 0;
}
-#else
- /* On UNIX we have an OS-provided call to do this atomically. */
- return rename(oldname, newname) == 0;
-#endif
+ return data_length;
}
+//----------------------------------------------------------------------
+int cmCPackTarCompressGenerator::GenerateHeader(std::ostream* os)
+{
+ (void)os;
+ return 1;
+}
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
index efd5579456..75adb22d8a 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ b/Source/CPack/cmCPackTarCompressGenerator.h
@@ -42,6 +42,7 @@ protected:
virtual const char* GetOutputExtension() { return "tar.Z"; }
int RenameFile(const char* oldname, const char* newname);
+ int GenerateHeader(std::ostream* os);
};
#endif
diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx
index 3d46f80f41..1b12f07328 100644
--- a/Source/CPack/cmCPackZIPGenerator.cxx
+++ b/Source/CPack/cmCPackZIPGenerator.cxx
@@ -91,20 +91,22 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
std::string tempFileName;
+ tempFileName = toplevel;
+ tempFileName += "/winZip.filelist";
+ bool needQuotesInFile = false;
cmOStringStream dmgCmd;
switch ( this->ZipStyle )
{
case cmCPackZIPGenerator::StyleWinZip:
- tempFileName = toplevel;
- tempFileName += "/winZip.filelist";
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" -P \"" << outFileName
- << "\" @\"" << tempFileName.c_str() << "\"";
+ << "\" @winZip.filelist";
+ needQuotesInFile = true;
break;
case cmCPackZIPGenerator::StyleUnixZip:
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
- << "\" \"" << outFileName
- << "\"";
+ << "\" -r \"" << outFileName
+ << "\" . -i@winZip.filelist";
break;
default:
cmCPackLogger(cmCPackLog::LOG_ERROR, "Unknown ZIP style"
@@ -117,9 +119,16 @@ int cmCPackZIPGenerator::CompressFiles(const char* outFileName,
std::vector<std::string>::const_iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{
- out << "\""
- << cmSystemTools::RelativePath(toplevel, fileIt->c_str())
- << "\"" << std::endl;
+ if ( needQuotesInFile )
+ {
+ out << "\"";
+ }
+ out << cmSystemTools::RelativePath(toplevel, fileIt->c_str());
+ if ( needQuotesInFile )
+ {
+ out << "\"";
+ }
+ out << std::endl;
}
}
else
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 90421f9935..d6d1cead53 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -308,6 +308,8 @@ int main (int argc, char *argv[])
"CPack generator not specified" << std::endl);
parsed = 0;
}
+ else
+ {
std::vector<std::string> generatorsVector;
cmSystemTools::ExpandListArgument(genList,
generatorsVector);
@@ -370,6 +372,47 @@ int main (int argc, char *argv[])
<< std::endl);
parsed = 0;
}
+ if ( parsed )
+ {
+#ifdef _WIN32
+ std::string comspec = "cmw9xcom.exe";
+ cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str());
+#endif
+
+ const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
+ cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: "
+ << cpackGenerator->GetNameOfClass() << std::endl);
+ cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: "
+ << projName << std::endl);
+
+ const char* projVersion =
+ mf->GetDefinition("CPACK_PACKAGE_VERSION");
+ if ( !projVersion )
+ {
+ const char* projVersionMajor
+ = mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR");
+ const char* projVersionMinor
+ = mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
+ const char* projVersionPatch
+ = mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
+ cmOStringStream ostr;
+ ostr << projVersionMajor << "." << projVersionMinor << "."
+ << projVersionPatch;
+ mf->AddDefinition("CPACK_PACKAGE_VERSION",
+ ostr.str().c_str());
+ }
+
+ int res = cpackGenerator->ProcessGenerator();
+ if ( !res )
+ {
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
+ "Error when generating package: " << projName << std::endl);
+ return 1;
+ }
+ }
+ }
+ }
+ }
}
}
@@ -405,41 +448,6 @@ int main (int argc, char *argv[])
#define cout no_cout_use_cmCPack_Log
}
-#ifdef _WIN32
- std::string comspec = "cmw9xcom.exe";
- cmSystemTools::SetWindows9xComspecSubstitute(comspec.c_str());
-#endif
-
- const char* projName = mf->GetDefinition("CPACK_PACKAGE_NAME");
- cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Use generator: "
- << cpackGenerator->GetNameOfClass() << std::endl);
- cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "For project: "
- << projName << std::endl);
-
- const char* projVersion = mf->GetDefinition("CPACK_PACKAGE_VERSION");
- if ( !projVersion )
- {
- const char* projVersionMajor
- = mf->GetDefinition("CPACK_PACKAGE_VERSION_MAJOR");
- const char* projVersionMinor
- = mf->GetDefinition("CPACK_PACKAGE_VERSION_MINOR");
- const char* projVersionPatch
- = mf->GetDefinition("CPACK_PACKAGE_VERSION_PATCH");
- cmOStringStream ostr;
- ostr << projVersionMajor << "." << projVersionMinor << "."
- << projVersionPatch;
- mf->AddDefinition("CPACK_PACKAGE_VERSION", ostr.str().c_str());
- }
-
- int res = cpackGenerator->ProcessGenerator();
- if ( !res )
- {
- cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
- "Error when generating package: " << projName << std::endl);
- return 1;
- }
- }
- }
return 0;
}
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 6948bc6dec..d82015bdc0 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -117,6 +117,9 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
return 1;
}
}
+ out << "======== CMake output ======\n";
+ out << cmakeOutString;
+ out << "======== End CMake output ======\n";
return 0;
}
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index fc194aa921..81bc53498f 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -37,6 +37,9 @@
#include <math.h>
#include <float.h>
+#if defined(__BORLANDC__)
+# pragma warn -8060 /* possibly incorrect assignment */
+#endif
static const char* cmCTestErrorMatches[] = {
"^[Bb]us [Ee]rror",
@@ -72,7 +75,7 @@ static const char* cmCTestErrorMatches[] = {
": Can't find library for",
": internal link edit command failed",
": Unrecognized option \\`.*\\'",
- "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^W]\\)",
+ "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^WI]\\)",
"ld: 0706-006 Cannot find or open library file: -l ",
"ild: \\(argument error\\) can't find library argument ::",
"^could not be found and will not be loaded.",
@@ -116,7 +119,7 @@ static const char* cmCTestWarningMatches[] = {
"WARNING: ",
"([^ :]+) : warning",
"([^:]+): warning",
- "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\(W\\)",
+ "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([WI]\\)",
"^cxx: Warning:",
".*file: .* has no symbols",
"([^ :]+):([0-9]+): (Warning|Warnung)",
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 30187e898d..3e06656be5 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -254,6 +254,7 @@ int cmCTestCoverageHandler::ProcessHandler()
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find any coverage files."
<< std::endl);
// No coverage files is a valid thing, so the exit code is 0
+ cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return 0;
}
@@ -602,7 +603,7 @@ int cmCTestCoverageHandler::ProcessHandler()
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot open coverage summary file." << std::endl);
-
+ cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return -1;
}
@@ -615,6 +616,7 @@ int cmCTestCoverageHandler::ProcessHandler()
int logFileCount = 0;
if ( !this->StartCoverageLogFile(covLogFile, logFileCount) )
{
+ cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return -1;
}
totalCoverageMap::iterator fileIterator;
@@ -650,6 +652,7 @@ int cmCTestCoverageHandler::ProcessHandler()
logFileCount ++;
if ( !this->StartCoverageLogFile(covLogFile, logFileCount) )
{
+ cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return -1;
}
}
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 2313569c6a..da53d34010 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -48,7 +48,9 @@ bool cmCTestHandlerCommand::InitialPass(
cmCTestGenericHandler* handler = this->InitializeHandler();
if ( !handler )
{
- this->SetError("internal CTest error. Cannot instantiate test handler");
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Cannot instantiate test handler " << this->GetName()
+ << std::endl);
return false;
}
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 5b73e2ac00..0254214f1d 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -385,6 +385,11 @@ int cmCTestScriptHandler::ExtractVariables()
= this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
this->BinaryDir
= this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
+
+ // add in translations for src and bin
+ cmSystemTools::AddKeepPath(this->SourceDir.c_str());
+ cmSystemTools::AddKeepPath(this->BinaryDir.c_str());
+
this->CTestCmd
= this->Makefile->GetSafeDefinition("CTEST_COMMAND");
this->CVSCheckOut
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index 30aff0b8ab..01b48c226b 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -76,6 +76,10 @@ bool cmCTestStartCommand::InitialPass(
"as an argument or set CTEST_BINARY_DIRECTORY");
return false;
}
+
+ cmSystemTools::AddKeepPath(src_dir);
+ cmSystemTools::AddKeepPath(bld_dir);
+
this->CTest->EmptyCTestConfiguration();
this->CTest->SetCTestConfiguration("SourceDirectory",
cmSystemTools::CollapseFullPath(src_dir).c_str());
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 3ec419add0..f8be1228ec 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -451,7 +451,8 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT,
(this->MemCheck ? "Memory check" : "Test")
- << " project" << std::endl);
+ << " project " << cmSystemTools::GetCurrentWorkingDirectory()
+ << std::endl);
if ( ! this->PreProcessHandler() )
{
return -1;
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index dd0b0826e2..8de98218a6 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -110,11 +110,14 @@ int main(int argc, char** argv)
{
cmake hcm;
std::vector<cmDocumentationEntry> commands;
+ std::vector<cmDocumentationEntry> generators;
hcm.GetCommandDocumentation(commands);
+ hcm.GetGeneratorDocumentation(generators);
doc.SetName("ccmake");
doc.SetNameSection(cmDocumentationName);
doc.SetUsageSection(cmDocumentationUsage);
doc.SetDescriptionSection(cmDocumentationDescription);
+ doc.SetGeneratorsSection(&generators[0]);
doc.SetOptionsSection(cmDocumentationOptions);
doc.SetCommandsSection(&commands[0]);
doc.SetSeeAlsoList(cmDocumentationSeeAlso);
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index f8f50ee5e6..2b7c1a0d23 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -597,14 +597,6 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
pos_form_cursor(this->Form);
}
-void cmCursesMainForm::UpdateProgressOld(const char *msg, float prog, void*)
-{
- if ( prog < 0 )
- {
- std::cout << "-- " << msg << std::endl;
- }
-}
-
void cmCursesMainForm::UpdateProgress(const char *msg, float prog, void* vp)
{
cmCursesMainForm* cm = static_cast<cmCursesMainForm*>(vp);
@@ -810,8 +802,8 @@ void cmCursesMainForm::FillCacheManagerFromUI()
{
// The user has changed the value. Mark it as modified.
it.SetProperty("MODIFIED", true);
- }
it.SetValue(fixedNewValue.c_str());
+ }
}
}
}
diff --git a/Source/MFCDialog/PropertyList.cpp b/Source/MFCDialog/PropertyList.cpp
index 259964a3e7..731e8707b2 100644
--- a/Source/MFCDialog/PropertyList.cpp
+++ b/Source/MFCDialog/PropertyList.cpp
@@ -332,7 +332,31 @@ void CPropertyList::OnSelchange()
}
else
+ {
DisplayButton(rect);
+ m_nLastBox = 1;
+ m_prevSel = m_curSel;
+ rect.bottom -= 3;
+ rect.right -= 25;
+ if (m_editBox)
+ {
+ m_editBox.MoveWindow(rect);
+ }
+ else
+ {
+ m_editBox.Create(ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE
+ | WS_CHILD | WS_BORDER,
+ rect,this,IDC_PROPEDITBOX);
+ m_editBox.SetFont(&m_SSerif8Font);
+ }
+
+ lBoxSelText = pItem->m_curValue;
+
+ m_editBox.ShowWindow(SW_SHOW);
+ m_editBox.SetFocus();
+ //set the text in the edit box to the property's current value
+ m_editBox.SetWindowText(lBoxSelText);
+ }
}
void CPropertyList::DisplayButton(CRect region)
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 4f6df9e846..79a2317aee 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -18,6 +18,8 @@
#include "cmTarget.h"
+#include "cmSourceFile.h"
+
// cmAddCustomCommandCommand
bool cmAddCustomCommandCommand::InitialPass(
std::vector<std::string> const& args)
@@ -32,9 +34,12 @@ bool cmAddCustomCommandCommand::InitialPass(
return false;
}
- std::string source, target, comment, main_dependency,
- working;
+ std::string source, target, main_dependency, working;
+ std::string comment_buffer;
+ const char* comment = 0;
std::vector<std::string> depends, outputs, output;
+ bool verbatim = false;
+ bool append = false;
// Accumulate one command line at a time.
cmCustomCommandLine currentLine;
@@ -90,6 +95,14 @@ bool cmAddCustomCommandCommand::InitialPass(
{
cctype = cmTarget::POST_BUILD;
}
+ else if(copy == "VERBATIM")
+ {
+ verbatim = true;
+ }
+ else if(copy == "APPEND")
+ {
+ append = true;
+ }
else if(copy == "TARGET")
{
doing = doing_target;
@@ -173,7 +186,8 @@ bool cmAddCustomCommandCommand::InitialPass(
outputs.push_back(filename);
break;
case doing_comment:
- comment = copy;
+ comment_buffer = copy;
+ comment = comment_buffer.c_str();
break;
default:
this->SetError("Wrong syntax. Unknown type of argument.");
@@ -203,6 +217,11 @@ bool cmAddCustomCommandCommand::InitialPass(
"Wrong syntax. A TARGET and OUTPUT can not both be specified.");
return false;
}
+ if(append && output.empty())
+ {
+ this->SetError("given APPEND option with no OUTPUT.");
+ return false;
+ }
// Make sure the output names and locations are safe.
if(!this->CheckOutputs(output) || !this->CheckOutputs(outputs))
@@ -210,29 +229,55 @@ bool cmAddCustomCommandCommand::InitialPass(
return false;
}
+ // Check for an append request.
+ if(append)
+ {
+ // Lookup an existing command.
+ if(cmSourceFile* sf =
+ this->Makefile->GetSourceFileWithOutput(output[0].c_str()))
+ {
+ if(cmCustomCommand* cc = sf->GetCustomCommand())
+ {
+ cc->AppendCommands(commandLines);
+ cc->AppendDepends(depends);
+ return true;
+ }
+ }
+
+ // No command for this output exists.
+ cmOStringStream e;
+ e << "given APPEND option with output \"" << output[0].c_str()
+ << "\" which is not already a custom command output.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
// Choose which mode of the command to use.
+ bool escapeOldStyle = !verbatim;
if(source.empty() && output.empty())
{
// Source is empty, use the target.
std::vector<std::string> no_depends;
this->Makefile->AddCustomCommandToTarget(target.c_str(), no_depends,
commandLines, cctype,
- comment.c_str(), working.c_str());
+ comment, working.c_str(),
+ escapeOldStyle);
}
else if(target.empty())
{
// Target is empty, use the output.
this->Makefile->AddCustomCommandToOutput(output, depends,
main_dependency.c_str(),
- commandLines, comment.c_str(),
- working.c_str());
+ commandLines, comment,
+ working.c_str(), false,
+ escapeOldStyle);
}
else
{
// Use the old-style mode for backward compatibility.
this->Makefile->AddCustomCommandOldStyle(target.c_str(), outputs, depends,
source.c_str(), commandLines,
- comment.c_str());
+ comment);
}
return true;
}
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index bacce8fa02..81338d658a 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -72,7 +72,7 @@ public:
" [MAIN_DEPENDENCY depend]\n"
" [DEPENDS [depends...]]\n"
" [WORKING_DIRECTORY dir]\n"
- " [COMMENT comment])\n"
+ " [COMMENT comment] [VERBATIM] [APPEND])\n"
"This defines a new command that can be executed during the build "
"process. The outputs named should be listed as source files in the "
"target for which they are to be generated. "
@@ -93,7 +93,7 @@ public:
" COMMAND command1 [ARGS] [args1...]\n"
" [COMMAND command2 [ARGS] [args2...] ...]\n"
" [WORKING_DIRECTORY dir]\n"
- " [COMMENT comment])\n"
+ " [COMMENT comment] [VERBATIM])\n"
"This defines a new command that will be associated with "
"building the specified target. When the command will "
"happen is determined by which of the following is specified:\n"
@@ -102,9 +102,29 @@ public:
" POST_BUILD - run after the target has been built\n"
"Note that the PRE_BUILD option is only supported on Visual "
"Studio 7 or later. For all other generators PRE_BUILD "
- "will be treated as PRE_LINK. "
+ "will be treated as PRE_LINK.\n"
"If WORKING_DIRECTORY is specified the command will be executed "
- "in the directory given.";
+ "in the directory given. "
+ "If COMMENT is set, the value will be displayed as a "
+ "message before the commands are executed at build time. "
+ "If APPEND is specified the COMMAND and DEPENDS option values "
+ "are appended to the custom command for the first output specified. "
+ "There must have already been a previous call to this command with "
+ "the same output. The COMMENT, WORKING_DIRECTORY, and MAIN_DEPENDENCY "
+ "options are currently ignored when APPEND is given, "
+ "but may be used in the future."
+ "\n"
+ "If VERBATIM is given then all the arguments to the commands will be "
+ "passed exactly as specified no matter the build tool used. "
+ "Note that one level of escapes is still used by the CMake language "
+ "processor before ADD_CUSTOM_TARGET even sees the arguments. "
+ "Use of VERBATIM is recommended as it enables correct behavior. "
+ "When VERBATIM is not given the behavior is platform specific. "
+ "In the future VERBATIM may be enabled by default. The only reason "
+ "it is an option is to preserve compatibility with older CMake code.\n"
+ "If the output of the custom command is not actually "
+ "created as a file on disk it should be marked as SYMBOLIC with "
+ "SET_SOURCE_FILES_PROPERTIES.";
}
cmTypeMacro(cmAddCustomCommandCommand, cmCommand);
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index f98ca26133..41415091fc 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -26,6 +26,29 @@ bool cmAddCustomTargetCommand::InitialPass(
return false;
}
+ // Check the target name.
+ if(args[0].find_first_of("/\\") != args[0].npos)
+ {
+ int major = 0;
+ int minor = 0;
+ if(const char* versionValue =
+ this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"))
+ {
+ sscanf(versionValue, "%d.%d", &major, &minor);
+ }
+ if(!major || major > 3 || (major == 2 && minor > 2))
+ {
+ cmOStringStream e;
+ e << "called with invalid target name \"" << args[0]
+ << "\". Target names may not contain a slash. "
+ << "Use ADD_CUSTOM_COMMAND to generate files. "
+ << "Set CMAKE_BACKWARDS_COMPATIBILITY to 2.2 "
+ << "or lower to skip this check.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+
// Accumulate one command line at a time.
cmCustomCommandLine currentLine;
@@ -35,12 +58,17 @@ bool cmAddCustomTargetCommand::InitialPass(
// Accumulate dependencies.
std::vector<std::string> depends;
std::string working_directory;
+ bool verbatim = false;
+ std::string comment_buffer;
+ const char* comment = 0;
// Keep track of parser state.
enum tdoing {
doing_command,
doing_depends,
- doing_working_directory
+ doing_working_directory,
+ doing_comment,
+ doing_verbatim
};
tdoing doing = doing_command;
@@ -69,6 +97,15 @@ bool cmAddCustomTargetCommand::InitialPass(
{
doing = doing_working_directory;
}
+ else if(copy == "VERBATIM")
+ {
+ doing = doing_verbatim;
+ verbatim = true;
+ }
+ else if (copy == "COMMENT")
+ {
+ doing = doing_comment;
+ }
else if(copy == "COMMAND")
{
doing = doing_command;
@@ -93,6 +130,10 @@ bool cmAddCustomTargetCommand::InitialPass(
case doing_depends:
depends.push_back(copy);
break;
+ case doing_comment:
+ comment_buffer = copy;
+ comment = comment_buffer.c_str();
+ break;
default:
this->SetError("Wrong syntax. Unknown type of argument.");
return false;
@@ -118,10 +159,10 @@ bool cmAddCustomTargetCommand::InitialPass(
}
// Add the utility target to the makefile.
- const char* no_output = 0;
- this->Makefile->AddUtilityCommand(args[0].c_str(), all, no_output,
+ bool escapeOldStyle = !verbatim;
+ this->Makefile->AddUtilityCommand(args[0].c_str(), all,
working_directory.c_str(), depends,
- commandLines);
+ commandLines, escapeOldStyle, comment);
return true;
}
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index 4a448b3ea1..b8808b8677 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -65,10 +65,16 @@ public:
return
" ADD_CUSTOM_TARGET(Name [ALL] [command1 [args1...]]\n"
" [COMMAND command2 [args2...] ...]\n"
- " [DEPENDS depend depend depend ... ])\n"
+ " [DEPENDS depend depend depend ... ]\n"
" [WORKING_DIRECTORY dir]\n"
- "Adds a target with the given name that executes the given commands "
- "every time the target is built. If the ALL option is specified "
+ " [COMMENT comment] [VERBATIM])\n"
+ "Adds a target with the given name that executes the given commands. "
+ "The target has no output file and is ALWAYS CONSIDERED OUT OF DATE "
+ "even if the commands try to create a file with the name of the "
+ "target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies. "
+ "By default nothing depends on the custom target. Use "
+ "ADD_DEPENDENCIES to add dependencies to or from other targets. "
+ "If the ALL option is specified "
"it indicates that this target should be added to the default build "
"target so that it will be run every time "
"(the command cannot be called ALL). "
@@ -76,10 +82,18 @@ public:
"empty target will be created. "
"If WORKING_DIRECTORY is set, then the command will be run in that "
"directory. "
+ "If COMMENT is set, the value will be displayed as a "
+ "message before the commands are executed at build time. "
"Dependencies listed with the DEPENDS argument may reference files "
- "and outputs of custom commands created with ADD_CUSTOM_COMMAND. "
- "Dependencies on other targets may be added using the "
- "ADD_DEPENDENCIES command.";
+ "and outputs of custom commands created with ADD_CUSTOM_COMMAND.\n"
+ "If VERBATIM is given then all the arguments to the commands will be "
+ "passed exactly as specified no matter the build tool used. "
+ "Note that one level of escapes is still used by the CMake language "
+ "processor before ADD_CUSTOM_TARGET even sees the arguments. "
+ "Use of VERBATIM is recommended as it enables correct behavior. "
+ "When VERBATIM is not given the behavior is platform specific. "
+ "In the future VERBATIM may be enabled by default. The only reason "
+ "it is an option is to preserve compatibility with older CMake code.";
}
cmTypeMacro(cmAddCustomTargetCommand, cmCommand);
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index d44fa9aa89..e04c124e50 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -31,6 +31,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
++s;
bool use_win32 = false;
bool use_macbundle = false;
+ bool in_all = true;
while ( s != args.end() )
{
if (*s == "WIN32")
@@ -43,6 +44,11 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
++s;
use_macbundle = true;
}
+ else if(*s == "EXCLUDE_FROM_ALL")
+ {
+ ++s;
+ in_all = false;
+ }
else
{
break;
@@ -57,7 +63,8 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
}
std::vector<std::string> srclists(s, args.end());
- cmTarget* tgt = this->Makefile->AddExecutable(exename.c_str(), srclists);
+ cmTarget* tgt = this->Makefile->AddExecutable(exename.c_str(), srclists,
+ in_all);
if ( use_win32 )
{
tgt->SetProperty("WIN32_EXECUTABLE", "ON");
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 77140c5ce2..bef409e21a 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -62,8 +62,8 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " ADD_EXECUTABLE(exename [WIN32] [MACOSX_BUNDLE] source1\n"
- " source2 ... sourceN)\n"
+ " ADD_EXECUTABLE(exename [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL]\n"
+ " source1 source2 ... sourceN)\n"
"This command adds an executable target to the current directory. "
"The executable will be built from the list of source files "
"specified.\n"
@@ -86,6 +86,9 @@ public:
" MACOSX_BUNDLE_SHORT_VERSION_STRING\n"
" MACOSX_BUNDLE_BUNDLE_VERSION\n"
" MACOSX_BUNDLE_COPYRIGHT\n"
+ "If EXCLUDE_FROM_ALL is given the target will not be built by default. "
+ "It will be built only if the user explicitly builds the target or "
+ "another target that requires the target depends on it."
;
}
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index afcac0bbeb..ac7fc90654 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -28,6 +28,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
// otherwise it defaults to static library.
int shared =
!cmSystemTools::IsOff(this->Makefile->GetDefinition("BUILD_SHARED_LIBS"));
+ bool in_all = true;
std::vector<std::string>::const_iterator s = args.begin();
@@ -56,6 +57,11 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
++s;
shared = 2;
}
+ else if(*s == "EXCLUDE_FROM_ALL")
+ {
+ ++s;
+ in_all = false;
+ }
}
if (s == args.end())
@@ -74,7 +80,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
++s;
}
- this->Makefile->AddLibrary(this->LibName.c_str(), shared, srclists);
+ this->Makefile->AddLibrary(this->LibName.c_str(), shared, srclists,
+ in_all);
return true;
}
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 86a9eb9b7c..497634ce5a 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -61,7 +61,7 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " ADD_LIBRARY(libname [SHARED | STATIC | MODULE]\n"
+ " ADD_LIBRARY(libname [SHARED | STATIC | MODULE] [EXCLUDE_FROM_ALL]\n"
" source1 source2 ... sourceN)\n"
"Adds a library target. SHARED, STATIC or MODULE keywords are used "
"to set the library type. If the keyword MODULE appears, the library "
@@ -69,7 +69,10 @@ public:
"without dyld, MODULE is treated like SHARED. If no keywords appear "
" as the second argument, the type defaults to the current value of "
"BUILD_SHARED_LIBS. If this variable is not set, the type defaults "
- "to STATIC.";
+ "to STATIC.\n"
+ "If EXCLUDE_FROM_ALL is given the target will not be built by default. "
+ "It will be built only if the user explicitly builds the target or "
+ "another target that requires the target depends on it.";
}
cmTypeMacro(cmAddLibraryCommand, cmCommand);
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index 6591b4432d..b05665bba6 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -53,64 +53,76 @@ bool cmAddSubDirectoryCommand::InitialPass
}
}
- // check for relative arguments
- std::string binPath = binArg;
- std::string srcPath = std::string(this->Makefile->GetCurrentDirectory()) +
- "/" + srcArg;
- // if the path does not exist then the arg was relative
- if (!cmSystemTools::FileIsDirectory(srcPath.c_str()))
+ // Compute the full path to the specified source directory.
+ // Interpret a relative path with respect to the current source directory.
+ std::string srcPath;
+ if(cmSystemTools::FileIsFullPath(srcArg.c_str()))
{
srcPath = srcArg;
- if (!cmSystemTools::FileIsDirectory(srcPath.c_str()))
+ }
+ else
{
- std::string error = "Incorrect ADD_SUBDIRECTORY command. Directory: ";
- error += srcArg + " does not exists.";
+ srcPath = this->Makefile->GetCurrentDirectory();
+ srcPath += "/";
+ srcPath += srcArg;
+ }
+ if(!cmSystemTools::FileIsDirectory(srcPath.c_str()))
+ {
+ std::string error = "given source \"";
+ error += srcArg;
+ error += "\" which is not an existing directory.";
this->SetError(error.c_str());
return false;
}
- }
-
- // at this point srcPath has the full path to the source directory
- // now we need to compute the binPath if it was not provided
srcPath = cmSystemTools::CollapseFullPath(srcPath.c_str());
- // if the argument was provided then use it
- if (binArg.size())
+ // Compute the full path to the binary directory.
+ std::string binPath;
+ if(binArg.empty())
{
- if (!cmSystemTools::FileIsFullPath(binPath.c_str()))
+ // No binary directory was specified. If the source directory is
+ // not a subdirectory of the current directory then it is an
+ // error.
+ if(!cmSystemTools::FindLastString(srcPath.c_str(),
+ this->Makefile->GetCurrentDirectory()))
{
- binPath = std::string(this->Makefile->GetCurrentOutputDirectory()) +
- "/" + binArg.c_str();
+ cmOStringStream e;
+ e << "not given a binary directory but the given source directory "
+ << "\"" << srcPath << "\" is not a subdirectory of \""
+ << this->Makefile->GetCurrentDirectory() << "\". "
+ << "When specifying an out-of-tree source a binary directory "
+ << "must be explicitly specified.";
+ this->SetError(e.str().c_str());
+ return false;
}
+
+ // Remove the CurrentDirectory from the srcPath and replace it
+ // with the CurrentOutputDirectory.
+ binPath = srcPath;
+ cmSystemTools::ReplaceString(binPath,
+ this->Makefile->GetCurrentDirectory(),
+ this->Makefile->GetCurrentOutputDirectory());
}
- // otherwise compute the binPath from the srcPath
else
{
- // we try to remove the CurrentDirectory from the srcPath and
- // replace it with the CurrentOutputDirectory. This may not really work
- // because the source dir they provided may not be "in" the source
- // tree. This is an error if this happens.
- // try replacing the home dir with the home output dir
- binPath = srcPath;
- if(!cmSystemTools::FindLastString(binPath.c_str(),
- this->Makefile->GetHomeDirectory()))
+ // Use the binary directory specified.
+ // Interpret a relative path with respect to the current binary directory.
+ if(cmSystemTools::FileIsFullPath(binArg.c_str()))
{
- this->SetError("A full source directory was specified that is not "
- "in the source tree but no binary directory was "
- "specified. If you specify an out of tree source "
- "directory then you must provide the binary "
- "directory as well.");
- return false;
+ binPath = binArg;
+ }
+ else
+ {
+ binPath = this->Makefile->GetCurrentOutputDirectory();
+ binPath += "/";
+ binPath += binArg;
}
- cmSystemTools::ReplaceString(binPath,
- this->Makefile->GetHomeDirectory(),
- this->Makefile->GetHomeOutputDirectory());
}
+ binPath = cmSystemTools::CollapseFullPath(binPath.c_str());
- // now we have all the arguments
+ // Add the subdirectory using the computed full paths.
this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
intoplevel, false, true);
return true;
}
-
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 229c32cbdb..998f9228c3 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -66,7 +66,7 @@ public:
"been run, this command does nothing. "
"The tests are run by the testing subsystem by executing Exename "
"with the specified arguments. Exename can be either an executable "
- "built by built by this project or an arbitrary executable on the "
+ "built by this project or an arbitrary executable on the "
"system (like tclsh). The test will be run with the current working "
"directory set to the CMakeList.txt files corresponding directory "
"in the binary tree.";
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 183b0973b6..b7f29c515d 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -72,6 +72,12 @@ public:
"CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmBuildNameCommand, cmCommand);
};
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index a184eced67..508a83a0c7 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -24,6 +24,12 @@
#include "cmSourceFile.h"
+#include <stdlib.h>
+
+#ifdef __QNX__
+# include <malloc.h> /* for malloc/free on QNX */
+#endif
+
extern "C"
{
@@ -200,8 +206,8 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
int all,
int numDepends,
const char **depends,
- int numOutputs,
- const char **outputs)
+ int,
+ const char **)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@@ -228,19 +234,9 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
depends2.push_back(mf->ExpandVariablesInString(expand));
}
- // Only one output is allowed.
- const char* output = 0;
- std::string outputStr;
- if(numOutputs > 0)
- {
- expand = outputs[0];
- outputStr = mf->ExpandVariablesInString(expand);
- output = outputStr.c_str();
- }
-
// Pass the call to the makefile instance.
mf->AddUtilityCommand(utilityName, (all ? true : false),
- output, 0, depends2, commandLines);
+ 0, depends2, commandLines);
}
void CCONV cmAddCustomCommand(void *arg, const char* source,
const char* command,
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 7466bb54d8..55672a658c 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -102,6 +102,15 @@ public:
}
/**
+ * This determines if usage of the method is discouraged or not.
+ * This is currently only used for generating the documentation.
+ */
+ virtual bool IsDiscouraged()
+ {
+ return false;
+ }
+
+ /**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() = 0;
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx
index 2b1c9dd0ea..ba353fabe9 100644
--- a/Source/cmCommandArgumentLexer.cxx
+++ b/Source/cmCommandArgumentLexer.cxx
@@ -1,6 +1,8 @@
+#include "cmStandardIncludes.h"
+#line 2 "cmCommandArgumentLexer.cxx"
-
+#line 4 "cmCommandArgumentLexer.cxx"
#define YY_INT_ALIGNED short int
@@ -9,7 +11,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 31
+#define YY_FLEX_SUBMINOR_VERSION 33
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -31,7 +33,15 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#if __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
@@ -154,6 +164,10 @@ int cmCommandArgument_yylex_init (yyscan_t* scanner);
#define YY_BUF_SIZE 16384
#endif
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
@@ -165,8 +179,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define YY_LESS_LINENO(n)
-/* Return all but the first "n" matched characters back to the input
- stream. */
+/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
@@ -180,6 +193,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
} \
while ( 0 )
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
@@ -246,9 +261,9 @@ struct yy_buffer_state
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
- * When we actually see the EOF, we change the status to "new" (via
- * cmCommandArgument_yyrestart()), so that the user can continue scanning
- * by just pointing yyin at a new input file.
+ * When we actually see the EOF, we change the status to "new"
+ * (via cmCommandArgument_yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
@@ -265,29 +280,22 @@ struct yy_buffer_state
? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
: NULL)
-/* Same as previous macro, but useful when we know that the buffer stack is
- * not NULL or when we need an lvalue. For internal use only.
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
void cmCommandArgument_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void cmCommandArgument_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,
- yyscan_t yyscanner );
-YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE *file,int size ,
- yyscan_t yyscanner );
-void cmCommandArgument_yy_delete_buffer (YY_BUFFER_STATE b ,
- yyscan_t yyscanner );
-void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b ,
- yyscan_t yyscanner );
-void cmCommandArgument_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,
- yyscan_t yyscanner );
+void cmCommandArgument_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void cmCommandArgument_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void cmCommandArgument_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
void cmCommandArgument_yypop_buffer_state (yyscan_t yyscanner );
static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner );
static void cmCommandArgument_yy_load_buffer_state (yyscan_t yyscanner );
-static void cmCommandArgument_yy_init_buffer (YY_BUFFER_STATE b,
- FILE *file ,
- yyscan_t yyscanner );
+static void cmCommandArgument_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
#define YY_FLUSH_BUFFER cmCommandArgument_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
@@ -370,7 +378,7 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 1, 1, 1, 1,
- 1, 1, 1, 1, 4, 4, 4, 4, 4, 4,
+ 1, 1, 4, 1, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
1, 1, 1, 5, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@@ -436,8 +444,8 @@ static yyconst flex_int16_t yy_chk[30] =
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
-
-
+#line 1 "cmCommandArgumentLexer.in.l"
+#line 2 "cmCommandArgumentLexer.in.l"
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
@@ -477,25 +485,9 @@ Modify cmCommandArgumentLexer.h:
*/
-#include "cmCommandArgumentParserHelper.h"
-
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
+#include "cmStandardLexer.h"
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#undef ECHO /* SGI termios defines this differently. */
-#define ECHO
+#include "cmCommandArgumentParserHelper.h"
/* Replace the lexer input function. */
#undef YY_INPUT
@@ -505,18 +497,8 @@ Modify cmCommandArgumentLexer.h:
/* Include the set of tokens from the parser. */
#include "cmCommandArgumentParserTokens.h"
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-/* Handle Windows properly */
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
/*--------------------------------------------------------------------------*/
-
+#line 500 "cmCommandArgumentLexer.cxx"
#define INITIAL 0
@@ -566,6 +548,8 @@ struct yyguts_t
}; /* end struct yyguts_t */
+static int yy_init_globals (yyscan_t yyscanner );
+
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
@@ -638,8 +622,8 @@ static int input (yyscan_t yyscanner );
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
-/* Gets input and stuffs it into "buf". number of characters read, or
- * YY_NULL, is returned in "result".
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
@@ -729,14 +713,14 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+#line 60 "cmCommandArgumentLexer.in.l"
+#line 720 "cmCommandArgumentLexer.cxx"
-
-
- if ( yyg->yy_init )
+ if ( !yyg->yy_init )
{
- yyg->yy_init = 0;
+ yyg->yy_init = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
@@ -817,7 +801,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-
+#line 62 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
@@ -825,7 +809,7 @@ YY_RULE_SETUP
}
case 2:
YY_RULE_SETUP
-
+#line 68 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
@@ -833,7 +817,7 @@ YY_RULE_SETUP
}
case 3:
YY_RULE_SETUP
-
+#line 74 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
@@ -842,7 +826,7 @@ YY_RULE_SETUP
}
case 4:
YY_RULE_SETUP
-
+#line 81 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
@@ -851,7 +835,7 @@ YY_RULE_SETUP
}
case 5:
YY_RULE_SETUP
-
+#line 88 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
@@ -860,7 +844,7 @@ YY_RULE_SETUP
}
case 6:
YY_RULE_SETUP
-
+#line 95 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
@@ -868,7 +852,7 @@ YY_RULE_SETUP
}
case 7:
YY_RULE_SETUP
-
+#line 101 "cmCommandArgumentLexer.in.l"
{
if ( !yyextra->HandleEscapeSymbol(yylvalp, *(yytext+1)) )
{
@@ -879,7 +863,7 @@ YY_RULE_SETUP
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
-
+#line 109 "cmCommandArgumentLexer.in.l"
{
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
@@ -887,7 +871,7 @@ YY_RULE_SETUP
}
case 9:
YY_RULE_SETUP
-
+#line 115 "cmCommandArgumentLexer.in.l"
{
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->DOLLARVariable;
@@ -895,7 +879,7 @@ YY_RULE_SETUP
}
case 10:
YY_RULE_SETUP
-
+#line 121 "cmCommandArgumentLexer.in.l"
{
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->LCURLYVariable;
@@ -903,7 +887,7 @@ YY_RULE_SETUP
}
case 11:
YY_RULE_SETUP
-
+#line 127 "cmCommandArgumentLexer.in.l"
{
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
yylvalp->str = yyextra->BSLASHVariable;
@@ -911,10 +895,10 @@ YY_RULE_SETUP
}
case 12:
YY_RULE_SETUP
-
+#line 133 "cmCommandArgumentLexer.in.l"
ECHO;
YY_BREAK
-
+#line 913 "cmCommandArgumentLexer.cxx"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1101,10 +1085,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
{
- size_t nuto_read =
+ int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
- while ( nuto_read <= 0 )
+ while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
@@ -1136,17 +1120,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
- nuto_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
}
- if ( nuto_read > YY_READ_BUF_SIZE )
- nuto_read = YY_READ_BUF_SIZE;
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, nuto_read );
+ yyg->yy_n_chars, (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
}
@@ -1179,8 +1163,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
return ret_val;
}
-/* yy_get_previous_state - get the state just before the EOB char was
- reached */
+/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
@@ -1218,7 +1201,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
register int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
register char *yy_cp = yyg->yy_c_buf_p;
register YY_CHAR yy_c = 1;
@@ -1361,10 +1344,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
YY_CURRENT_BUFFER_LVALUE = new_buffer;
cmCommandArgument_yy_load_buffer_state(yyscanner );
- /* We don't actually know whether we did this switch during EOF
- * (cmCommandArgument_yywrap()) processing, but the only time this flag is
- * looked at is after cmCommandArgument_yywrap() is called, so it's safe to
- * go ahead and always set it.
+ /* We don't actually know whether we did this switch during
+ * EOF (cmCommandArgument_yywrap()) processing, but the only time this flag
+ * is looked at is after cmCommandArgument_yywrap() is called, so it's safe
+ * to go ahead and always set it.
*/
yyg->yy_did_buffer_switch_on_eof = 1;
}
@@ -1378,10 +1361,11 @@ static void cmCommandArgument_yy_load_buffer_state (yyscan_t yyscanner)
yyg->yy_hold_char = *yyg->yy_c_buf_p;
}
-/** Allocate and initialize an input buffer state. @param file A readable
- * stream. @param size The character buffer size in bytes. When in doubt,
- * use @c YY_BUF_SIZE. @param yyscanner The scanner object. @return the
- * allocated buffer state.
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
*/
YY_BUFFER_STATE cmCommandArgument_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
@@ -1446,10 +1430,9 @@ extern int isatty (int );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
- /* If b is the current buffer, then cmCommandArgument_yy_init_buffer was
- * _probably_ called from cmCommandArgument_yyrestart() or through
- * yy_get_next_buffer. In that case, we don't want to reset the lineno
- * or column.
+ /* If b is the current buffer, then cmCommandArgument_yy_init_buffer was _probably_
+ * called from cmCommandArgument_yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
*/
if (b != YY_CURRENT_BUFFER){
b->yy_bs_lineno = 1;
@@ -1461,9 +1444,9 @@ extern int isatty (int );
errno = oerrno;
}
-/** Discard all buffered characters. On the next scan, YY_INPUT will be
- * called. @param b the buffer state to be flushed, usually @c
- * YY_CURRENT_BUFFER. @param yyscanner The scanner object.
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
*/
void cmCommandArgument_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
{
@@ -1548,7 +1531,7 @@ void cmCommandArgument_yypop_buffer_state (yyscan_t yyscanner)
*/
static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner)
{
- int nuto_alloc;
+ int num_to_alloc;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (!yyg->yy_buffer_stack) {
@@ -1557,14 +1540,14 @@ static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner)
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
- nuto_alloc = 1;
+ num_to_alloc = 1;
yyg->yy_buffer_stack = (struct yy_buffer_state**)cmCommandArgument_yyalloc
- (nuto_alloc * sizeof(struct yy_buffer_state*)
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
- memset(yyg->yy_buffer_stack, 0, nuto_alloc * sizeof(struct yy_buffer_state*));
+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = nuto_alloc;
+ yyg->yy_buffer_stack_max = num_to_alloc;
yyg->yy_buffer_stack_top = 0;
return;
}
@@ -1574,21 +1557,22 @@ static void cmCommandArgument_yyensure_buffer_stack (yyscan_t yyscanner)
/* Increase the buffer to prepare for a possible push. */
int grow_size = 8 /* arbitrary grow size */;
- nuto_alloc = yyg->yy_buffer_stack_max + grow_size;
+ num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
yyg->yy_buffer_stack = (struct yy_buffer_state**)cmCommandArgument_yyrealloc
(yyg->yy_buffer_stack,
- nuto_alloc * sizeof(struct yy_buffer_state*)
+ num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
/* zero only the new slots.*/
memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = nuto_alloc;
+ yyg->yy_buffer_stack_max = num_to_alloc;
}
}
-/** Setup the input buffer state to scan directly from a user-specified
- * character buffer. @param base the character buffer @param size the size
- * in bytes of the character buffer @param yyscanner The scanner object.
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
@@ -1620,26 +1604,28 @@ YY_BUFFER_STATE cmCommandArgument_yy_scan_buffer (char * base, yy_size_t size
return b;
}
-/** Setup the input buffer state to scan a string. The next call to
- * cmCommandArgument_yylex() will scan from a @e copy of @a str. @param str
- * a NUL-terminated string to scan @param yyscanner The scanner object.
- * @return the newly allocated buffer state object. @note If you want to
- * scan bytes that may contain NUL values, then use
+/** Setup the input buffer state to scan a string. The next call to cmCommandArgument_yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
* cmCommandArgument_yy_scan_bytes() instead.
*/
-YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
+YY_BUFFER_STATE cmCommandArgument_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
- return cmCommandArgument_yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
+ return cmCommandArgument_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
-/** Setup the input buffer state to scan the given bytes. The next call to
- * cmCommandArgument_yylex() will scan from a @e copy of @a bytes. @param
- * bytes the byte buffer to scan @param len the number of bytes in the buffer
- * pointed to by @a bytes. @param yyscanner The scanner object. @return the
- * newly allocated buffer state object.
+/** Setup the input buffer state to scan the given bytes. The next call to cmCommandArgument_yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner)
+YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
char *buf;
@@ -1647,15 +1633,15 @@ YY_BUFFER_STATE cmCommandArgument_yy_scan_bytes (yyconst char * bytes, int len
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
+ n = _yybytes_len + 2;
buf = (char *) cmCommandArgument_yyalloc(n ,yyscanner );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in cmCommandArgument_yy_scan_bytes()" );
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = cmCommandArgument_yy_scan_buffer(buf,n ,yyscanner);
if ( ! b )
@@ -1805,12 +1791,7 @@ void cmCommandArgument_yyset_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- {
- yy_fatal_error
- ("cmCommandArgument_yyset_column called with no buffer" ,
- yyscanner);
- }
-
+ yy_fatal_error( "cmCommandArgument_yyset_column called with no buffer" , yyscanner);
yycolumn = column_no;
}
@@ -1847,21 +1828,51 @@ void cmCommandArgument_yyset_debug (int bdebug , yyscan_t yyscanner)
/* Accessor methods for yylval and yylloc */
+/* User-visible API */
+
+/* cmCommandArgument_yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int cmCommandArgument_yylex_init(yyscan_t* ptr_yy_globals)
+
+{
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) cmCommandArgument_yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
static int yy_init_globals (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* Initialization is the same as for the non-reentrant scanner.
- This function is called once per scanner lifetime. */
+ * This function is called from cmCommandArgument_yylex_destroy(), so don't allocate here.
+ */
yyg->yy_buffer_stack = 0;
yyg->yy_buffer_stack_top = 0;
yyg->yy_buffer_stack_max = 0;
yyg->yy_c_buf_p = (char *) 0;
- yyg->yy_init = 1;
+ yyg->yy_init = 0;
yyg->yy_start = 0;
+
yyg->yy_start_stack_ptr = 0;
yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = (int *) 0;
+ yyg->yy_start_stack = NULL;
/* Defined in main.c */
#ifdef YY_STDINIT
@@ -1878,36 +1889,7 @@ static int yy_init_globals (yyscan_t yyscanner)
return 0;
}
-/* User-visible API */
-
-/* cmCommandArgument_yylex_init is special because it creates the scanner
- * itself, so it is the ONLY reentrant function that doesn't take the scanner
- * as the last argument. That's why we explicitly handle the declaration,
- * instead of using our macros.
- */
-
-int cmCommandArgument_yylex_init(yyscan_t* ptr_yy_globals)
-
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) cmCommandArgument_yyalloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-/* cmCommandArgument_yylex_destroy is for both reentrant and non-reentrant
- scanners. */
+/* cmCommandArgument_yylex_destroy is for both reentrant and non-reentrant scanners. */
int cmCommandArgument_yylex_destroy (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
@@ -1927,8 +1909,13 @@ int cmCommandArgument_yylex_destroy (yyscan_t yyscanner)
cmCommandArgument_yyfree(yyg->yy_start_stack ,yyscanner );
yyg->yy_start_stack = NULL;
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * cmCommandArgument_yylex() is called, initialization will occur. */
+ yy_init_globals( yyscanner);
+
/* Destroy the main struct (reentrant only). */
cmCommandArgument_yyfree ( yyscanner , yyscanner );
+ yyscanner = NULL;
return 0;
}
@@ -1937,11 +1924,9 @@ int cmCommandArgument_yylex_destroy (yyscan_t yyscanner)
*/
#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ,
- yyscan_t yyscanner)
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
{
register int i;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -1951,7 +1936,6 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ,
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
{
register int n;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
for ( n = 0; s[n]; ++n )
;
@@ -1978,25 +1962,12 @@ void *cmCommandArgument_yyrealloc (void * ptr, yy_size_t size , yyscan_t)
void cmCommandArgument_yyfree (void * ptr , yyscan_t)
{
- free( (char *) ptr );
- /* see cmCommandArgument_yyrealloc() for (char *) cast */
+ free( (char *) ptr ); /* see cmCommandArgument_yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
-#undef YY_NEW_FILE
-#undef YY_FLUSH_BUFFER
-#undef yy_set_bol
-#undef yy_new_buffer
-#undef yy_set_interactive
-#undef yytext_ptr
-#undef YY_DO_BEFORE_ACTION
-
-#ifdef YY_DECL_IS_OURS
-#undef YY_DECL_IS_OURS
-#undef YY_DECL
-#endif
-
+#line 133 "cmCommandArgumentLexer.in.l"
diff --git a/Source/cmCommandArgumentLexer.h b/Source/cmCommandArgumentLexer.h
index f5209dfbb0..582bfceda1 100644
--- a/Source/cmCommandArgumentLexer.h
+++ b/Source/cmCommandArgumentLexer.h
@@ -13,7 +13,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 31
+#define YY_FLEX_SUBMINOR_VERSION 33
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -36,6 +36,14 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/cmCommandArgumentLexer.in.l
index 80afa0333f..aa4f7297bb 100644
--- a/Source/cmCommandArgumentLexer.in.l
+++ b/Source/cmCommandArgumentLexer.in.l
@@ -26,7 +26,7 @@ Run flex like this:
Modify cmCommandArgumentLexer.cxx:
- remove TABs
- remove "yyscanner" argument from these methods:
- yy_fatal_error, yyalloc, yyrealloc, yyfree
+ yy_fatal_error, cmCommandArgument_yyalloc, cmCommandArgument_yyrealloc, cmCommandArgument_yyfree
- remove all YY_BREAK lines occurring right after return statements
- change while ( 1 ) to for(;;)
@@ -38,25 +38,9 @@ Modify cmCommandArgumentLexer.h:
*/
-#include "cmCommandArgumentParserHelper.h"
+#include "cmStandardLexer.h"
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#undef ECHO /* SGI termios defines this differently. */
-#define ECHO
+#include "cmCommandArgumentParserHelper.h"
/* Replace the lexer input function. */
#undef YY_INPUT
@@ -66,16 +50,6 @@ Modify cmCommandArgumentLexer.h:
/* Include the set of tokens from the parser. */
#include "cmCommandArgumentParserTokens.h"
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-/* Handle Windows properly */
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
/*--------------------------------------------------------------------------*/
%}
@@ -85,13 +59,13 @@ Modify cmCommandArgumentLexer.h:
%%
-\$[A-Za-z0-9/_.-]+\{ {
+\$[A-Za-z0-9/_.+-]+\{ {
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
return cal_NCURLY;
}
-@[A-Za-z0-9/_.-]+@ {
+@[A-Za-z0-9/_.+-]+@ {
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext+1, strlen(yytext)-2);
return cal_ATNAME;
@@ -100,25 +74,25 @@ Modify cmCommandArgumentLexer.h:
"${" {
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = yyextra->m_DCURLYVariable;
+ yylvalp->str = yyextra->DCURLYVariable;
return cal_DCURLY;
}
"}" {
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = yyextra->m_RCURLYVariable;
+ yylvalp->str = yyextra->RCURLYVariable;
return cal_RCURLY;
}
"@" {
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = yyextra->m_ATVariable;
+ yylvalp->str = yyextra->ATVariable;
return cal_AT;
}
-[A-Za-z0-9/_.-]+ {
+[A-Za-z0-9/_.+-]+ {
//std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl;
yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
return cal_NAME;
@@ -140,19 +114,19 @@ Modify cmCommandArgumentLexer.h:
"$" {
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = yyextra->m_DOLLARVariable;
+ yylvalp->str = yyextra->DOLLARVariable;
return cal_DOLLAR;
}
"{" {
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = yyextra->m_LCURLYVariable;
+ yylvalp->str = yyextra->LCURLYVariable;
return cal_LCURLY;
}
"\\" {
//yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext));
- yylvalp->str = yyextra->m_BSLASHVariable;
+ yylvalp->str = yyextra->BSLASHVariable;
return cal_BSLASH;
}
diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx
index 1f219dd9c0..a95ac23ed8 100644
--- a/Source/cmCommandArgumentParser.cxx
+++ b/Source/cmCommandArgumentParser.cxx
@@ -128,6 +128,8 @@ Modify cmCommandArgumentParser.cxx:
*/
+#include "cmStandardIncludes.h"
+
/* Configure the parser to use a lexer object. */
#define YYPARSE_PARAM yyscanner
#define YYLEX_PARAM yyscanner
@@ -136,6 +138,11 @@ Modify cmCommandArgumentParser.cxx:
cmCommandArgumentError(yyscanner, x)
#define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
+/* Make sure malloc and free are available on QNX. */
+#ifdef __QNX__
+# include <malloc.h>
+#endif
+
/* Make sure the parser uses standard memory allocation. The default
generated parser malloc/free declarations do not work on all
platforms. */
@@ -162,6 +169,9 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
@@ -1310,7 +1320,7 @@ yyreduce:
case 17:
#line 178 "cmCommandArgumentParser.y"
{
- (yyval.str) = yyGetParser->ExpandVariable((yyvsp[0].str));
+ (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str));
}
break;
diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y
index 050d7108d2..8f03a4b070 100644
--- a/Source/cmCommandArgumentParser.y
+++ b/Source/cmCommandArgumentParser.y
@@ -28,6 +28,8 @@ Modify cmCommandArgumentParser.cxx:
*/
+#include "cmStandardIncludes.h"
+
/* Configure the parser to use a lexer object. */
#define YYPARSE_PARAM yyscanner
#define YYLEX_PARAM yyscanner
@@ -36,6 +38,11 @@ Modify cmCommandArgumentParser.cxx:
cmCommandArgumentError(yyscanner, x)
#define yyGetParser (cmCommandArgument_yyget_extra(yyscanner))
+/* Make sure malloc and free are available on QNX. */
+#ifdef __QNX__
+# include <malloc.h>
+#endif
+
/* Make sure the parser uses standard memory allocation. The default
generated parser malloc/free declarations do not work on all
platforms. */
@@ -62,10 +69,14 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
-# pragma warning (disable: 4065) /* Switch statement contains default but no case. */
+# pragma warning (disable: 4065) /* Switch statement contains default but no
+ case. */
#endif
%}
@@ -182,7 +193,7 @@ cal_DCURLY MultipleIds cal_RCURLY
|
cal_ATNAME
{
- $<str>$ = yyGetParser->ExpandVariable($<str>1);
+ $<str>$ = yyGetParser->ExpandVariableForAt($<str>1);
}
MultipleIds:
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 1d37a34860..d446e15eea 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -37,6 +37,7 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
strcpy(this->BSLASHVariable, "\\");
this->NoEscapeMode = false;
+ this->ReplaceAtSyntax = false;
}
@@ -115,6 +116,21 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
return this->AddString(value);
}
+char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var)
+{
+ if(this->ReplaceAtSyntax)
+ {
+ return this->ExpandVariable(var);
+ }
+ else
+ {
+ std::string ref = "@";
+ ref += var;
+ ref += "@";
+ return this->AddString(ref.c_str());
+ }
+}
+
char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
{
if ( !in1 )
@@ -172,6 +188,7 @@ bool cmCommandArgumentParserHelper::HandleEscapeSymbol
case '(':
case ')':
case '$':
+ case '@':
case '^':
this->AllocateParserType(pt, &symbol, 1);
break;
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index cb6439318f..7f5078f534 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -59,6 +59,7 @@ public:
char* ExpandSpecialVariable(const char* key, const char* var);
char* ExpandVariable(const char* var);
+ char* ExpandVariableForAt(const char* var);
void SetResult(const char* value);
void SetMakefile(const cmMakefile* mf);
@@ -68,6 +69,7 @@ public:
void SetLineFile(long line, const char* file);
void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
+ void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
const char* GetError() { return this->ErrorString.c_str(); }
char EmptyVariable[1];
@@ -101,6 +103,7 @@ private:
bool EscapeQuotes;
std::string ErrorString;
bool NoEscapeMode;
+ bool ReplaceAtSyntax;
};
#endif
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 26b098afc8..8c3cff40b2 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -20,7 +20,9 @@
#include "cmAuxSourceDirectoryCommand.cxx"
#include "cmBuildNameCommand.cxx"
#include "cmCreateTestSourceList.cxx"
+#include "cmElseIfCommand.cxx"
#include "cmEnableLanguageCommand.cxx"
+#include "cmEndMacroCommand.cxx"
#include "cmEndWhileCommand.cxx"
#include "cmExecuteProcessCommand.cxx"
#include "cmExportLibraryDependencies.cxx"
@@ -73,7 +75,9 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmBuildNameCommand);
commands.push_back(new cmCreateTestSourceList);
+ commands.push_back(new cmElseIfCommand);
commands.push_back(new cmEnableLanguageCommand);
+ commands.push_back(new cmEndMacroCommand);
commands.push_back(new cmEndWhileCommand);
commands.push_back(new cmExecuteProcessCommand);
commands.push_back(new cmExportLibraryDependenciesCommand);
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 162f10f30a..521436af23 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -19,6 +19,9 @@
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
{
+ this->HaveComment = false;
+ this->EscapeOldStyle = true;
+ this->EscapeAllowMakeVars = false;
this->Used = false;
}
@@ -27,8 +30,11 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
Outputs(r.Outputs),
Depends(r.Depends),
CommandLines(r.CommandLines),
+ HaveComment(r.HaveComment),
Comment(r.Comment),
- WorkingDirectory(r.WorkingDirectory)
+ WorkingDirectory(r.WorkingDirectory),
+ EscapeAllowMakeVars(r.EscapeAllowMakeVars),
+ EscapeOldStyle(r.EscapeOldStyle)
{
this->Used = false;
}
@@ -42,9 +48,14 @@ cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs,
Outputs(outputs),
Depends(depends),
CommandLines(commandLines),
+ HaveComment(comment?true:false),
Comment(comment?comment:""),
- WorkingDirectory(workingDirectory?workingDirectory:"")
+ WorkingDirectory(workingDirectory?workingDirectory:""),
+ EscapeAllowMakeVars(false),
+ EscapeOldStyle(true)
{
+ this->EscapeOldStyle = true;
+ this->EscapeAllowMakeVars = false;
this->Used = false;
}
@@ -79,5 +90,50 @@ const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
//----------------------------------------------------------------------------
const char* cmCustomCommand::GetComment() const
{
- return this->Comment.c_str();
+ const char* no_comment = 0;
+ return this->HaveComment? this->Comment.c_str() : no_comment;
+}
+
+//----------------------------------------------------------------------------
+void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
+{
+ for(cmCustomCommandLines::const_iterator i=commandLines.begin();
+ i != commandLines.end(); ++i)
+ {
+ this->CommandLines.push_back(*i);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
+{
+ for(std::vector<std::string>::const_iterator i=depends.begin();
+ i != depends.end(); ++i)
+ {
+ this->Depends.push_back(*i);
+ }
+}
+
+//----------------------------------------------------------------------------
+bool cmCustomCommand::GetEscapeOldStyle() const
+{
+ return this->EscapeOldStyle;
+}
+
+//----------------------------------------------------------------------------
+void cmCustomCommand::SetEscapeOldStyle(bool b)
+{
+ this->EscapeOldStyle = b;
+}
+
+//----------------------------------------------------------------------------
+bool cmCustomCommand::GetEscapeAllowMakeVars() const
+{
+ return this->EscapeAllowMakeVars;
+}
+
+//----------------------------------------------------------------------------
+void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
+{
+ this->EscapeAllowMakeVars = b;
}
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 4fc300ceea..5d59f0a97d 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -53,6 +53,21 @@ public:
/** Get the comment string for the command. */
const char* GetComment() const;
+ /** Append to the list of command lines. */
+ void AppendCommands(const cmCustomCommandLines& commandLines);
+
+ /** Append to the list of dependencies. */
+ void AppendDepends(const std::vector<std::string>& depends);
+
+ /** Set/Get whether old-style escaping should be used. */
+ bool GetEscapeOldStyle() const;
+ void SetEscapeOldStyle(bool b);
+
+ /** Set/Get whether the build tool can replace variables in
+ arguments to the command. */
+ bool GetEscapeAllowMakeVars() const;
+ void SetEscapeAllowMakeVars(bool b);
+
/** set get the used status of the command */
void SetUsed() { this->Used = true;};
bool IsUsed() { return this->Used;};
@@ -61,8 +76,11 @@ private:
std::vector<std::string> Outputs;
std::vector<std::string> Depends;
cmCustomCommandLines CommandLines;
+ bool HaveComment;
std::string Comment;
std::string WorkingDirectory;
+ bool EscapeAllowMakeVars;
+ bool EscapeOldStyle;
bool Used;
};
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 7806ab3389..ff0545f4ee 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -24,20 +24,19 @@
//----------------------------------------------------------------------------
cmDependsC::cmDependsC():
- IncludePath(0), GeneratedFiles(0)
+ IncludePath(0)
{
}
//----------------------------------------------------------------------------
// yummy look at all those constructor arguments
cmDependsC::cmDependsC(std::vector<std::string> const& includes,
const char* scanRegex, const char* complainRegex,
- std::set<cmStdString> const& generatedFiles,
const cmStdString& cacheFileName):
IncludePath(&includes),
- IncludeRegexLine("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)([\">])"),
+ IncludeRegexLine(
+ "^[ \t]*#[ \t]*(include|import)[ \t]*[<\"]([^\">]+)([\">])"),
IncludeRegexScan(scanRegex),
IncludeRegexComplain(complainRegex),
- GeneratedFiles(&generatedFiles),
CacheFileName(cacheFileName)
{
this->ReadCacheFile();
@@ -49,7 +48,7 @@ cmDependsC::~cmDependsC()
this->WriteCacheFile();
for (std::map<cmStdString, cmIncludeLines*>::iterator it=
- this->fileCache.begin(); it!=this->fileCache.end(); ++it)
+ this->FileCache.begin(); it!=this->FileCache.end(); ++it)
{
delete it->second;
}
@@ -86,6 +85,13 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
std::set<cmStdString> dependencies;
std::set<cmStdString> scanned;
+ // Use reserve to allocate enough memory for both strings,
+ // so that during the loops no memory is allocated or freed
+ std::string cacheKey;
+ cacheKey.reserve(4*1024);
+ std::string tempPathStr;
+ tempPathStr.reserve(4*1024);
+
while(!this->Unscanned.empty())
{
// Get the next file to scan.
@@ -96,15 +102,13 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
std::string fullName;
if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str()))
{
- if(this->FileExistsOrIsGenerated(current.FileName, scanned,
- dependencies))
+ if(cmSystemTools::FileExists(current.FileName.c_str()))
{
fullName = current.FileName;
}
}
else if(!current.QuotedLocation.empty() &&
- this->FileExistsOrIsGenerated(current.QuotedLocation, scanned,
- dependencies))
+ cmSystemTools::FileExists(current.QuotedLocation.c_str()))
{
// The include statement producing this entry was a double-quote
// include and the included file is present in the directory of
@@ -113,26 +117,49 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
}
else
{
+ // With GCC distribution of STL, assigning to a string directly
+ // throws away the internal buffer of the left-hand-side. We
+ // want to keep the pre-allocated buffer so we use C-style
+ // string assignment and then operator+=. We could call
+ // .clear() instead of assigning to an empty string but the
+ // method does not exist on some older compilers.
+ cacheKey = "";
+ cacheKey += current.FileName;
+
for(std::vector<std::string>::const_iterator i =
this->IncludePath->begin(); i != this->IncludePath->end(); ++i)
{
+ cacheKey+=*i;
+ }
+ std::map<cmStdString, cmStdString>::iterator
+ headerLocationIt=this->HeaderLocationCache.find(cacheKey);
+ if (headerLocationIt!=this->HeaderLocationCache.end())
+ {
+ fullName=headerLocationIt->second;
+ }
+ else for(std::vector<std::string>::const_iterator i =
+ this->IncludePath->begin(); i != this->IncludePath->end(); ++i)
+ {
// Construct the name of the file as if it were in the current
// include directory. Avoid using a leading "./".
- std::string temp = *i;
- if(temp == ".")
+
+ tempPathStr = "";
+ if((*i) == ".")
{
- temp = "";
+ tempPathStr += current.FileName;
}
else
{
- temp += "/";
+ tempPathStr += *i;
+ tempPathStr+="/";
+ tempPathStr+=current.FileName;
}
- temp += current.FileName;
// Look for the file in this location.
- if(this->FileExistsOrIsGenerated(temp, scanned, dependencies))
+ if(cmSystemTools::FileExists(tempPathStr.c_str()))
{
- fullName = temp;
+ fullName = tempPathStr;
+ HeaderLocationCache[cacheKey]=fullName;
break;
}
}
@@ -156,8 +183,8 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
// Check whether this file is already in the cache
std::map<cmStdString, cmIncludeLines*>::iterator fileIt=
- this->fileCache.find(fullName);
- if (fileIt!=this->fileCache.end())
+ this->FileCache.find(fullName);
+ if (fileIt!=this->FileCache.end())
{
fileIt->second->Used=true;
dependencies.insert(fullName);
@@ -252,7 +279,7 @@ void cmDependsC::ReadCacheFile()
if ((res==true) && (newer==1)) //cache is newer than the parsed file
{
cacheEntry=new cmIncludeLines;
- this->fileCache[line]=cacheEntry;
+ this->FileCache[line]=cacheEntry;
}
}
else if (cacheEntry!=0)
@@ -285,8 +312,8 @@ void cmDependsC::WriteCacheFile() const
}
for (std::map<cmStdString, cmIncludeLines*>::const_iterator fileIt=
- this->fileCache.begin();
- fileIt!=this->fileCache.end(); ++fileIt)
+ this->FileCache.begin();
+ fileIt!=this->FileCache.end(); ++fileIt)
{
if (fileIt->second->Used)
{
@@ -317,7 +344,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
{
cmIncludeLines* newCacheEntry=new cmIncludeLines;
newCacheEntry->Used=true;
- this->fileCache[fullName]=newCacheEntry;
+ this->FileCache[fullName]=newCacheEntry;
// Read one line at a time.
std::string line;
@@ -328,8 +355,8 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
{
// Get the file being included.
UnscannedEntry entry;
- entry.FileName = this->IncludeRegexLine.match(1);
- if(this->IncludeRegexLine.match(2) == "\"" &&
+ entry.FileName = this->IncludeRegexLine.match(2);
+ if(this->IncludeRegexLine.match(3) == "\"" &&
!cmSystemTools::FileIsFullPath(entry.FileName.c_str()))
{
// This was a double-quoted include with a relative path. We
@@ -359,57 +386,3 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
}
}
}
-
-//----------------------------------------------------------------------------
-bool cmDependsC::FileExistsOrIsGenerated(const std::string& fname,
- std::set<cmStdString>& scanned,
- std::set<cmStdString>& dependencies)
-{
- // Check for a generated file.
- if(this->FileIsGenerated(fname, scanned, dependencies))
- {
- return true;
- }
- else if(cmSystemTools::FileIsFullPath(fname.c_str()))
- {
- // The generated file may have been listed with a relative path.
- // Note that CMAKE_GENERATED_FILES is written with a conversion
- // relative to the home output directory.
- std::string rname =
- this->LocalGenerator->Convert(fname.c_str(),
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::UNCHANGED);
- if(this->FileIsGenerated(rname, scanned, dependencies))
- {
- return true;
- }
- }
-
- // Check for an existing file.
- return cmSystemTools::FileExists(fname.c_str());
-}
-
-//----------------------------------------------------------------------------
-bool cmDependsC::FileIsGenerated(const std::string& fname,
- std::set<cmStdString>& scanned,
- std::set<cmStdString>& dependencies)
-{
- if(this->GeneratedFiles &&
- std::set<cmStdString>::const_iterator(this->GeneratedFiles->find(fname))
- != this->GeneratedFiles->end())
- {
- // If the file does not really exist yet pretend it has already
- // been scanned. When it exists later then dependencies will be
- // rescanned.
- if(!cmSystemTools::FileExists(fname.c_str()))
- {
- scanned.insert(fname);
- dependencies.insert(fname);
- }
- return true;
- }
- else
- {
- return false;
- }
-}
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index f618b18c43..a891460279 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -32,7 +32,6 @@ public:
cmDependsC();
cmDependsC(std::vector<std::string> const& includes,
const char* scanRegex, const char* complainRegex,
- std::set<cmStdString> const& generatedFiles,
const cmStdString& cachFileName);
/** Virtual destructor to cleanup subclasses properly. */
@@ -51,14 +50,6 @@ protected:
void Scan(std::istream& is, const char* directory,
const cmStdString& fullName);
- // Method to test for the existence of a file.
- bool FileExistsOrIsGenerated(const std::string& fname,
- std::set<cmStdString>& scanned,
- std::set<cmStdString>& dependencies);
- bool FileIsGenerated(const std::string& fname,
- std::set<cmStdString>& scanned,
- std::set<cmStdString>& dependencies);
-
// The include file search path.
std::vector<std::string> const* IncludePath;
@@ -70,8 +61,6 @@ protected:
cmsys::RegularExpression IncludeRegexScan;
cmsys::RegularExpression IncludeRegexComplain;
- // Set of generated files available.
- std::set<cmStdString> const* GeneratedFiles;
public:
// Data structures for dependency graph walk.
struct UnscannedEntry
@@ -91,7 +80,8 @@ protected:
std::queue<UnscannedEntry> Unscanned;
t_CharBuffer Buffer;
- std::map<cmStdString, cmIncludeLines *> fileCache;
+ std::map<cmStdString, cmIncludeLines *> FileCache;
+ std::map<cmStdString, cmStdString> HeaderLocationCache;
cmStdString CacheFileName;
diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx
index d9c370f39a..318443e51b 100644
--- a/Source/cmDependsFortranLexer.cxx
+++ b/Source/cmDependsFortranLexer.cxx
@@ -640,40 +640,16 @@ Modify cmDependsFortranLexer.h:
*/
+#include "cmStandardLexer.h"
+
#define cmDependsFortranLexer_cxx
#include "cmDependsFortranParser.h" /* Interface to parser object. */
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#define ECHO
-
/* Replace the lexer input function. */
#undef YY_INPUT
#define YY_INPUT(buf, result, max_size) \
{ result = cmDependsFortranParser_Input(yyextra, buf, max_size); }
-/* Provide isatty on Windows. */
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
/* Include the set of tokens from the parser. */
#include "cmDependsFortranParserTokens.h"
diff --git a/Source/cmDependsFortranLexer.in.l b/Source/cmDependsFortranLexer.in.l
index a9ed2566c7..8326eaeaa0 100644
--- a/Source/cmDependsFortranLexer.in.l
+++ b/Source/cmDependsFortranLexer.in.l
@@ -36,7 +36,7 @@ Run flex like this:
Modify cmDependsFortranLexer.cxx:
- remove TABs
- remove "yyscanner" argument from these methods:
- yy_fatal_error, yyalloc, yyrealloc, yyfree
+ yy_fatal_error, cmDependsFortran_yyalloc, cmDependsFortran_yyrealloc, cmDependsFortran_yyfree
- remove all YY_BREAK lines occurring right after return statements
- change while ( 1 ) to for(;;)
@@ -48,40 +48,16 @@ Modify cmDependsFortranLexer.h:
*/
+#include "cmStandardLexer.h"
+
#define cmDependsFortranLexer_cxx
#include "cmDependsFortranParser.h" /* Interface to parser object. */
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#define ECHO
-
/* Replace the lexer input function. */
#undef YY_INPUT
#define YY_INPUT(buf, result, max_size) \
{ result = cmDependsFortranParser_Input(yyextra, buf, max_size); }
-/* Provide isatty on Windows. */
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
/* Include the set of tokens from the parser. */
#include "cmDependsFortranParserTokens.h"
diff --git a/Source/cmDependsFortranParser.cxx b/Source/cmDependsFortranParser.cxx
index 2f64764814..dc69e361e8 100644
--- a/Source/cmDependsFortranParser.cxx
+++ b/Source/cmDependsFortranParser.cxx
@@ -191,6 +191,9 @@ static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
diff --git a/Source/cmDependsFortranParser.y b/Source/cmDependsFortranParser.y
index be04c38fd8..aec8e216fc 100644
--- a/Source/cmDependsFortranParser.y
+++ b/Source/cmDependsFortranParser.y
@@ -65,6 +65,9 @@ static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx
index bee9e241e2..ac0da737e1 100644
--- a/Source/cmDependsJavaLexer.cxx
+++ b/Source/cmDependsJavaLexer.cxx
@@ -1,3 +1,4 @@
+#include "cmStandardIncludes.h"
#line 2 "cmDependsJavaLexer.cxx"
#line 4 "cmDependsJavaLexer.cxx"
@@ -671,28 +672,13 @@ Modify cmDependsJavaLexer.h:
- remove TABs
- remove the yy_init_globals function
- remove the block that includes unistd.h
+ - remove #line directives (avoids bogus warning on old Sun)
*/
-#include "cmDependsJavaParserHelper.h"
-
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
+#include "cmStandardLexer.h"
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#undef ECHO /* SGI termios defines this differently. */
-#define ECHO
+#include "cmDependsJavaParserHelper.h"
/* Replace the lexer input function. */
#undef YY_INPUT
@@ -702,16 +688,6 @@ Modify cmDependsJavaLexer.h:
/* Include the set of tokens from the parser. */
#include "cmDependsJavaParserTokens.h"
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-/* Handle Windows properly */
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
#define KEYWORD yylvalp->str = 0
#define SYMBOL yylvalp->str = 0
#define PRIMITIVE yylvalp->str = 0
diff --git a/Source/cmDependsJavaLexer.in.l b/Source/cmDependsJavaLexer.in.l
index 22879b9e13..f26aede297 100644
--- a/Source/cmDependsJavaLexer.in.l
+++ b/Source/cmDependsJavaLexer.in.l
@@ -23,10 +23,10 @@ Run flex like this:
flex --prefix=cmDependsJava_yy --header-file=cmDependsJavaLexer.h -ocmDependsJavaLexer.cxx cmDependsJavaLexer.in.l
-Modify cmDependsJavaLexer.cxx:
+Modify cmDependsJavaLexer.c:
- remove TABs
- remove "yyscanner" argument from these methods:
- yy_fatal_error, yyalloc, yyrealloc, yyfree
+ yy_fatal_error, cmDependsJava_yyalloc, cmDependsJava_yyrealloc, cmDependsJava_yyfree
- remove all YY_BREAK lines occurring right after return statements
- change while ( 1 ) to for(;;)
@@ -38,25 +38,9 @@ Modify cmDependsJavaLexer.h:
*/
-#include "cmDependsJavaParserHelper.h"
+#include "cmStandardLexer.h"
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#undef ECHO /* SGI termios defines this differently. */
-#define ECHO
+#include "cmDependsJavaParserHelper.h"
/* Replace the lexer input function. */
#undef YY_INPUT
@@ -66,16 +50,6 @@ Modify cmDependsJavaLexer.h:
/* Include the set of tokens from the parser. */
#include "cmDependsJavaParserTokens.h"
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-/* Handle Windows properly */
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
#define KEYWORD yylvalp->str = 0
#define SYMBOL yylvalp->str = 0
#define PRIMITIVE yylvalp->str = 0
diff --git a/Source/cmDependsJavaParser.cxx b/Source/cmDependsJavaParser.cxx
index 2b1690c66c..5405c05753 100644
--- a/Source/cmDependsJavaParser.cxx
+++ b/Source/cmDependsJavaParser.cxx
@@ -338,6 +338,9 @@ yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str))
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
diff --git a/Source/cmDependsJavaParser.y b/Source/cmDependsJavaParser.y
index def6f2d116..1d8956d087 100644
--- a/Source/cmDependsJavaParser.y
+++ b/Source/cmDependsJavaParser.y
@@ -58,6 +58,9 @@ static void cmDependsJavaError(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 2b148eaf2e..f811e70cd4 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -69,12 +69,33 @@ static const cmDocumentationEntry cmDocumentationGeneratorsHeader[] =
};
//----------------------------------------------------------------------------
-const cmDocumentationEntry cmDocumentationMailingList[] =
+static const cmDocumentationEntry cmDocumentationStandardSeeAlso[] =
{
{0,
- "For help and discussion about using cmake, a mailing list is provided "
- "at cmake@www.cmake.org. Please first read the full documentation at "
- "http://www.cmake.org before posting questions to the list.", 0},
+ "The following resources are available to get help using CMake:", 0},
+ {"Home Page",
+ "http://www.cmake.org",
+ "The primary starting point for learning about CMake."},
+ {"Frequently Asked Questions",
+ "http://www.cmake.org/Wiki/CMake_FAQ",
+ "A Wiki is provided containing answers to frequently asked questions. "},
+ {"Online Documentation",
+ "http://www.cmake.org/HTML/Documentation.html",
+ "Links to available documentation may be found on this web page."},
+ {"Mailing List",
+ "http://www.cmake.org/HTML/MailingLists.html",
+ "For help and discussion about using cmake, a mailing list is provided at "
+ "cmake@cmake.org. "
+ "The list is member-post-only but one may sign up on the CMake web page. "
+ "Please first read the full documentation at "
+ "http://www.cmake.org before posting questions to the list."},
+ {0,
+ "Summary of helpful links:\n"
+ " Home: http://www.cmake.org\n"
+ " Docs: http://www.cmake.org/HTML/Documentation.html\n"
+ " Mail: http://www.cmake.org/HTML/MailingLists.html\n"
+ " FAQ: http://www.cmake.org/Wiki/CMake_FAQ\n"
+ , 0},
{0,0,0}
};
@@ -545,6 +566,7 @@ void cmDocumentation
//----------------------------------------------------------------------------
void cmDocumentation::SetSeeAlsoList(const cmDocumentationEntry* also)
{
+ this->SeeAlsoSection.clear();
this->SeeAlsoString = ".B ";
for(const cmDocumentationEntry* i = also; i->brief; ++i)
{
@@ -554,6 +576,11 @@ void cmDocumentation::SetSeeAlsoList(const cmDocumentationEntry* also)
cmDocumentationEntry e = {0, 0, 0};
e.brief = this->SeeAlsoString.c_str();
this->SeeAlsoSection.push_back(e);
+ for(const cmDocumentationEntry* i = cmDocumentationStandardSeeAlso;
+ i->brief; ++i)
+ {
+ this->SeeAlsoSection.push_back(*i);
+ }
e.brief = 0;
this->SeeAlsoSection.push_back(e);
}
@@ -840,13 +867,17 @@ void cmDocumentation::PrintParagraphHTML(std::ostream& os, const char* text)
//----------------------------------------------------------------------------
void cmDocumentation::PrintPreformattedMan(std::ostream& os, const char* text)
{
- os << text << "\n";
+ std::string man_text = text;
+ cmSystemTools::ReplaceString(man_text, "\\", "\\\\");
+ os << man_text << "\n";
}
//----------------------------------------------------------------------------
void cmDocumentation::PrintParagraphMan(std::ostream& os, const char* text)
{
- os << text << "\n\n";
+ std::string man_text = text;
+ cmSystemTools::ReplaceString(man_text, "\\", "\\\\");
+ os << man_text << "\n\n";
}
//----------------------------------------------------------------------------
@@ -1166,7 +1197,7 @@ void cmDocumentation::CreateFullDocumentation()
this->AddSection("Standard CMake Modules", &this->ModulesSection[0]);
}
this->AddSection("Copyright", cmDocumentationCopyright);
- this->AddSection("Mailing List", cmDocumentationMailingList);
+ this->AddSection("See Also", cmDocumentationStandardSeeAlso);
}
//----------------------------------------------------------------------------
@@ -1204,7 +1235,6 @@ void cmDocumentation::CreateManDocumentation()
}
this->AddSection("COPYRIGHT", cmDocumentationCopyright);
- this->AddSection("MAILING LIST", cmDocumentationMailingList);
if(!this->SeeAlsoSection.empty())
{
this->AddSection("SEE ALSO", &this->SeeAlsoSection[0]);
diff --git a/Source/cmElseIfCommand.cxx b/Source/cmElseIfCommand.cxx
new file mode 100644
index 0000000000..41b55b2c87
--- /dev/null
+++ b/Source/cmElseIfCommand.cxx
@@ -0,0 +1,24 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmElseIfCommand.h"
+
+bool cmElseIfCommand::InitialPass(std::vector<std::string> const&)
+{
+ this->SetError("An ELSEIF command was found outside of a proper "
+ "IF ENDIF structure.");
+ return false;
+}
diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h
new file mode 100644
index 0000000000..ca6b1f4dad
--- /dev/null
+++ b/Source/cmElseIfCommand.h
@@ -0,0 +1,76 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmElseIfCommand_h
+#define cmElseIfCommand_h
+
+#include "cmIfCommand.h"
+
+/** \class cmElseIfCommand
+ * \brief ends an if block
+ *
+ * cmElseIfCommand ends an if block
+ */
+class cmElseIfCommand : public cmCommand
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ virtual cmCommand* Clone()
+ {
+ return new cmElseIfCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args);
+
+ /**
+ * This determines if the command is invoked when in script mode.
+ */
+ virtual bool IsScriptable() { return true; }
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() { return "ELSEIF";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Starts the ELSEIF portion of an IF block.";
+ }
+
+ /**
+ * More documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ " ELSEIF(expression)\n"
+ "See the IF command.";
+ }
+
+ cmTypeMacro(cmElseIfCommand, cmCommand);
+};
+
+
+#endif
diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx
new file mode 100644
index 0000000000..a2ba862605
--- /dev/null
+++ b/Source/cmEndMacroCommand.cxx
@@ -0,0 +1,27 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmEndMacroCommand.h"
+
+bool cmEndMacroCommand
+::InvokeInitialPass(std::vector<cmListFileArgument> const&)
+{
+ this->SetError("An ENDMACRO command was found outside of a proper "
+ "MACRO ENDMACRO structure. Or its arguments did not "
+ "match the opening MACRO command.");
+ return false;
+}
+
diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h
new file mode 100644
index 0000000000..be1467bc8d
--- /dev/null
+++ b/Source/cmEndMacroCommand.h
@@ -0,0 +1,82 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmEndMacroCommand_h
+#define cmEndMacroCommand_h
+
+#include "cmCommand.h"
+
+/** \class cmEndMacroCommand
+ * \brief ends an if block
+ *
+ * cmEndMacroCommand ends an if block
+ */
+class cmEndMacroCommand : public cmCommand
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ virtual cmCommand* Clone()
+ {
+ return new cmEndMacroCommand;
+ }
+
+ /**
+ * Override cmCommand::InvokeInitialPass to get arguments before
+ * expansion.
+ */
+ virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&);
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const&) {return false;}
+
+ /**
+ * This determines if the command is invoked when in script mode.
+ */
+ virtual bool IsScriptable() { return true; }
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() { return "ENDMACRO";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Ends a list of commands in a MACRO block.";
+ }
+
+ /**
+ * More documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ " ENDMACRO(expression)\n"
+ "See the MACRO command.";
+ }
+
+ cmTypeMacro(cmEndMacroCommand, cmCommand);
+};
+
+
+#endif
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 339bda84aa..4836337949 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -88,6 +88,12 @@ public:
;
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmExecProgramCommand, cmCommand);
};
diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx
index 093e206ee0..6183804a86 100644
--- a/Source/cmExprLexer.cxx
+++ b/Source/cmExprLexer.cxx
@@ -1,3 +1,4 @@
+#include "cmStandardIncludes.h"
#line 2 "/home/andy/vtk/CMake-bin/Source/cmExprLexer.cxx"
#line 4 "/home/andy/vtk/CMake-bin/Source/cmExprLexer.cxx"
@@ -458,8 +459,7 @@ This file must be translated to C and modified to build everywhere.
Run flex like this:
- flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx
- cmExprLexer.in.l
+ flex --prefix=cmExpr_yy --header-file=cmExprLexer.h -ocmExprLexer.cxx cmExprLexer.in.l
Modify cmExprLexer.cxx:
- remove TABs
@@ -476,25 +476,9 @@ Modify cmExprLexer.h:
*/
-#include "cmExprParserHelper.h"
-
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
+#include "cmStandardLexer.h"
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#undef ECHO /* SGI termios defines this differently. */
-#define ECHO
+#include "cmExprParserHelper.h"
/* Replace the lexer input function. */
#undef YY_INPUT
@@ -504,16 +488,6 @@ Modify cmExprLexer.h:
/* Include the set of tokens from the parser. */
#include "cmExprParserTokens.h"
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-/* Handle Windows properly */
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
/*--------------------------------------------------------------------------*/
#line 518 "/home/andy/vtk/CMake-bin/Source/cmExprLexer.cxx"
diff --git a/Source/cmExprLexer.in.l b/Source/cmExprLexer.in.l
index 7e6b6cd260..fccc4f6060 100644
--- a/Source/cmExprLexer.in.l
+++ b/Source/cmExprLexer.in.l
@@ -26,7 +26,7 @@ Run flex like this:
Modify cmExprLexer.cxx:
- remove TABs
- remove "yyscanner" argument from these methods:
- yy_fatal_error, yyalloc, yyrealloc, yyfree
+ yy_fatal_error, cmExpr_yyalloc, cmExpr_yyrealloc, cmExpr_yyfree
- remove all YY_BREAK lines occurring right after return statements
- change while ( 1 ) to for(;;)
@@ -38,25 +38,9 @@ Modify cmExprLexer.h:
*/
-#include "cmExprParserHelper.h"
+#include "cmStandardLexer.h"
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#undef ECHO /* SGI termios defines this differently. */
-#define ECHO
+#include "cmExprParserHelper.h"
/* Replace the lexer input function. */
#undef YY_INPUT
@@ -66,16 +50,6 @@ Modify cmExprLexer.h:
/* Include the set of tokens from the parser. */
#include "cmExprParserTokens.h"
-
-#if defined( _WIN32 ) && !defined( __CYGWIN__ )
-/* Handle Windows properly */
-# include <io.h>
-# if defined( _MSC_VER )
-# define isatty _isatty
-# endif
-# define YY_NO_UNISTD_H 1
-#endif
-
/*--------------------------------------------------------------------------*/
%}
diff --git a/Source/cmExprParser.cxx b/Source/cmExprParser.cxx
index e973d1c4b9..6c55f22ed3 100644
--- a/Source/cmExprParser.cxx
+++ b/Source/cmExprParser.cxx
@@ -159,6 +159,9 @@ static void cmExprError(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
diff --git a/Source/cmExprParser.y b/Source/cmExprParser.y
index 27935f6593..2451abbd76 100644
--- a/Source/cmExprParser.y
+++ b/Source/cmExprParser.y
@@ -58,6 +58,9 @@ static void cmExprError(yyscan_t yyscanner, const char* message);
/* Disable some warnings in the generated code. */
#ifdef __BORLANDC__
# pragma warn -8004 /* Variable assigned a value that is not used. */
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8060 /* possibly incorrect assignment */
+# pragma warn -8066 /* unreachable code */
#endif
#ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index bbf42658f0..52ab48a015 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -20,6 +20,34 @@
#include <sys/stat.h>
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/RegularExpression.hxx>
+
+// Table of permissions flags.
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static mode_t mode_owner_read = S_IREAD;
+static mode_t mode_owner_write = S_IWRITE;
+static mode_t mode_owner_execute = S_IEXEC;
+static mode_t mode_group_read = 0;
+static mode_t mode_group_write = 0;
+static mode_t mode_group_execute = 0;
+static mode_t mode_world_read = 0;
+static mode_t mode_world_write = 0;
+static mode_t mode_world_execute = 0;
+static mode_t mode_setuid = 0;
+static mode_t mode_setgid = 0;
+#else
+static mode_t mode_owner_read = S_IRUSR;
+static mode_t mode_owner_write = S_IWUSR;
+static mode_t mode_owner_execute = S_IXUSR;
+static mode_t mode_group_read = S_IRGRP;
+static mode_t mode_group_write = S_IWGRP;
+static mode_t mode_group_execute = S_IXGRP;
+static mode_t mode_world_read = S_IROTH;
+static mode_t mode_world_write = S_IWOTH;
+static mode_t mode_world_execute = S_IXOTH;
+static mode_t mode_setuid = S_ISUID;
+static mode_t mode_setgid = S_ISGID;
+#endif
// cmLibraryCommand
bool cmFileCommand::InitialPass(std::vector<std::string> const& args)
@@ -316,6 +344,286 @@ bool cmFileCommand::HandleMakeDirectoryCommand(
}
//----------------------------------------------------------------------------
+// File installation helper class.
+struct cmFileInstaller
+{
+ // Methods to actually install files.
+ bool InstallFile(const char* fromFile, const char* toFile, bool always);
+ bool InstallDirectory(const char* source, const char* destination,
+ bool always);
+
+ // All instances need the file command and makefile using them.
+ cmFileInstaller(cmFileCommand* fc, cmMakefile* mf):
+ FileCommand(fc), Makefile(mf), DestDirLength(0)
+ {
+ // Get the current manifest.
+ this->Manifest =
+ this->Makefile->GetSafeDefinition("CMAKE_INSTALL_MANIFEST_FILES");
+ }
+ ~cmFileInstaller()
+ {
+ // Save the updated install manifest.
+ this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES",
+ this->Manifest.c_str());
+ }
+
+private:
+ cmFileCommand* FileCommand;
+ cmMakefile* Makefile;
+public:
+
+ // The length of the destdir setting.
+ int DestDirLength;
+
+ // The current file manifest (semicolon separated list).
+ std::string Manifest;
+
+ // Permissions for files and directories installed by this object.
+ mode_t FilePermissions;
+ mode_t DirPermissions;
+
+ // Properties set by pattern and regex match rules.
+ struct MatchProperties
+ {
+ bool Exclude;
+ mode_t Permissions;
+ MatchProperties(): Exclude(false), Permissions(0) {}
+ };
+ struct MatchRule
+ {
+ cmsys::RegularExpression Regex;
+ MatchProperties Properties;
+ std::string RegexString;
+ MatchRule(std::string const& regex):
+ Regex(regex.c_str()), RegexString(regex) {}
+ };
+ std::vector<MatchRule> MatchRules;
+
+ // Get the properties from rules matching this input file.
+ MatchProperties CollectMatchProperties(const char* file)
+ {
+ // Match rules are case-insensitive on some platforms.
+#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+ std::string lower = cmSystemTools::LowerCase(file);
+ file = lower.c_str();
+#endif
+
+ // Collect properties from all matching rules.
+ MatchProperties result;
+ for(std::vector<MatchRule>::iterator mr = this->MatchRules.begin();
+ mr != this->MatchRules.end(); ++mr)
+ {
+ if(mr->Regex.find(file))
+ {
+ result.Exclude |= mr->Properties.Exclude;
+ result.Permissions |= mr->Properties.Permissions;
+ }
+ }
+ return result;
+ }
+
+ // Append a file to the installation manifest.
+ void ManifestAppend(std::string const& file)
+ {
+ this->Manifest += ";";
+ this->Manifest += file.substr(this->DestDirLength);
+ }
+
+ // Translate an argument to a permissions bit.
+ bool CheckPermissions(std::string const& arg, mode_t& permissions)
+ {
+ if(arg == "OWNER_READ") { permissions |= mode_owner_read; }
+ else if(arg == "OWNER_WRITE") { permissions |= mode_owner_write; }
+ else if(arg == "OWNER_EXECUTE") { permissions |= mode_owner_execute; }
+ else if(arg == "GROUP_READ") { permissions |= mode_group_read; }
+ else if(arg == "GROUP_WRITE") { permissions |= mode_group_write; }
+ else if(arg == "GROUP_EXECUTE") { permissions |= mode_group_execute; }
+ else if(arg == "WORLD_READ") { permissions |= mode_world_read; }
+ else if(arg == "WORLD_WRITE") { permissions |= mode_world_write; }
+ else if(arg == "WORLD_EXECUTE") { permissions |= mode_world_execute; }
+ else if(arg == "SETUID") { permissions |= mode_setuid; }
+ else if(arg == "SETGID") { permissions |= mode_setgid; }
+ else
+ {
+ cmOStringStream e;
+ e << "INSTALL given invalid permission \"" << arg << "\".";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
+ return true;
+ }
+};
+
+//----------------------------------------------------------------------------
+bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
+ bool always)
+{
+ // Collect any properties matching this file name.
+ MatchProperties match_properties = this->CollectMatchProperties(fromFile);
+
+ // Skip the file if it is excluded.
+ if(match_properties.Exclude)
+ {
+ return true;
+ }
+
+ // Inform the user about this file installation.
+ std::string message = "Installing ";
+ message += toFile;
+ this->Makefile->DisplayStatus(message.c_str(), -1);
+
+ // Copy the file.
+ if(!cmSystemTools::CopyAFile(fromFile, toFile, always))
+ {
+ cmOStringStream e;
+ e << "INSTALL cannot copy file \"" << fromFile
+ << "\" to \"" << toFile << "\".";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Add the file to the manifest.
+ this->ManifestAppend(toFile);
+
+ // Set permissions of the destination file.
+ mode_t permissions = (match_properties.Permissions?
+ match_properties.Permissions : this->FilePermissions);
+ if(!permissions)
+ {
+ // No permissions were explicitly provided but the user requested
+ // that the source file permissions be used.
+ cmSystemTools::GetPermissions(fromFile, permissions);
+ }
+ if(permissions && !cmSystemTools::SetPermissions(toFile, permissions))
+ {
+ cmOStringStream e;
+ e << "Problem setting permissions on file \"" << toFile << "\"";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmFileInstaller::InstallDirectory(const char* source,
+ const char* destination,
+ bool always)
+{
+ // Collect any properties matching this directory name.
+ MatchProperties match_properties = this->CollectMatchProperties(source);
+
+ // Skip the directory if it is excluded.
+ if(match_properties.Exclude)
+ {
+ return true;
+ }
+
+ // Inform the user about this directory installation.
+ std::string message = "Installing ";
+ message += destination;
+ this->Makefile->DisplayStatus(message.c_str(), -1);
+
+ // Make sure the destination directory exists.
+ if(!cmSystemTools::MakeDirectory(destination))
+ {
+ return false;
+ }
+
+ // Compute the requested permissions for the destination directory.
+ mode_t permissions = (match_properties.Permissions?
+ match_properties.Permissions : this->DirPermissions);
+ if(!permissions)
+ {
+ // No permissions were explicitly provided but the user requested
+ // that the source directory permissions be used.
+ cmSystemTools::GetPermissions(source, permissions);
+ }
+
+ // Compute the set of permissions required on this directory to
+ // recursively install files and subdirectories safely.
+ mode_t required_permissions =
+ mode_owner_read | mode_owner_write | mode_owner_execute;
+
+ // If the required permissions are specified it is safe to set the
+ // final permissions now. Otherwise we must add the required
+ // permissions temporarily during file installation.
+ mode_t permissions_before = 0;
+ mode_t permissions_after = 0;
+ if(permissions & required_permissions)
+ {
+ permissions_before = permissions;
+ }
+ else
+ {
+ permissions_before = permissions | required_permissions;
+ permissions_after = permissions;
+ }
+
+ // Set the required permissions of the destination directory.
+ if(permissions_before &&
+ !cmSystemTools::SetPermissions(destination, permissions_before))
+ {
+ cmOStringStream e;
+ e << "Problem setting permissions on directory \""
+ << destination << "\"";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Load the directory contents to traverse it recursively.
+ cmsys::Directory dir;
+ if(source && *source)
+ {
+ dir.Load(source);
+ }
+ unsigned long numFiles = static_cast<unsigned long>(dir.GetNumberOfFiles());
+ for(unsigned long fileNum = 0; fileNum < numFiles; ++fileNum)
+ {
+ if(!(strcmp(dir.GetFile(fileNum), ".") == 0 ||
+ strcmp(dir.GetFile(fileNum), "..") == 0))
+ {
+ cmsys_stl::string fromPath = source;
+ fromPath += "/";
+ fromPath += dir.GetFile(fileNum);
+ if(cmSystemTools::FileIsDirectory(fromPath.c_str()))
+ {
+ cmsys_stl::string toDir = destination;
+ toDir += "/";
+ toDir += dir.GetFile(fileNum);
+ if(!this->InstallDirectory(fromPath.c_str(), toDir.c_str(), always))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // Install this file.
+ std::string toFile = destination;
+ toFile += "/";
+ toFile += dir.GetFile(fileNum);
+ if(!this->InstallFile(fromPath.c_str(), toFile.c_str(), always))
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ // Set the requested permissions of the destination directory.
+ if(permissions_after &&
+ !cmSystemTools::SetPermissions(destination, permissions_after))
+ {
+ cmOStringStream e;
+ e << "Problem setting permissions on directory \"" << destination << "\"";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------------
bool cmFileCommand::HandleInstallCommand(
std::vector<std::string> const& args)
{
@@ -325,6 +633,9 @@ bool cmFileCommand::HandleInstallCommand(
return false;
}
+ // Construct a file installer object.
+ cmFileInstaller installer(this, this->Makefile);
+
std::string rename = "";
std::string destination = "";
std::string stype = "FILES";
@@ -340,56 +651,52 @@ bool cmFileCommand::HandleInstallCommand(
std::map<cmStdString, const char*> properties;
- // Build a table of permissions flags.
-#if defined(_WIN32) && !defined(__CYGWIN__)
- mode_t mode_owner_read = S_IREAD;
- mode_t mode_owner_write = S_IWRITE;
- mode_t mode_owner_execute = S_IEXEC;
- mode_t mode_group_read = 0;
- mode_t mode_group_write = 0;
- mode_t mode_group_execute = 0;
- mode_t mode_world_read = 0;
- mode_t mode_world_write = 0;
- mode_t mode_world_execute = 0;
- mode_t mode_setuid = 0;
- mode_t mode_setgid = 0;
-#else
- mode_t mode_owner_read = S_IRUSR;
- mode_t mode_owner_write = S_IWUSR;
- mode_t mode_owner_execute = S_IXUSR;
- mode_t mode_group_read = S_IRGRP;
- mode_t mode_group_write = S_IWGRP;
- mode_t mode_group_execute = S_IXGRP;
- mode_t mode_world_read = S_IROTH;
- mode_t mode_world_write = S_IWOTH;
- mode_t mode_world_execute = S_IXOTH;
- mode_t mode_setuid = S_ISUID;
- mode_t mode_setgid = S_ISGID;
-#endif
-
- bool in_files = false;
- bool in_properties = false;
- bool in_permissions = false;
- bool in_components = false;
- bool in_configurations = false;
- bool use_given_permissions = false;
- mode_t permissions = 0;
+ bool doing_files = false;
+ bool doing_properties = false;
+ bool doing_permissions_file = false;
+ bool doing_permissions_dir = false;
+ bool doing_permissions_match = false;
+ bool doing_components = false;
+ bool doing_configurations = false;
+ bool use_given_permissions_file = false;
+ bool use_given_permissions_dir = false;
+ bool use_source_permissions = false;
+ mode_t permissions_file = 0;
+ mode_t permissions_dir = 0;
bool optional = false;
+ cmFileInstaller::MatchRule* current_match_rule = 0;
for ( ; i != args.size(); ++i )
{
const std::string* cstr = &args[i];
if ( *cstr == "DESTINATION" && i < args.size()-1 )
{
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
i++;
destination = args[i];
- in_files = false;
- in_properties = false;
- in_permissions = false;
- in_components = false;
- in_configurations = false;
+ doing_files = false;
+ doing_properties = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
}
else if ( *cstr == "TYPE" && i < args.size()-1 )
{
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
i++;
stype = args[i];
if ( args[i+1] == "OPTIONAL" )
@@ -397,123 +704,226 @@ bool cmFileCommand::HandleInstallCommand(
i++;
optional = true;
}
- in_properties = false;
- in_files = false;
- in_permissions = false;
- in_components = false;
- in_configurations = false;
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
}
else if ( *cstr == "RENAME" && i < args.size()-1 )
{
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
i++;
rename = args[i];
- in_properties = false;
- in_files = false;
- in_permissions = false;
- in_components = false;
- in_configurations = false;
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
+ }
+ else if ( *cstr == "REGEX" && i < args.size()-1 )
+ {
+ i++;
+ installer.MatchRules.push_back(cmFileInstaller::MatchRule(args[i]));
+ current_match_rule = &*(installer.MatchRules.end()-1);
+ if(!current_match_rule->Regex.is_valid())
+ {
+ cmOStringStream e;
+ e << "INSTALL could not compile REGEX \"" << args[i] << "\".";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
+ }
+ else if ( *cstr == "EXCLUDE" )
+ {
+ // Add this property to the current match rule.
+ if(!current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \""
+ << *cstr << "\" before a REGEX is given.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ current_match_rule->Properties.Exclude = true;
+ doing_permissions_match = true;
}
else if ( *cstr == "PROPERTIES" )
{
- in_properties = true;
- in_files = false;
- in_permissions = false;
- in_components = false;
- in_configurations = false;
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ doing_properties = true;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
}
else if ( *cstr == "PERMISSIONS" )
{
- use_given_permissions = true;
- in_properties = false;
- in_files = false;
- in_permissions = true;
- in_components = false;
- in_configurations = false;
+ if(current_match_rule)
+ {
+ doing_permissions_match = true;
+ doing_permissions_file = false;
+ }
+ else
+ {
+ doing_permissions_match = false;
+ doing_permissions_file = true;
+ use_given_permissions_file = true;
+ }
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
+ }
+ else if ( *cstr == "DIR_PERMISSIONS" )
+ {
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ use_given_permissions_dir = true;
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = true;
+ doing_components = false;
+ doing_configurations = false;
+ }
+ else if ( *cstr == "USE_SOURCE_PERMISSIONS" )
+ {
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
+ use_source_permissions = true;
}
else if ( *cstr == "COMPONENTS" )
{
- in_properties = false;
- in_files = false;
- in_permissions = false;
- in_components = true;
- in_configurations = false;
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = true;
+ doing_configurations = false;
}
else if ( *cstr == "CONFIGURATIONS" )
{
- in_properties = false;
- in_files = false;
- in_permissions = false;
- in_components = false;
- in_configurations = true;
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ doing_properties = false;
+ doing_files = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = true;
}
- else if ( *cstr == "FILES" && !in_files)
+ else if ( *cstr == "FILES" && !doing_files)
{
- in_files = true;
- in_properties = false;
- in_permissions = false;
- in_components = false;
- in_configurations = false;
+ if(current_match_rule)
+ {
+ cmOStringStream e;
+ e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ doing_files = true;
+ doing_properties = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_components = false;
+ doing_configurations = false;
}
- else if ( in_properties && i < args.size()-1 )
+ else if ( doing_properties && i < args.size()-1 )
{
properties[args[i]] = args[i+1].c_str();
i++;
}
- else if ( in_files )
+ else if ( doing_files )
{
files.push_back(*cstr);
}
- else if ( in_components )
+ else if ( doing_components )
{
components.insert(*cstr);
}
- else if ( in_configurations )
+ else if ( doing_configurations )
{
configurations.insert(cmSystemTools::UpperCase(*cstr));
}
- else if(in_permissions && args[i] == "OWNER_READ")
+ else if(doing_permissions_file)
{
- permissions |= mode_owner_read;
- }
- else if(in_permissions && args[i] == "OWNER_WRITE")
+ if(!installer.CheckPermissions(args[i], permissions_file))
{
- permissions |= mode_owner_write;
+ return false;
}
- else if(in_permissions && args[i] == "OWNER_EXECUTE")
- {
- permissions |= mode_owner_execute;
}
- else if(in_permissions && args[i] == "GROUP_READ")
+ else if(doing_permissions_dir)
{
- permissions |= mode_group_read;
- }
- else if(in_permissions && args[i] == "GROUP_WRITE")
+ if(!installer.CheckPermissions(args[i], permissions_dir))
{
- permissions |= mode_group_write;
- }
- else if(in_permissions && args[i] == "GROUP_EXECUTE")
- {
- permissions |= mode_group_execute;
- }
- else if(in_permissions && args[i] == "WORLD_READ")
- {
- permissions |= mode_world_read;
+ return false;
}
- else if(in_permissions && args[i] == "WORLD_WRITE")
- {
- permissions |= mode_world_write;
}
- else if(in_permissions && args[i] == "WORLD_EXECUTE")
+ else if(doing_permissions_match)
{
- permissions |= mode_world_execute;
- }
- else if(in_permissions && args[i] == "SETUID")
+ if(!installer.CheckPermissions(
+ args[i], current_match_rule->Properties.Permissions))
{
- permissions |= mode_setuid;
+ return false;
}
- else if(in_permissions && args[i] == "SETGID")
- {
- permissions |= mode_setgid;
}
else
{
@@ -562,7 +972,6 @@ bool cmFileCommand::HandleInstallCommand(
}
}
- int destDirLength = 0;
if ( destdir && *destdir )
{
std::string sdestdir = destdir;
@@ -616,7 +1025,7 @@ bool cmFileCommand::HandleInstallCommand(
}
}
destination = sdestdir + (destination.c_str() + skip);
- destDirLength = int(sdestdir.size());
+ installer.DestDirLength = int(sdestdir.size());
}
if ( files.size() == 0 )
@@ -671,9 +1080,11 @@ bool cmFileCommand::HandleInstallCommand(
// Check rename form.
if(!rename.empty())
{
- if(itype != cmTarget::INSTALL_FILES)
+ if(itype != cmTarget::INSTALL_FILES &&
+ itype != cmTarget::INSTALL_PROGRAMS)
{
- this->SetError("INSTALL option RENAME may be used only with FILES.");
+ this->SetError("INSTALL option RENAME may be used only with "
+ "FILES or PROGRAMS.");
return false;
}
if(files.size() > 1)
@@ -683,9 +1094,9 @@ bool cmFileCommand::HandleInstallCommand(
}
}
- // If permissions were not specified set default permissions for
- // this target type.
- if(!use_given_permissions)
+ // If file permissions were not specified set default permissions
+ // for this target type.
+ if(!use_given_permissions_file && !use_source_permissions)
{
switch(itype)
{
@@ -693,45 +1104,54 @@ bool cmFileCommand::HandleInstallCommand(
case cmTarget::MODULE_LIBRARY:
#if defined(__linux__)
// Use read/write permissions.
- permissions = 0;
- permissions |= mode_owner_read;
- permissions |= mode_owner_write;
- permissions |= mode_group_read;
- permissions |= mode_world_read;
+ permissions_file = 0;
+ permissions_file |= mode_owner_read;
+ permissions_file |= mode_owner_write;
+ permissions_file |= mode_group_read;
+ permissions_file |= mode_world_read;
break;
#endif
case cmTarget::EXECUTABLE:
case cmTarget::INSTALL_PROGRAMS:
// Use read/write/executable permissions.
- permissions = 0;
- permissions |= mode_owner_read;
- permissions |= mode_owner_write;
- permissions |= mode_owner_execute;
- permissions |= mode_group_read;
- permissions |= mode_group_execute;
- permissions |= mode_world_read;
- permissions |= mode_world_execute;
+ permissions_file = 0;
+ permissions_file |= mode_owner_read;
+ permissions_file |= mode_owner_write;
+ permissions_file |= mode_owner_execute;
+ permissions_file |= mode_group_read;
+ permissions_file |= mode_group_execute;
+ permissions_file |= mode_world_read;
+ permissions_file |= mode_world_execute;
break;
default:
// Use read/write permissions.
- permissions = 0;
- permissions |= mode_owner_read;
- permissions |= mode_owner_write;
- permissions |= mode_group_read;
- permissions |= mode_world_read;
+ permissions_file = 0;
+ permissions_file |= mode_owner_read;
+ permissions_file |= mode_owner_write;
+ permissions_file |= mode_group_read;
+ permissions_file |= mode_world_read;
break;
}
}
- // Get the current manifest.
- const char* manifest_files =
- this->Makefile->GetDefinition("CMAKE_INSTALL_MANIFEST_FILES");
- std::string smanifest_files;
- if ( manifest_files )
+ // If directory permissions were not specified set default permissions.
+ if(!use_given_permissions_dir && !use_source_permissions)
{
- smanifest_files = manifest_files;
+ // Use read/write/executable permissions.
+ permissions_dir = 0;
+ permissions_dir |= mode_owner_read;
+ permissions_dir |= mode_owner_write;
+ permissions_dir |= mode_owner_execute;
+ permissions_dir |= mode_group_read;
+ permissions_dir |= mode_group_execute;
+ permissions_dir |= mode_world_read;
+ permissions_dir |= mode_world_execute;
}
+ // Set the installer permissions.
+ installer.FilePermissions = permissions_file;
+ installer.DirPermissions = permissions_dir;
+
// Check whether files should be copied always or only if they have
// changed.
bool copy_always =
@@ -741,13 +1161,20 @@ bool cmFileCommand::HandleInstallCommand(
for ( i = 0; i < files.size(); i ++ )
{
// Split the input file into its directory and name components.
- std::string fromDir = cmSystemTools::GetFilenamePath(files[i]);
- std::string fromName = cmSystemTools::GetFilenameName(files[i]);
+ std::vector<std::string> fromPathComponents;
+ cmSystemTools::SplitPath(files[i].c_str(), fromPathComponents);
+ std::string fromName = *(fromPathComponents.end()-1);
+ std::string fromDir = cmSystemTools::JoinPath(fromPathComponents.begin(),
+ fromPathComponents.end()-1);
// Compute the full path to the destination file.
std::string toFile = destination;
+ std::string const& toName = rename.empty()? fromName : rename;
+ if(!toName.empty())
+ {
toFile += "/";
- toFile += rename.empty()? fromName : rename;
+ toFile += toName;
+ }
// Handle type-specific installation details.
switch(itype)
@@ -796,8 +1223,7 @@ bool cmFileCommand::HandleInstallCommand(
this->SetError(errstring.c_str());
return false;
}
- smanifest_files += ";";
- smanifest_files += libname.substr(destDirLength);;
+ installer.ManifestAppend(libname);
if ( toFile != soname )
{
if ( !cmSystemTools::CreateSymlink(fromName.c_str(),
@@ -808,8 +1234,7 @@ bool cmFileCommand::HandleInstallCommand(
this->SetError(errstring.c_str());
return false;
}
- smanifest_files += ";";
- smanifest_files += soname.substr(destDirLength);
+ installer.ManifestAppend(soname);
}
}
}
@@ -844,8 +1269,7 @@ bool cmFileCommand::HandleInstallCommand(
this->SetError(errstring.c_str());
return false;
}
- smanifest_files += ";";
- smanifest_files += exename.substr(destDirLength);
+ installer.ManifestAppend(exename);
}
}
break;
@@ -854,44 +1278,32 @@ bool cmFileCommand::HandleInstallCommand(
// Construct the full path to the source file. The file name may
// have been changed above.
std::string fromFile = fromDir;
+ if(!fromName.empty())
+ {
fromFile += "/";
fromFile += fromName;
+ }
std::string message;
if(!cmSystemTools::SameFile(fromFile.c_str(), toFile.c_str()))
{
if(itype == cmTarget::INSTALL_DIRECTORY &&
- cmSystemTools::FileIsDirectory(fromFile.c_str()))
+ (fromFile.empty() ||
+ cmSystemTools::FileIsDirectory(fromFile.c_str())))
{
- // We will install this file. Display the information.
- message = "Installing ";
- message += toFile.c_str();
- this->Makefile->DisplayStatus(message.c_str(), -1);
- if(!cmSystemTools::CopyADirectory(fromFile.c_str(), toFile.c_str(),
+ // Try installing this directory.
+ if(!installer.InstallDirectory(fromFile.c_str(), toFile.c_str(),
copy_always))
{
- cmOStringStream e;
- e << "INSTALL cannot copy directory \"" << fromFile
- << "\" to \"" << toFile + "\".";
- this->SetError(e.str().c_str());
return false;
}
}
else if(cmSystemTools::FileExists(fromFile.c_str()))
{
- // We will install this file. Display the information.
- message = "Installing ";
- message += toFile.c_str();
- this->Makefile->DisplayStatus(message.c_str(), -1);
-
- // Copy the file.
- if(!cmSystemTools::CopyAFile(fromFile.c_str(), toFile.c_str(),
+ // Install this file.
+ if(!installer.InstallFile(fromFile.c_str(), toFile.c_str(),
copy_always))
{
- cmOStringStream e;
- e << "INSTALL cannot copy file \"" << fromFile
- << "\" to \"" << toFile + "\".";
- this->SetError(e.str().c_str());
return false;
}
@@ -912,20 +1324,6 @@ bool cmFileCommand::HandleInstallCommand(
}
}
#endif
-
- // Set permissions of the destination file.
- if(!cmSystemTools::SetPermissions(toFile.c_str(), permissions))
- {
- cmOStringStream e;
- e << "Problem setting permissions on file \""
- << toFile.c_str() << "\"";
- this->SetError(e.str().c_str());
- return false;
- }
-
- // Add the file to the manifest.
- smanifest_files += ";";
- smanifest_files += toFile.substr(destDirLength);
}
else if(!optional)
{
@@ -938,10 +1336,6 @@ bool cmFileCommand::HandleInstallCommand(
}
}
- // Save the updated install manifest.
- this->Makefile->AddDefinition("CMAKE_INSTALL_MANIFEST_FILES",
- smanifest_files.c_str());
-
return true;
}
@@ -951,7 +1345,7 @@ void cmFileCommand::ComputeVersionedName(std::string& name,
{
#if defined(__APPLE__)
std::string ext;
- kwsys_stl::string::size_type dot_pos = name.rfind(".");
+ cmsys_stl::string::size_type dot_pos = name.rfind(".");
if(dot_pos != name.npos)
{
ext = name.substr(dot_pos, name.npos);
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 06a2d17038..fd89115f19 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -58,10 +58,17 @@ public:
"will be set to \"NOTFOUND\". Use SET_TARGET_PROPERTIES to set "
"property values. Properties are usually used to control how "
"a target is built.\n"
+ "The read-only property \"<CONFIG>_LOCATION\" provides the full "
+ "path to the file on disk that will be created for the target when "
+ "building under configuration <CONFIG> "
+ "(in upper-case, such as \"DEBUG_LOCATION\"). "
"The read-only property \"LOCATION\" specifies "
"the full path to the file on disk that will be created for the "
- "target. This is very useful for executable targets to get "
- "the path to the executable file for use in a custom command. "
+ "target. The path may contain a build-system-specific portion that "
+ "is replaced at build time with the configuration getting built "
+ "(such as \"$(ConfigurationName)\" in VS). "
+ "This is very useful for executable targets to get "
+ "the path to the executable file for use in a custom command.\n"
"The read-only property \"TYPE\" returns which type the specified "
"target has (EXECUTABLE, STATIC_LIBRARY, SHARED_LIBRARY, "
"MODULE_LIBRARY, UTILITY, INSTALL_FILES or INSTALL_PROGRAMS). "
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 1ce506dbd9..bba00aeb60 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -43,7 +43,6 @@ void cmGlobalBorlandMakefileGenerator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
- lg->SetEchoNeedsQuote(false);
lg->SetIncludeDirective("!include");
lg->SetWindowsShell(true);
lg->SetDefineWindowsNULL(true);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 42e404f14b..00565f39ec 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -31,6 +31,9 @@ int cmGlobalGenerator::s_TryCompileTimeout = 0;
cmGlobalGenerator::cmGlobalGenerator()
{
+ // By default the .SYMBOLIC dependency is not needed on symbolic rules.
+ this->NeedSymbolicMark = false;
+
// by default use the native paths
this->ForceUnixPaths = false;
@@ -42,6 +45,9 @@ cmGlobalGenerator::cmGlobalGenerator()
// Relative paths are not configured in the constructor.
this->RelativePathsConfigured = false;
+
+ // Whether an install target is needed.
+ this->InstallTargetEnabled = false;
}
cmGlobalGenerator::~cmGlobalGenerator()
@@ -457,7 +463,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// cmake
std::string projectCompatibility = mf->GetDefinition("CMAKE_ROOT");
projectCompatibility += "/Modules/";
- projectCompatibility += mf->GetDefinition("PROJECT_NAME");
+ projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME");
projectCompatibility += "Compatibility.cmake";
if(cmSystemTools::FileExists(projectCompatibility.c_str()))
{
@@ -716,12 +722,13 @@ void cmGlobalGenerator::Generate()
}
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- cmTargets* targets =
- &(this->LocalGenerators[i]->GetMakefile()->GetTargets());
+ cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
+ cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
+ (*targets)[tit->first].SetMakefile(mf);
}
}
@@ -926,6 +933,11 @@ void cmGlobalGenerator::AddInstallComponent(const char* component)
}
}
+void cmGlobalGenerator::EnableInstallTarget()
+{
+ this->InstallTargetEnabled = true;
+}
+
cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
{
cmLocalGenerator *lg = new cmLocalGenerator;
@@ -963,6 +975,10 @@ void cmGlobalGenerator::GetDocumentation(cmDocumentationEntry& entry) const
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
cmLocalGenerator* gen)
{
+ if(gen == root)
+ {
+ return false;
+ }
cmLocalGenerator* cur = gen->GetParent();
while(cur && cur != root)
{
@@ -972,7 +988,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
}
cur = cur->GetParent();
}
- return false;
+ return gen->GetExcludeAll();
}
@@ -1291,7 +1307,6 @@ void cmGlobalGenerator::SetupTests()
// If the file doesn't exist, then ENABLE_TESTING hasn't been run
if (total_tests > 0)
{
- const char* no_output = 0;
const char* no_working_dir = 0;
std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -1304,7 +1319,7 @@ void cmGlobalGenerator::SetupTests()
cmMakefile* mf = gen[0]->GetMakefile();
if(const char* outDir = mf->GetDefinition("CMAKE_CFG_INTDIR"))
{
- mf->AddUtilityCommand("RUN_TESTS", false, no_output, no_depends,
+ mf->AddUtilityCommand("RUN_TESTS", false, no_depends,
no_working_dir,
ctest.c_str(), "-C", outDir);
}
@@ -1447,8 +1462,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
//Install
+ if(this->InstallTargetEnabled)
+ {
std::string cmd;
- cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
+ cpackCommandLines.erase(cpackCommandLines.begin(),
+ cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
depends.erase(depends.begin(), depends.end());
if ( this->GetPreinstallTargetName() )
@@ -1494,6 +1512,21 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
this->CreateGlobalTarget(
this->GetInstallTargetName(), "Install the project...",
&cpackCommandLines, depends);
+
+ // install_local
+ if(const char* install_local = this->GetInstallLocalTargetName())
+ {
+ singleLine.insert(singleLine.begin()+1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
+ cpackCommandLines.erase(cpackCommandLines.begin(),
+ cpackCommandLines.end());
+ cpackCommandLines.push_back(singleLine);
+
+ (*targets)[install_local] =
+ this->CreateGlobalTarget(
+ install_local, "Installing only the local directory...",
+ &cpackCommandLines, depends);
+ }
+ }
}
cmTarget cmGlobalGenerator::CreateGlobalTarget(
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 07ee8d82da..d95a5552ec 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -123,6 +123,7 @@ public:
void AddLocalGenerator(cmLocalGenerator *lg);
void AddInstallComponent(const char* component);
+ void EnableInstallTarget();
static int s_TryCompileTimeout;
@@ -155,6 +156,10 @@ public:
/** Get whether the generator should use a script for link commands. */
bool GetUseLinkScript() { return this->UseLinkScript; }
+ /** Get whether the generator should produce special marks on rules
+ producing symbolic (non-file) outputs. */
+ bool GetNeedSymbolicMark() { return this->NeedSymbolicMark; }
+
/*
* Determine what program to use for building the project.
*/
@@ -186,6 +191,7 @@ public:
virtual const char* GetAllTargetName() { return "ALL_BUILD"; }
virtual const char* GetInstallTargetName() { return "INSTALL"; }
+ virtual const char* GetInstallLocalTargetName() { return 0; }
virtual const char* GetPreinstallTargetName() { return 0; }
virtual const char* GetTestTargetName() { return "RUN_TESTS"; }
virtual const char* GetPackageTargetName() { return "PACKAGE"; }
@@ -208,6 +214,7 @@ protected:
const cmCustomCommandLines* commandLines,
std::vector<std::string> depends, bool depends_on_all = false);
+ bool NeedSymbolicMark;
bool UseLinkScript;
bool ForceUnixPaths;
bool ToolSupportsColor;
@@ -220,6 +227,7 @@ protected:
// Set of named installation components requested by the project.
std::set<cmStdString> InstallComponents;
+ bool InstallTargetEnabled;
// Manifest of all targets that will be built for each configuration.
// This is computed just before local generators generate.
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index ca902169ae..fc64034d27 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -23,6 +23,8 @@
#include "cmSourceFile.h"
#include "cmGeneratedFileStream.h"
+#include <cmsys/SystemTools.hxx>
+
cmGlobalKdevelopGenerator::cmGlobalKdevelopGenerator()
{
// This type of makefile always requires unix style paths
@@ -160,12 +162,33 @@ bool cmGlobalKdevelopGenerator
si!=sources.end(); si++)
{
tmp=(*si)->GetFullPath();
+ std::string headerBasename=cmSystemTools::GetFilenamePath(tmp);
+ headerBasename+="/";
+ headerBasename+=cmSystemTools::GetFilenameWithoutExtension(tmp);
+
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
+
if ((tmp[0]!='/') &&
(strstr(tmp.c_str(),
- cmake::GetCMakeFilesDirectoryPostSlash())==0))
+ cmake::GetCMakeFilesDirectoryPostSlash())==0) &&
+ (cmSystemTools::GetFilenameExtension(tmp)!=".moc"))
{
files.insert(tmp);
+
+ // check if there's a matching header around
+ for(std::vector<std::string>::const_iterator
+ ext = makefile->GetHeaderExtensions().begin();
+ ext != makefile->GetHeaderExtensions().end(); ++ext)
+ {
+ std::string hname=headerBasename;
+ hname += ".";
+ hname += *ext;
+ if(cmSystemTools::FileExists(hname.c_str()))
+ {
+ files.insert(hname);
+ break;
+ }
+ }
}
}
for (std::vector<std::string>::const_iterator lt=listFiles.begin();
@@ -382,7 +405,7 @@ void cmGlobalKdevelopGenerator
fout<<" <run>\n";
fout<<" <mainprogram>"<<executable.c_str()<<"</mainprogram>\n";
fout<<" <directoryradio>custom</directoryradio>\n";
- fout<<" <customdirectory>/</customdirectory>\n";
+ fout<<" <customdirectory>"<<outputDir.c_str()<<"</customdirectory>\n";
fout<<" <programargs></programargs>\n";
fout<<" <terminal>false</terminal>\n";
fout<<" <autocompile>true</autocompile>\n";
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 53ea6492c2..058dedbcc4 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -72,6 +72,7 @@ void cmGlobalMSYSMakefileGenerator
{
gxx = tgxx;
}
+ mf->AddDefinition("MSYS", "1");
mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
@@ -88,6 +89,7 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetWindowsShell(false);
+ lg->SetMSYSShell(true);
lg->SetGlobalGenerator(this);
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index f66134c595..c024f6facb 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -61,6 +61,22 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
+
+ // mingw32-make has trouble running code like
+ //
+ // @echo message with spaces
+ //
+ // If quotes are added
+ //
+ // @echo "message with spaces"
+ //
+ // it runs but the quotes are displayed. Instead we can separate
+ // with a semicolon
+ //
+ // @echo;message with spaces
+ //
+ // to hack around the problem.
+ lg->SetNativeEchoCommand("@echo;");
return lg;
}
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 35a2a86bf1..e86c7c642d 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -39,7 +39,6 @@ void cmGlobalNMakeMakefileGenerator
cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
- lg->SetEchoNeedsQuote(false);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 444fc92edd..642773ad04 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -215,8 +215,6 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
"The main recursive preinstall target", "preinstall",
depends, no_commands, true);
- lg->WriteMakeVariables(makefileStream);
-
// Write out the "special" stuff
lg->WriteSpecialTargetsTop(makefileStream);
@@ -466,9 +464,6 @@ cmGlobalUnixMakefileGenerator3
std::string makeTarget = lg->GetMakefile()->GetStartOutputDirectory();
makeTarget += "/";
makeTarget += pass;
- makeTarget = lg->Convert(makeTarget.c_str(),
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKEFILE);
// The directory-level rule should depend on the target-level rules
// for all targets in the directory.
@@ -504,9 +499,6 @@ cmGlobalUnixMakefileGenerator3
std::string subdir = slg->GetMakefile()->GetStartOutputDirectory();
subdir += "/";
subdir += pass;
- subdir = slg->Convert(subdir.c_str(),
- cmLocalGenerator::HOME_OUTPUT,
- cmLocalGenerator::MAKEFILE);
depends.push_back(subdir);
}
@@ -823,8 +815,10 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
//
+ std::set<cmStdString> emitted;
progCmd << " "
- << this->GetTargetTotalNumberOfActions(t->second);
+ << this->GetTargetTotalNumberOfActions(t->second,
+ emitted);
commands.push_back(progCmd.str());
}
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -895,18 +889,26 @@ cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
int cmGlobalUnixMakefileGenerator3
-::GetTargetTotalNumberOfActions(cmTarget& target)
+::GetTargetTotalNumberOfActions(cmTarget& target,
+ std::set<cmStdString> &emitted)
{
+ // do not double count
+ int result = 0;
+
+ if(emitted.insert(target.GetName()).second)
+ {
cmLocalUnixMakefileGenerator3 *lg =
static_cast<cmLocalUnixMakefileGenerator3 *>
(target.GetMakefile()->GetLocalGenerator());
- int result = static_cast<int>(lg->ProgressFiles[target.GetName()].size());
+ result = static_cast<int>(lg->ProgressFiles[target.GetName()].size());
+
std::vector<cmTarget *>& depends = this->GetTargetDepends(target);
std::vector<cmTarget *>::iterator i;
for (i = depends.begin(); i != depends.end(); ++i)
{
- result += this->GetTargetTotalNumberOfActions(**i);
+ result += this->GetTargetTotalNumberOfActions(**i, emitted);
+ }
}
return result;
@@ -1231,13 +1233,12 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
}
}
}
- std::map<cmStdString,std::vector<cmTarget *> > const& objs =
- lg->GetLocalObjectFiles();
- for(std::map<cmStdString,std::vector<cmTarget *> >::const_iterator o =
- objs.begin(); o != objs.end(); ++o)
+ std::vector<cmStdString> const& localHelp = lg->GetLocalHelp();
+ for(std::vector<cmStdString>::const_iterator o = localHelp.begin();
+ o != localHelp.end(); ++o)
{
path = "... ";
- path += o->first;
+ path += *o;
lg->AppendEcho(commands, path.c_str());
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index a006808960..f07451073e 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -124,7 +124,8 @@ public:
const char* config, bool ignoreErrors, bool fast);
// returns some progress informaiton
- int GetTargetTotalNumberOfActions(cmTarget& target);
+ int GetTargetTotalNumberOfActions(cmTarget& target,
+ std::set<cmStdString> &emitted);
unsigned long GetNumberOfProgressActionsInAll
(cmLocalUnixMakefileGenerator3 *lg);
@@ -159,6 +160,7 @@ protected:
// Setup target names
virtual const char* GetAllTargetName() { return "all"; }
virtual const char* GetInstallTargetName() { return "install"; }
+ virtual const char* GetInstallLocalTargetName() { return "install/local"; }
virtual const char* GetPreinstallTargetName() { return "preinstall"; }
virtual const char* GetTestTargetName() { return "test"; }
virtual const char* GetPackageTargetName() { return "package"; }
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index d2644d0622..1adb8aa4bc 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -162,7 +162,6 @@ void cmGlobalVisualStudio6Generator::Generate()
{
// add a special target that depends on ALL projects for easy build
// of one configuration only.
- const char* no_output = 0;
std::vector<std::string> no_depends;
const char* no_working_dir = 0;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -173,7 +172,7 @@ void cmGlobalVisualStudio6Generator::Generate()
if(gen.size())
{
gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", false,
- no_output, no_depends,
+ no_depends,
no_working_dir,
"echo", "Build all projects");
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 62df78c078..1c2ffe453d 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -254,13 +254,13 @@ void cmGlobalVisualStudio71Generator
const cmCustomCommandLines& cmds = cc.GetCommandLines();
std::string project = cmds[0][0];
this->WriteProjectConfigurations(fout, project.c_str(),
- l->second.IsInAll());
+ l->second.GetType());
}
else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
this->WriteProjectConfigurations(fout, si->c_str(),
- l->second.IsInAll());
+ l->second.GetType());
++si;
}
}
@@ -294,10 +294,10 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const char* dir,
cmTarget& t)
{
- std::string d = cmSystemTools::ConvertToOutputPath(dir);
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< dspname << "\", \""
- << d << "\\" << dspname << ".vcproj\", \"{"
+ << this->ConvertToSolutionPath(dir)
+ << "\\" << dspname << ".vcproj\", \"{"
<< this->GetGUID(dspname) << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t);
@@ -379,10 +379,9 @@ void cmGlobalVisualStudio71Generator
const char* location,
const std::vector<std::string>& depends)
{
- std::string d = cmSystemTools::ConvertToOutputPath(location);
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< name << "\", \""
- << d << "\", \"{"
+ << this->ConvertToSolutionPath(location) << "\", \"{"
<< this->GetGUID(name)
<< "}\"\n";
@@ -415,9 +414,8 @@ void cmGlobalVisualStudio71Generator
// Write a dsp file into the SLN file, Note, that dependencies from
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
-::WriteProjectConfigurations(std::ostream& fout,
- const char* name,
- bool in_all_build)
+::WriteProjectConfigurations(std::ostream& fout, const char* name,
+ int targetType)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -425,7 +423,7 @@ void cmGlobalVisualStudio71Generator
{
fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|Win32\n";
- if (in_all_build)
+ if(targetType != cmTarget::GLOBAL_TARGET)
{
fout << "\t\t{" << guid << "}." << *i
<< ".Build.0 = " << *i << "|Win32\n";
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 6ccf06a3c6..d90c64bac0 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -55,7 +55,7 @@ protected:
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- bool in_all);
+ int targetType);
virtual void WriteExternalProject(std::ostream& fout, const char* name,
const char* path,
const std::vector<std::string>& depends);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 7bc0654c57..d869d001f5 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -216,7 +216,6 @@ void cmGlobalVisualStudio7Generator::Generate()
{
// add a special target that depends on ALL projects for easy build
// of one configuration only.
- const char* no_output = 0;
const char* no_working_dir = 0;
std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -227,7 +226,7 @@ void cmGlobalVisualStudio7Generator::Generate()
if(gen.size())
{
gen[0]->GetMakefile()->
- AddUtilityCommand("ALL_BUILD", false, no_output, no_depends,
+ AddUtilityCommand("ALL_BUILD", false, no_depends,
no_working_dir,
"echo", "Build all projects");
std::string cmake_command =
@@ -538,13 +537,13 @@ void cmGlobalVisualStudio7Generator
const cmCustomCommandLines& cmds = cc.GetCommandLines();
std::string name = cmds[0][0];
this->WriteProjectConfigurations(fout, name.c_str(),
- l->second.IsInAll());
+ l->second.GetType());
}
else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
this->WriteProjectConfigurations(fout, si->c_str(),
- l->second.IsInAll());
+ l->second.GetType());
++si;
}
}
@@ -555,6 +554,21 @@ void cmGlobalVisualStudio7Generator
this->WriteSLNFooter(fout);
}
+//----------------------------------------------------------------------------
+std::string
+cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
+{
+ // Convert to backslashes. Do not use ConvertToOutputPath because
+ // we will add quoting ourselves, and we know these projects always
+ // use windows slashes.
+ std::string d = path;
+ std::string::size_type pos = 0;
+ while((pos = d.find('/', pos)) != d.npos)
+ {
+ d[pos++] = '\\';
+ }
+ return d;
+}
// Write a dsp file into the SLN file,
// Note, that dependencies from executables to
@@ -563,10 +577,10 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
const char* dspname,
const char* dir, cmTarget&)
{
- std::string d = cmSystemTools::ConvertToOutputPath(dir);
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< dspname << "\", \""
- << d << "\\" << dspname << ".vcproj\", \"{"
+ << this->ConvertToSolutionPath(dir)
+ << "\\" << dspname << ".vcproj\", \"{"
<< this->GetGUID(dspname) << "}\"\nEndProject\n";
}
@@ -652,9 +666,8 @@ cmGlobalVisualStudio7Generator
// Write a dsp file into the SLN file, Note, that dependencies from
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
-::WriteProjectConfigurations(std::ostream& fout,
- const char* name,
- bool in_all_build)
+::WriteProjectConfigurations(std::ostream& fout, const char* name,
+ int targetType)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -662,7 +675,7 @@ void cmGlobalVisualStudio7Generator
{
fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|Win32\n";
- if (in_all_build)
+ if(targetType != cmTarget::GLOBAL_TARGET)
{
fout << "\t\t{" << guid << "}." << *i
<< ".Build.0 = " << *i << "|Win32\n";
@@ -683,7 +696,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
std::string d = cmSystemTools::ConvertToOutputPath(location);
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
<< name << "\", \""
- << d << "\", \"{"
+ << this->ConvertToSolutionPath(location) << "\", \"{"
<< this->GetGUID(name)
<< "}\"\n";
fout << "EndProject\n";
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 9ff97da953..028691db51 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -107,7 +107,7 @@ protected:
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- bool in_all);
+ int targetType);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
virtual void AddPlatformDefinitions(cmMakefile* mf);
@@ -118,6 +118,7 @@ protected:
const char* name, const char* path,
const std::vector<std::string>& dependencies);
+ std::string ConvertToSolutionPath(const char* path);
std::vector<std::string> Configurations;
std::map<cmStdString, cmStdString> GUIDMap;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 33f4553915..176c036a89 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -75,7 +75,6 @@ void cmGlobalVisualStudio8Generator::Generate()
{
// Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake.
- const char* no_output = 0;
const char* no_working_directory = 0;
std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -90,10 +89,10 @@ void cmGlobalVisualStudio8Generator::Generate()
static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
cmMakefile* mf = lg->GetMakefile();
std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
+ cmCustomCommandLines noCommandLines;
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true,
- no_output, no_depends,
- no_working_directory,
- "echo", "Checking build system");
+ no_working_directory, no_depends,
+ noCommandLines);
cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
if(!tgt)
{
@@ -130,12 +129,12 @@ void cmGlobalVisualStudio8Generator::Generate()
std::string argH = "-H";
argH += lg->Convert(mf->GetHomeDirectory(),
cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL, true);
+ cmLocalGenerator::UNCHANGED, true);
commandLine.push_back(argH);
std::string argB = "-B";
argB += lg->Convert(mf->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL, true);
+ cmLocalGenerator::UNCHANGED, true);
commandLine.push_back(argB);
cmCustomCommandLines commandLines;
commandLines.push_back(commandLine);
@@ -228,8 +227,8 @@ cmGlobalVisualStudio8Generator
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio8Generator
-::WriteProjectConfigurations(std::ostream& fout,
- const char* name, bool in_all_build)
+::WriteProjectConfigurations(std::ostream& fout, const char* name,
+ int targetType)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -238,7 +237,7 @@ cmGlobalVisualStudio8Generator
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->PlatformName << ".ActiveCfg = "
<< *i << "|" << this->PlatformName << "\n";
- if (in_all_build)
+ if(targetType != cmTarget::GLOBAL_TARGET)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->PlatformName << ".Build.0 = "
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index b7cf038223..fdc8316104 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -56,7 +56,8 @@ protected:
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(std::ostream& fout,
- const char* name, bool in_all);
+ const char* name,
+ int targetType);
std::string PlatformName; // Win32 or x64
};
#endif
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 8fd4b3073f..29a60d4afa 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -23,6 +23,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
this->FindMakeProgramFile = "CMakeFindWMake.cmake";
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
+ this->NeedSymbolicMark = true;
this->EmptyCommandsHack = "@cd .";
}
@@ -47,7 +48,6 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetSilentNoColon(true);
- lg->SetEchoNeedsQuote(false);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("-s -h");
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index c1486f3597..6a2ec4fa61 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -196,7 +196,6 @@ std::string cmGlobalXCodeGenerator
makeCommand += " ";
makeCommand += additionalOptions;
}
- makeCommand += " OBJROOT=.";
return makeCommand;
}
@@ -282,10 +281,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
{
cmMakefile* mf = root->GetMakefile();
// Add ALL_BUILD
- const char* no_output = 0;
const char* no_working_directory = 0;
std::vector<std::string> no_depends;
- mf->AddUtilityCommand("ALL_BUILD", false, no_output, no_depends,
+ mf->AddUtilityCommand("ALL_BUILD", false, no_depends,
no_working_directory,
"echo", "Build all projects");
cmTarget* allbuild = mf->FindTarget("ALL_BUILD");
@@ -308,7 +306,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
}
cmCustomCommandLines commandLines;
commandLines.push_back(makecommand);
- mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false, no_output,
+ mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false,
no_working_directory,
no_depends,
commandLines);
@@ -956,16 +954,20 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
}
}
makefileStream << "\n\n";
-
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
cmCustomCommand const& cc = *i;
if(!cc.GetCommandLines().empty())
{
-
- makefileStream << "\n#" << "Custom command rule: " <<
- cc.GetComment() << "\n";
+ bool escapeOldStyle = cc.GetEscapeOldStyle();
+ bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars();
+ makefileStream << "\n#" << "Custom command rule: ";
+ if(cc.GetComment())
+ {
+ makefileStream << cc.GetComment();
+ }
+ makefileStream << "\n";
const std::vector<std::string>& outputs = cc.GetOutputs();
if(!outputs.empty())
{
@@ -1038,7 +1040,17 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
for(unsigned int j=1; j < commandLine.size(); ++j)
{
cmd += " ";
- cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
+ if(escapeOldStyle)
+ {
+ cmd += (this->CurrentLocalGenerator
+ ->EscapeForShellOldStyle(commandLine[j].c_str()));
+ }
+ else
+ {
+ cmd += (this->CurrentLocalGenerator->
+ EscapeForShell(commandLine[j].c_str(),
+ escapeAllowMakeVars));
+ }
}
makefileStream << "\t" << cmd.c_str() << "\n";
}
@@ -1420,18 +1432,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string install_name_dir;
if(target.GetType() == cmTarget::SHARED_LIBRARY)
{
- // Select whether to generate an install_name directory for the
- // install tree or the build tree.
- if(target.GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
- {
- install_name_dir =
- target.GetInstallNameDirForInstallTree(configName);
- }
- else
- {
- install_name_dir =
- target.GetInstallNameDirForBuildTree(configName);
- }
+ // Get the install_name directory for the build tree.
+ install_name_dir = target.GetInstallNameDirForBuildTree(configName);
if(install_name_dir.empty())
{
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 5ee5d90c8b..0478392388 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -30,13 +30,56 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
// watch for our ELSE or ENDIF
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else") ||
+ !cmSystemTools::Strucmp(lff.Name.c_str(),"elseif") ||
!cmSystemTools::Strucmp(lff.Name.c_str(),"endif"))
{
// if it was an else statement then we should change state
// and block this Else Command
if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else"))
{
- this->IsBlocking = !this->IsBlocking;
+ this->IsBlocking = this->HasRun;
+ return true;
+ }
+ // if it was an elseif statement then we should check state
+ // and possibly block this Else Command
+ if (!cmSystemTools::Strucmp(lff.Name.c_str(),"elseif"))
+ {
+ if (!this->HasRun)
+ {
+ char* errorString = 0;
+
+ std::vector<std::string> expandedArguments;
+ mf.ExpandArguments(lff.Arguments, expandedArguments);
+ bool isTrue =
+ cmIfCommand::IsTrue(expandedArguments,&errorString,&mf);
+
+ if (errorString)
+ {
+ std::string err = "had incorrect arguments: ";
+ unsigned int i;
+ for(i =0; i < lff.Arguments.size(); ++i)
+ {
+ err += (lff.Arguments[i].Quoted?"\"":"");
+ err += lff.Arguments[i].Value;
+ err += (lff.Arguments[i].Quoted?"\"":"");
+ err += " ";
+ }
+ err += "(";
+ err += errorString;
+ err += ").";
+ cmSystemTools::Error(err.c_str());
+ delete [] errorString;
+ return false;
+ }
+
+ if (isTrue)
+ {
+ this->IsBlocking = false;
+ this->HasRun = true;
+ return true;
+ }
+ }
+ this->IsBlocking = true;
return true;
}
// otherwise it must be an ENDIF statement, in that case remove the
@@ -113,6 +156,10 @@ bool cmIfCommand
cmIfFunctionBlocker *f = new cmIfFunctionBlocker();
// if is isn't true block the commands
f->IsBlocking = !isTrue;
+ if (isTrue)
+ {
+ f->HasRun = true;
+ }
f->Args = args;
this->Makefile->AddFunctionBlocker(f);
@@ -226,7 +273,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
IncrementArguments(newArgs,argP1,argP2);
reducible = 1;
}
- // does a file exist
+ // does a directory with this name exist
if (*arg == "IS_DIRECTORY" && argP1 != newArgs.end())
{
if(cmSystemTools::FileIsDirectory((argP1)->c_str()))
@@ -242,6 +289,29 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
IncrementArguments(newArgs,argP1,argP2);
reducible = 1;
}
+ // is file A newer than file B
+ if (*arg == "FILE_IS_NEWER" &&
+ argP1 != newArgs.end() && argP2 != newArgs.end())
+ {
+ int fileIsNewer=0;
+ bool success=cmSystemTools::FileTimeCompare((argP1)->c_str(),
+ (argP2)->c_str(),
+ &fileIsNewer);
+ if(success==false || fileIsNewer==1 || fileIsNewer==0)
+ {
+ *arg = "1";
+ }
+ else
+ {
+ *arg = "0";
+ }
+
+ newArgs.erase(argP2);
+ newArgs.erase(argP1);
+ argP1 = arg;
+ IncrementArguments(newArgs,argP1,argP2);
+ reducible = 1;
+ }
// does a command exist
if (*arg == "COMMAND" && argP1 != newArgs.end())
{
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index e49c21fbc6..1d07248523 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -28,7 +28,7 @@
class cmIfFunctionBlocker : public cmFunctionBlocker
{
public:
- cmIfFunctionBlocker() {}
+ cmIfFunctionBlocker() {this->HasRun = false;}
virtual ~cmIfFunctionBlocker() {}
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefile &mf);
@@ -38,6 +38,7 @@ public:
std::vector<cmListFileArgument> Args;
bool IsBlocking;
+ bool HasRun;
};
/** \class cmIfCommand
@@ -128,6 +129,10 @@ public:
" IF(EXISTS directory-name)\n"
"True if the named file or directory exists. "
"Behavior is well-defined only for full paths.\n"
+ " IF(FILE_IS_NEWER file1 file2)\n"
+ "True if file1 is newer than file2 or if one of the two files "
+ "doesn't exist. "
+ "Behavior is well-defined only for full paths.\n"
" IF(IS_DIRECTORY directory-name)\n"
"True if the given name is a directory. "
"Behavior is well-defined only for full paths.\n"
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index b493eb3127..86618b50b0 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -28,6 +28,7 @@ bool cmIncludeDirectoryCommand
std::vector<std::string>::const_iterator i = args.begin();
bool before = this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_BEFORE");
+ bool system = false;
if ((*i) == "BEFORE")
{
@@ -42,12 +43,19 @@ bool cmIncludeDirectoryCommand
for(; i != args.end(); ++i)
{
+ if(*i == "SYSTEM")
+ {
+ system = true;
+ continue;
+ }
if(i->size() == 0)
{
cmSystemTools::Error
("Empty Include Directory Passed into INCLUDE_DIRECTORIES command.");
}
std::string unixPath = *i;
+ if (!cmSystemTools::IsOff(unixPath.c_str()))
+ {
cmSystemTools::ConvertToUnixSlashes(unixPath);
if(!cmSystemTools::FileIsFullPath(unixPath.c_str()))
{
@@ -56,7 +64,12 @@ bool cmIncludeDirectoryCommand
tmp += unixPath;
unixPath = tmp;
}
+ }
this->Makefile->AddIncludeDirectory(unixPath.c_str(), before);
+ if(system)
+ {
+ this->Makefile->AddSystemIncludeDirectory(unixPath.c_str());
+ }
}
return true;
}
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index a22bc0e13b..9247bbbaa4 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -61,13 +61,16 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " INCLUDE_DIRECTORIES([AFTER|BEFORE] dir1 dir2 ...)\n"
+ " INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n"
"Add the given directories to those searched by the compiler for "
"include files. By default the directories are appended onto "
"the current list of directories. This default behavior can be "
"changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
"By using BEFORE or AFTER you can select between appending and "
- "prepending, independent from the default. ";
+ "prepending, independent from the default. "
+ "If the SYSTEM option is given the compiler will be told that the "
+ "directories are meant as system include directories on some "
+ "platforms.";
}
cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index 2944ebd47e..24d25e0eb2 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -41,18 +41,33 @@ bool cmIncludeExternalMSProjectCommand
}
}
+ // Hack together a utility target storing enough information
+ // to reproduce the target inclusion.
std::string utility_name("INCLUDE_EXTERNAL_MSPROJECT");
utility_name += "_";
utility_name += args[0];
std::string path = args[1];
cmSystemTools::ConvertToUnixSlashes(path);
- const char* no_output = 0;
- const char* no_working_directory = 0;
- this->Makefile->AddUtilityCommand(utility_name.c_str(), true,
- no_output, depends,
- no_working_directory,
- args[0].c_str(), path.c_str());
+ // Create a target instance for this utility.
+ cmTarget target;
+ target.SetType(cmTarget::UTILITY, utility_name.c_str());
+ target.SetInAll(true);
+ target.SetMakefile(this->Makefile);
+ std::vector<std::string> no_outputs;
+ cmCustomCommandLines commandLines;
+ cmCustomCommandLine commandLine;
+ commandLine.push_back(args[0]);
+ commandLine.push_back(path);
+ commandLines.push_back(commandLine);
+ cmCustomCommand cc(no_outputs, depends, commandLines, 0, 0);
+ target.GetPostBuildCommands().push_back(cc);
+
+ // Add the target to the set of targets.
+ cmTargets::iterator it =
+ this->Makefile->GetTargets()
+ .insert(cmTargets::value_type(utility_name.c_str(),target)).first;
+ this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->AddTarget(*it);
}
#endif
return true;
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 057f3e0d50..07c28d0f3d 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -16,10 +16,13 @@
=========================================================================*/
#include "cmInstallCommand.h"
+#include "cmInstallDirectoryGenerator.h"
#include "cmInstallFilesGenerator.h"
#include "cmInstallScriptGenerator.h"
#include "cmInstallTargetGenerator.h"
+#include <cmsys/Glob.hxx>
+
// cmInstallCommand
bool cmInstallCommand::InitialPass(std::vector<std::string> const& args)
{
@@ -30,6 +33,10 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args)
return true;
}
+ // Enable the install target.
+ this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->EnableInstallTarget();
+
// Switch among the command modes.
if(args[0] == "SCRIPT")
{
@@ -51,6 +58,10 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args)
{
return this->HandleFilesMode(args);
}
+ else if(args[0] == "DIRECTORY")
+ {
+ return this->HandleDirectoryMode(args);
+ }
// Unknown mode.
cmStdString e = "called with unknown mode ";
@@ -140,6 +151,9 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
std::vector<std::string> archive_configurations;
std::vector<std::string> library_configurations;
std::vector<std::string> runtime_configurations;
+ bool archive_optional = false;
+ bool library_optional = false;
+ bool runtime_optional = false;
for(unsigned int i=1; i < args.size(); ++i)
{
if(args[i] == "DESTINATION")
@@ -214,6 +228,27 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
library_settings = false;
runtime_settings = true;
}
+ else if(args[i] == "OPTIONAL")
+ {
+ // Set the optional property.
+ doing_targets = false;
+ doing_destination = false;
+ doing_permissions = false;
+ doing_component = false;
+ doing_configurations = false;
+ if(archive_settings)
+ {
+ archive_optional = true;
+ }
+ if(library_settings)
+ {
+ library_optional = true;
+ }
+ if(runtime_settings)
+ {
+ runtime_optional = true;
+ }
+ }
else if(doing_targets)
{
// Lookup this target in the current directory.
@@ -356,6 +391,11 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return false;
}
+ // Check whether this is a DLL platform.
+ bool dll_platform = (this->Makefile->IsOn("WIN32") ||
+ this->Makefile->IsOn("CYGWIN") ||
+ this->Makefile->IsOn("MINGW"));
+
// Compute destination paths.
std::string archive_dest;
std::string library_dest;
@@ -378,7 +418,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// platforms. All windows platforms are DLL platforms
// including cygwin. Currently no other platform is a DLL
// platform.
-#if defined(_WIN32) || defined(__CYGWIN__)
+ if(dll_platform)
+ {
// This is a DLL platform.
if(archive_destination)
{
@@ -387,27 +428,34 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
new cmInstallTargetGenerator(target, archive_dest.c_str(), true,
archive_permissions.c_str(),
archive_configurations,
- archive_component.c_str()));
+ archive_component.c_str(),
+ archive_optional));
}
if(runtime_destination)
{
// The DLL uses the RUNTIME properties.
this->Makefile->AddInstallGenerator(
- new cmInstallTargetGenerator(target, runtime_dest.c_str(), false,
+ new cmInstallTargetGenerator(target, runtime_dest.c_str(),
+ false,
runtime_permissions.c_str(),
runtime_configurations,
- runtime_component.c_str()));
+ runtime_component.c_str(),
+ runtime_optional));
}
-#else
+ }
+ else
+ {
// This is a non-DLL platform.
if(library_destination)
{
// The shared library uses the LIBRARY properties.
this->Makefile->AddInstallGenerator(
- new cmInstallTargetGenerator(target, library_dest.c_str(), false,
+ new cmInstallTargetGenerator(target, library_dest.c_str(),
+ false,
library_permissions.c_str(),
library_configurations,
- library_component.c_str()));
+ library_component.c_str(),
+ library_optional));
}
else
{
@@ -417,7 +465,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
this->SetError(e.str().c_str());
return false;
}
-#endif
+ }
}
break;
case cmTarget::STATIC_LIBRARY:
@@ -429,7 +477,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
new cmInstallTargetGenerator(target, archive_dest.c_str(), false,
archive_permissions.c_str(),
archive_configurations,
- archive_component.c_str()));
+ archive_component.c_str(),
+ archive_optional));
}
else
{
@@ -450,7 +499,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
new cmInstallTargetGenerator(target, library_dest.c_str(), false,
library_permissions.c_str(),
library_configurations,
- library_component.c_str()));
+ library_component.c_str(),
+ library_optional));
}
else
{
@@ -471,7 +521,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
new cmInstallTargetGenerator(target, runtime_dest.c_str(), false,
runtime_permissions.c_str(),
runtime_configurations,
- runtime_component.c_str()));
+ runtime_component.c_str(),
+ runtime_optional));
}
else
{
@@ -519,6 +570,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
std::string permissions;
std::vector<std::string> configurations;
std::string component;
+ bool optional = false;
for(unsigned int i=1; i < args.size(); ++i)
{
if(args[i] == "DESTINATION")
@@ -571,6 +623,17 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
doing_component = false;
doing_rename = true;
}
+ else if(args[i] == "OPTIONAL")
+ {
+ // Set the optional property.
+ doing_files = false;
+ doing_destination = false;
+ doing_permissions = false;
+ doing_configurations = false;
+ doing_component = false;
+ doing_rename = false;
+ optional = true;
+ }
else if(doing_files)
{
// Convert this file to a full path.
@@ -665,7 +728,367 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(files, dest.c_str(), programs,
permissions.c_str(), configurations,
- component.c_str(), rename.c_str()));
+ component.c_str(), rename.c_str(),
+ optional));
+
+ // Tell the global generator about any installation component names
+ // specified.
+ this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
+ ->AddInstallComponent(component.c_str());
+
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool
+cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
+{
+ bool doing_dirs = true;
+ bool doing_destination = false;
+ bool doing_pattern = false;
+ bool doing_regex = false;
+ bool doing_permissions_file = false;
+ bool doing_permissions_dir = false;
+ bool doing_permissions_match = false;
+ bool doing_configurations = false;
+ bool doing_component = false;
+ bool in_match_mode = false;
+ std::vector<std::string> dirs;
+ const char* destination = 0;
+ std::string permissions_file;
+ std::string permissions_dir;
+ std::vector<std::string> configurations;
+ std::string component;
+ std::string literal_args;
+ for(unsigned int i=1; i < args.size(); ++i)
+ {
+ if(args[i] == "DESTINATION")
+ {
+ if(in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Switch to setting the destination property.
+ doing_dirs = false;
+ doing_destination = true;
+ doing_pattern = false;
+ doing_regex = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_configurations = false;
+ doing_component = false;
+ }
+ else if(args[i] == "PATTERN")
+ {
+ // Switch to a new pattern match rule.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = true;
+ doing_regex = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_permissions_match = false;
+ doing_configurations = false;
+ doing_component = false;
+ in_match_mode = true;
+ }
+ else if(args[i] == "REGEX")
+ {
+ // Switch to a new regex match rule.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = false;
+ doing_regex = true;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_permissions_match = false;
+ doing_configurations = false;
+ doing_component = false;
+ in_match_mode = true;
+ }
+ else if(args[i] == "EXCLUDE")
+ {
+ // Add this property to the current match rule.
+ if(!in_match_mode || doing_pattern || doing_regex)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" before a PATTERN or REGEX is given.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ literal_args += " EXCLUDE";
+ doing_permissions_match = false;
+ }
+ else if(args[i] == "PERMISSIONS")
+ {
+ if(!in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" before a PATTERN or REGEX is given.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Switch to setting the current match permissions property.
+ literal_args += " PERMISSIONS";
+ doing_permissions_match = true;
+ }
+ else if(args[i] == "FILE_PERMISSIONS")
+ {
+ if(in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Switch to setting the file permissions property.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = false;
+ doing_regex = false;
+ doing_permissions_file = true;
+ doing_permissions_dir = false;
+ doing_configurations = false;
+ doing_component = false;
+ }
+ else if(args[i] == "DIRECTORY_PERMISSIONS")
+ {
+ if(in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Switch to setting the directory permissions property.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = false;
+ doing_regex = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = true;
+ doing_configurations = false;
+ doing_component = false;
+ }
+ else if(args[i] == "USE_SOURCE_PERMISSIONS")
+ {
+ if(in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Add this option literally.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = false;
+ doing_regex = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_configurations = false;
+ doing_component = false;
+ literal_args += " USE_SOURCE_PERMISSIONS";
+ }
+ else if(args[i] == "CONFIGURATIONS")
+ {
+ if(in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Switch to setting the configurations property.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = false;
+ doing_regex = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_configurations = true;
+ doing_component = false;
+ }
+ else if(args[i] == "COMPONENT")
+ {
+ if(in_match_mode)
+ {
+ cmOStringStream e;
+ e << args[0] << " does not allow \""
+ << args[i] << "\" after PATTERN or REGEX.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Switch to setting the component property.
+ doing_dirs = false;
+ doing_destination = false;
+ doing_pattern = false;
+ doing_regex = false;
+ doing_permissions_file = false;
+ doing_permissions_dir = false;
+ doing_configurations = false;
+ doing_component = true;
+ }
+ else if(doing_dirs)
+ {
+ // Convert this directory to a full path.
+ std::string dir = args[i];
+ if(!cmSystemTools::FileIsFullPath(dir.c_str()))
+ {
+ dir = this->Makefile->GetCurrentDirectory();
+ dir += "/";
+ dir += args[i];
+ }
+
+ // Make sure the name is a directory.
+ if(!cmSystemTools::FileIsDirectory(dir.c_str()))
+ {
+ cmOStringStream e;
+ e << args[0] << " given non-directory \""
+ << args[i] << "\" to install.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Store the directory for installation.
+ dirs.push_back(dir);
+ }
+ else if(doing_configurations)
+ {
+ configurations.push_back(args[i]);
+ }
+ else if(doing_destination)
+ {
+ destination = args[i].c_str();
+ doing_destination = false;
+ }
+ else if(doing_pattern)
+ {
+ // Convert the pattern to a regular expression. Require a
+ // leading slash and trailing end-of-string in the matched
+ // string to make sure the pattern matches only whole file
+ // names.
+ literal_args += " REGEX \"/";
+ std::string regex = cmsys::Glob::PatternToRegex(args[i], false);
+ cmSystemTools::ReplaceString(regex, "\\", "\\\\");
+ literal_args += regex;
+ literal_args += "$\"";
+ doing_pattern = false;
+ }
+ else if(doing_regex)
+ {
+ literal_args += " REGEX \"";
+ // Match rules are case-insensitive on some platforms.
+#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+ std::string regex = cmSystemTools::LowerCase(args[i]);
+#else
+ std::string regex = args[i];
+#endif
+ cmSystemTools::ReplaceString(regex, "\\", "\\\\");
+ literal_args += regex;
+ literal_args += "\"";
+ doing_regex = false;
+ }
+ else if(doing_component)
+ {
+ component = args[i];
+ doing_component = false;
+ }
+ else if(doing_permissions_file)
+ {
+ // Check the requested permission.
+ if(!this->CheckPermissions(args[i], permissions_file))
+ {
+ cmOStringStream e;
+ e << args[0] << " given invalid file permission \""
+ << args[i] << "\".";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ else if(doing_permissions_dir)
+ {
+ // Check the requested permission.
+ if(!this->CheckPermissions(args[i], permissions_dir))
+ {
+ cmOStringStream e;
+ e << args[0] << " given invalid directory permission \""
+ << args[i] << "\".";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ else if(doing_permissions_match)
+ {
+ // Check the requested permission.
+ if(!this->CheckPermissions(args[i], literal_args))
+ {
+ cmOStringStream e;
+ e << args[0] << " given invalid permission \""
+ << args[i] << "\".";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ else
+ {
+ // Unknown argument.
+ cmOStringStream e;
+ e << args[0] << " given unknown argument \"" << args[i] << "\".";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+
+ // Support installing an empty directory.
+ if(dirs.empty() && destination)
+ {
+ dirs.push_back("");
+ }
+
+ // Check if there is something to do.
+ if(dirs.empty())
+ {
+ return true;
+ }
+ if(!destination)
+ {
+ // A destination is required.
+ cmOStringStream e;
+ e << args[0] << " given no DESTINATION!";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ // Compute destination path.
+ std::string dest;
+ this->ComputeDestination(destination, dest);
+
+ // Create the directory install generator.
+ this->Makefile->AddInstallGenerator(
+ new cmInstallDirectoryGenerator(dirs, dest.c_str(),
+ permissions_file.c_str(),
+ permissions_dir.c_str(),
+ configurations,
+ component.c_str(),
+ literal_args.c_str()));
// Tell the global generator about any installation component names
// specified.
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index fd1808a6e2..90977f20ec 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -93,13 +93,17 @@ public:
"The RENAME argument specifies a name for an installed file that "
"may be different from the original file. Renaming is allowed only "
"when a single file is installed by the command. "
+ "The OPTIONAL argument specifies that it is not an error if the "
+ "file to be installed does not exist. "
"\n"
"The TARGETS signature:\n"
- " INSTALL(TARGETS targets... [[ARCHIVE|LIBRARY|RUNTIME]\n"
+ " INSTALL(TARGETS targets...\n"
+ " [[ARCHIVE|LIBRARY|RUNTIME]\n"
" [DESTINATION <dir>]\n"
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
+ " [OPTIONAL]\n"
" ] [...])\n"
"The TARGETS form specifies rules for installing targets from a "
"project. There are three kinds of target files that may be "
@@ -145,7 +149,7 @@ public:
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
- " [RENAME <name>])\n"
+ " [RENAME <name>] [OPTIONAL])\n"
"The FILES form specifies rules for installing files for a "
"project. File names given as relative paths are interpreted with "
"respect to the current source directory. Files installed by this "
@@ -157,7 +161,7 @@ public:
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
- " [RENAME <name>])\n"
+ " [RENAME <name>] [OPTIONAL])\n"
"The PROGRAMS form is identical to the FILES form except that the "
"default permissions for the installed file also include "
"OWNER_EXECUTE, GROUP_EXECUTE, and WORLD_EXECUTE. "
@@ -165,6 +169,58 @@ public:
"such as shell scripts. Use the TARGETS form to install targets "
"built within the project."
"\n"
+ "The DIRECTORY signature:\n"
+ " INSTALL(DIRECTORY dirs... DESTINATION <dir>\n"
+ " [FILE_PERMISSIONS permissions...]\n"
+ " [DIRECTORY_PERMISSIONS permissions...]\n"
+ " [USE_SOURCE_PERMISSIONS]\n"
+ " [CONFIGURATIONS [Debug|Release|...]]\n"
+ " [COMPONENT <component>]\n"
+ " [[PATTERN <pattern> | REGEX <regex>]\n"
+ " [EXCLUDE] [PERMISSIONS permissions...]] [...])\n"
+ "The DIRECTORY form installs contents of one or more directories "
+ "to a given destination. "
+ "The directory structure is copied verbatim to the destination. "
+ "The last component of each directory name is appended to the "
+ "destination directory but a trailing slash may be used to "
+ "avoid this because it leaves the last component empty. "
+ "Directory names given as relative paths are interpreted with "
+ "respect to the current source directory. "
+ "If no input directory names are given the destination directory "
+ "will be created but nothing will be installed into it. "
+ "The FILE_PERMISSIONS and DIRECTORY_PERMISSIONS options specify "
+ "permissions given to files and directories in the destination. "
+ "If USE_SOURCE_PERMISSIONS is specified and FILE_PERMISSIONS is not, "
+ "file permissions will be copied from the source directory structure. "
+ "If no permissions are specified files will be given the default "
+ "permissions specified in the FILES form of the command, and the "
+ "directories will be given the default permissions specified in the "
+ "PROGRAMS form of the command. "
+ "The PATTERN and REGEX options specify a globbing pattern or regular "
+ "expression to match directories or files encountered during traversal "
+ "of an input directory. The full path to an input file or directory "
+ "(with forward slashes) is matched against the expression. "
+ "A PATTERN will match only complete file names: the portion of the "
+ "full path matching the pattern must occur at the end of the file name "
+ "and be preceded by a slash. "
+ "A REGEX will match any portion of the full path but it may use "
+ "'/' and '$' to simulate the PATTERN behavior. "
+ "Options following one of these matching expressions "
+ "are applied only to files or directories matching them. "
+ "The EXCLUDE option will skip the matched file or directory. "
+ "The PERMISSIONS option overrides the permissions setting for the "
+ "matched file or directory. "
+ "For example the code\n"
+ " INSTALL(DIRECTORY icons scripts/ DESTINATION share/myproj\n"
+ " PATTERN \"CVS\" EXCLUDE\n"
+ " PATTERN \"scripts/*\"\n"
+ " PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ\n"
+ " GROUP_EXECUTE GROUP_READ)\n"
+ "will install the icons directory to share/myproj/icons and the "
+ "scripts directory to share/myproj. The icons will get default file "
+ "permissions, the scripts will be given specific permissions, and "
+ "any CVS directories will be excluded."
+ "\n"
"The SCRIPT and CODE signature:\n"
" INSTALL([[SCRIPT <file>] [CODE <code>]] [...])\n"
"The SCRIPT form will invoke the given CMake script files during "
@@ -191,6 +247,7 @@ private:
bool HandleScriptMode(std::vector<std::string> const& args);
bool HandleTargetsMode(std::vector<std::string> const& args);
bool HandleFilesMode(std::vector<std::string> const& args);
+ bool HandleDirectoryMode(std::vector<std::string> const& args);
void ComputeDestination(const char* destination, std::string& dest);
bool CheckPermissions(std::string const& arg, std::string& permissions);
};
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
new file mode 100644
index 0000000000..aaf82358f2
--- /dev/null
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -0,0 +1,61 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmInstallDirectoryGenerator.h"
+
+#include "cmTarget.h"
+
+//----------------------------------------------------------------------------
+cmInstallDirectoryGenerator
+::cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
+ const char* dest,
+ const char* file_permissions,
+ const char* dir_permissions,
+ std::vector<std::string> const& configurations,
+ const char* component,
+ const char* literal_args):
+ Directories(dirs), Destination(dest),
+ FilePermissions(file_permissions), DirPermissions(dir_permissions),
+ Configurations(configurations), Component(component),
+ LiteralArguments(literal_args)
+{
+}
+
+//----------------------------------------------------------------------------
+cmInstallDirectoryGenerator
+::~cmInstallDirectoryGenerator()
+{
+}
+
+//----------------------------------------------------------------------------
+void cmInstallDirectoryGenerator::GenerateScript(std::ostream& os)
+{
+ // Write code to install the directories.
+ for(std::vector<std::string>::const_iterator di = this->Directories.begin();
+ di != this->Directories.end(); ++di)
+ {
+ bool not_optional = false;
+ const char* no_properties = 0;
+ const char* no_rename = 0;
+ this->AddInstallRule(os, this->Destination.c_str(),
+ cmTarget::INSTALL_DIRECTORY, di->c_str(),
+ not_optional, no_properties,
+ this->FilePermissions.c_str(),
+ this->DirPermissions.c_str(),
+ this->Configurations, this->Component.c_str(),
+ no_rename, this->LiteralArguments.c_str());
+ }
+}
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
new file mode 100644
index 0000000000..296130ece0
--- /dev/null
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -0,0 +1,48 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmInstallDirectoryGenerator_h
+#define cmInstallDirectoryGenerator_h
+
+#include "cmInstallGenerator.h"
+
+/** \class cmInstallDirectoryGenerator
+ * \brief Generate directory installation rules.
+ */
+class cmInstallDirectoryGenerator: public cmInstallGenerator
+{
+public:
+ cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
+ const char* dest,
+ const char* file_permissions,
+ const char* dir_permissions,
+ std::vector<std::string> const& configurations,
+ const char* component,
+ const char* literal_args);
+ virtual ~cmInstallDirectoryGenerator();
+
+protected:
+ virtual void GenerateScript(std::ostream& os);
+ std::vector<std::string> Directories;
+ std::string Destination;
+ std::string FilePermissions;
+ std::string DirPermissions;
+ std::vector<std::string> Configurations;
+ std::string Component;
+ std::string LiteralArguments;
+};
+
+#endif
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 5b75456c2b..12b7fdc708 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -25,6 +25,11 @@ bool cmInstallFilesCommand
this->SetError("called with incorrect number of arguments");
return false;
}
+
+ // Enable the install target.
+ this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->EnableInstallTarget();
+
std::vector<std::string> args;
this->Makefile->ExpandSourceListArguments(argsIn, args, 2);
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index 80b1cda55e..51a87ef10a 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -94,6 +94,12 @@ public:
"is stored in the variable CMAKE_INSTALL_PREFIX.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmInstallFilesCommand, cmCommand);
protected:
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 7990b2ac68..075285c25e 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -22,13 +22,14 @@
cmInstallFilesGenerator
::cmInstallFilesGenerator(std::vector<std::string> const& files,
const char* dest, bool programs,
- const char* permissions,
+ const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component,
- const char* rename):
+ const char* rename,
+ bool optional):
Files(files), Destination(dest), Programs(programs),
- Permissions(permissions), Configurations(configurations),
- Component(component), Rename(rename)
+ FilePermissions(file_permissions), Configurations(configurations),
+ Component(component), Rename(rename), Optional(optional)
{
}
@@ -45,14 +46,14 @@ void cmInstallFilesGenerator::GenerateScript(std::ostream& os)
for(std::vector<std::string>::const_iterator fi = this->Files.begin();
fi != this->Files.end(); ++fi)
{
- bool not_optional = false;
const char* no_properties = 0;
+ const char* no_dir_permissions = 0;
this->AddInstallRule(os, this->Destination.c_str(),
(this->Programs
? cmTarget::INSTALL_PROGRAMS
: cmTarget::INSTALL_FILES), fi->c_str(),
- not_optional, no_properties,
- this->Permissions.c_str(),
+ this->Optional, no_properties,
+ this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str(),
this->Rename.c_str());
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 4589b1e37e..4438ae7f2d 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -27,10 +27,11 @@ class cmInstallFilesGenerator: public cmInstallGenerator
public:
cmInstallFilesGenerator(std::vector<std::string> const& files,
const char* dest, bool programs,
- const char* permissions,
+ const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component,
- const char* rename);
+ const char* rename,
+ bool optional = false);
virtual ~cmInstallFilesGenerator();
protected:
@@ -38,10 +39,11 @@ protected:
std::vector<std::string> Files;
std::string Destination;
bool Programs;
- std::string Permissions;
+ std::string FilePermissions;
std::vector<std::string> Configurations;
std::string Component;
std::string Rename;
+ bool Optional;
};
#endif
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 3267779e0b..2f5366371a 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -55,10 +55,12 @@ void cmInstallGenerator
const char* file,
bool optional /* = false */,
const char* properties /* = 0 */,
- const char* permissions /* = 0 */,
+ const char* permissions_file /* = 0 */,
+ const char* permissions_dir /* = 0 */,
std::vector<std::string> const& configurations,
const char* component /* = 0 */,
- const char* rename /* = 0 */
+ const char* rename /* = 0 */,
+ const char* literal_args /* = 0 */
)
{
// Use the FILE command to install the file.
@@ -83,9 +85,13 @@ void cmInstallGenerator
{
os << " PROPERTIES" << properties;
}
- if(permissions && *permissions)
+ if(permissions_file && *permissions_file)
{
- os << " PERMISSIONS" << permissions;
+ os << " PERMISSIONS" << permissions_file;
+ }
+ if(permissions_dir && *permissions_dir)
+ {
+ os << " DIR_PERMISSIONS" << permissions_dir;
}
if(rename && *rename)
{
@@ -104,5 +110,10 @@ void cmInstallGenerator
{
os << " COMPONENTS \"" << component << "\"";
}
- os << " FILES \"" << file << "\")\n";
+ os << " FILES \"" << file << "\"";
+ if(literal_args && *literal_args)
+ {
+ os << literal_args;
+ }
+ os << ")\n";
}
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 53c8c432df..94c0fbd751 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -38,11 +38,13 @@ public:
std::ostream& os, const char* dest, int type,
const char* file, bool optional = false,
const char* properties = 0,
- const char* permissions = 0,
+ const char* permissions_file = 0,
+ const char* permissions_dir = 0,
std::vector<std::string> const& configurations
= std::vector<std::string>(),
const char* component = 0,
- const char* rename = 0
+ const char* rename = 0,
+ const char* literal_args = 0
);
protected:
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 1830c5e7f6..e38f0a6bc2 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -26,6 +26,10 @@ bool cmInstallProgramsCommand
return false;
}
+ // Enable the install target.
+ this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->EnableInstallTarget();
+
// Create an INSTALL_PROGRAMS target specifically for this path.
this->TargetName = "INSTALL_PROGRAMS_"+args[0];
cmTarget& target = this->Makefile->GetTargets()[this->TargetName];
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index c960f89ef5..b3f09a50a9 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -90,6 +90,12 @@ public:
"is stored in the variable CMAKE_INSTALL_PREFIX.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmInstallProgramsCommand, cmCommand);
protected:
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 860ecad74e..1bb5beb820 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -25,12 +25,12 @@
//----------------------------------------------------------------------------
cmInstallTargetGenerator
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
- const char* permissions,
+ const char* file_permissions,
std::vector<std::string> const& configurations,
- const char* component):
+ const char* component, bool optional):
Target(&t), Destination(dest), ImportLibrary(implib),
- Permissions(permissions), Configurations(configurations),
- Component(component)
+ FilePermissions(file_permissions), Configurations(configurations),
+ Component(component), Optional(optional)
{
this->Target->SetHaveInstallRule(true);
}
@@ -72,6 +72,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
std::string destination = this->Destination;
// Setup special properties for some target types.
+ std::string literal_args;
std::string props;
const char* properties = 0;
cmTarget::TargetType type = this->Target->GetType();
@@ -81,16 +82,26 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
{
// Add shared library installation properties if this platform
// supports them.
- const char* lib_version = this->Target->GetProperty("VERSION");
- const char* lib_soversion = this->Target->GetProperty("SOVERSION");
- if(!this->Target->GetMakefile()
- ->GetDefinition("CMAKE_SHARED_LIBRARY_SONAME_C_FLAG"))
- {
+ const char* lib_version = 0;
+ const char* lib_soversion = 0;
+
// Versioning is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
- lib_version = 0;
- lib_soversion = 0;
+ cmGlobalGenerator* gg =
+ (this->Target->GetMakefile()
+ ->GetLocalGenerator()->GetGlobalGenerator());
+ if(const char* linkLanguage = this->Target->GetLinkerLanguage(gg))
+ {
+ std::string sonameFlagVar = "CMAKE_SHARED_LIBRARY_SONAME_";
+ sonameFlagVar += linkLanguage;
+ sonameFlagVar += "_FLAG";
+ if(this->Target->GetMakefile()->GetDefinition(sonameFlagVar.c_str()))
+ {
+ lib_version = this->Target->GetProperty("VERSION");
+ lib_soversion = this->Target->GetProperty("SOVERSION");
+ }
}
+
if(lib_version)
{
props += " VERSION ";
@@ -130,6 +141,7 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
false, false);
fromFile += ".app";
type = cmTarget::INSTALL_DIRECTORY;
+ literal_args += " USE_SOURCE_PERMISSIONS";
}
}
break;
@@ -148,11 +160,15 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
}
// Write code to install the target file.
+ const char* no_dir_permissions = 0;
+ const char* no_rename = 0;
+ bool optional = this->Optional | this->ImportLibrary;
this->AddInstallRule(os, destination.c_str(), type, fromFile.c_str(),
- this->ImportLibrary, properties,
- this->Permissions.c_str(),
+ optional, properties,
+ this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
- this->Component.c_str());
+ this->Component.c_str(),
+ no_rename, literal_args.c_str());
// Fix the install_name settings in installed binaries.
if(type == cmTarget::SHARED_LIBRARY ||
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 693a908f13..77f9fec46c 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -29,10 +29,11 @@ class cmInstallTargetGenerator: public cmInstallGenerator
public:
cmInstallTargetGenerator(
cmTarget& t, const char* dest, bool implib,
- const char* permissions = "",
+ const char* file_permissions = "",
std::vector<std::string> const& configurations
= std::vector<std::string>(),
- const char* component = ""
+ const char* component = "",
+ bool optional = false
);
virtual ~cmInstallTargetGenerator();
@@ -47,9 +48,10 @@ protected:
cmTarget* Target;
std::string Destination;
bool ImportLibrary;
- std::string Permissions;
+ std::string FilePermissions;
std::vector<std::string> Configurations;
std::string Component;
+ bool Optional;
};
#endif
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 42f83acb80..246b118af7 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -26,6 +26,10 @@ bool cmInstallTargetsCommand
return false;
}
+ // Enable the install target.
+ this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->EnableInstallTarget();
+
cmTargets &tgts = this->Makefile->GetTargets();
std::vector<std::string>::const_iterator s = args.begin();
++s;
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 10ab4570cf..0ea9035de5 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -72,6 +72,12 @@ public:
"(Windows DLL), the files will be copied to that directory.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmInstallTargetsCommand, cmCommand);
};
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index bd6e80e15d..cd9a34f368 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -75,6 +75,12 @@ public:
"type of build.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmLinkLibrariesCommand, cmCommand);
};
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 99e3ac3b55..cdb14a0a95 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -54,6 +54,14 @@ bool cmListCommand::InitialPass(std::vector<std::string> const& args)
{
return this->HandleRemoveItemCommand(args);
}
+ if(subCommand == "SORT")
+ {
+ return this->HandleSortCommand(args);
+ }
+ if(subCommand == "REVERSE")
+ {
+ return this->HandleReverseCommand(args);
+ }
std::string e = "does not recognize sub-command "+subCommand;
this->SetError(e.c_str());
@@ -258,7 +266,7 @@ bool cmListCommand
{
if(args.size() < 3)
{
- this->SetError("sub-command REMOVE requires at least two arguments.");
+ this->SetError("sub-command REMOVE_ITEM requires two or more arguments.");
return false;
}
@@ -267,6 +275,7 @@ bool cmListCommand
std::vector<std::string> varArgsExpanded;
if ( !this->GetList(varArgsExpanded, listName.c_str()) )
{
+ this->SetError("sub-command REMOVE_ITEM requires list to be present.");
return false;
}
@@ -280,9 +289,12 @@ bool cmListCommand
{
varArgsExpanded.erase(varArgsExpanded.begin()+kk);
}
+ else
+ {
kk ++;
}
}
+ }
std::string value;
for ( cc = 0; cc < varArgsExpanded.size(); cc ++ )
@@ -299,12 +311,82 @@ bool cmListCommand
}
//----------------------------------------------------------------------------
+bool cmListCommand
+::HandleReverseCommand(std::vector<std::string> const& args)
+{
+ if(args.size() < 2)
+ {
+ this->SetError("sub-command REVERSE requires a list as an argument.");
+ return false;
+ }
+
+ const std::string& listName = args[1];
+ // expand the variable
+ std::vector<std::string> varArgsExpanded;
+ if ( !this->GetList(varArgsExpanded, listName.c_str()) )
+ {
+ this->SetError("sub-command REVERSE requires list to be present.");
+ return false;
+ }
+
+ std::string value;
+ std::vector<std::string>::reverse_iterator it;
+ for ( it = varArgsExpanded.rbegin(); it != varArgsExpanded.rend(); ++ it )
+ {
+ if (value.size())
+ {
+ value += ";";
+ }
+ value += it->c_str();
+ }
+
+ this->Makefile->AddDefinition(listName.c_str(), value.c_str());
+ return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmListCommand
+::HandleSortCommand(std::vector<std::string> const& args)
+{
+ if(args.size() < 2)
+ {
+ this->SetError("sub-command SORT requires a list as an argument.");
+ return false;
+ }
+
+ const std::string& listName = args[1];
+ // expand the variable
+ std::vector<std::string> varArgsExpanded;
+ if ( !this->GetList(varArgsExpanded, listName.c_str()) )
+ {
+ this->SetError("sub-command SORT requires list to be present.");
+ return false;
+ }
+
+ std::sort(varArgsExpanded.begin(), varArgsExpanded.end());
+
+ std::string value;
+ std::vector<std::string>::iterator it;
+ for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it )
+ {
+ if (value.size())
+ {
+ value += ";";
+ }
+ value += it->c_str();
+ }
+
+ this->Makefile->AddDefinition(listName.c_str(), value.c_str());
+ return true;
+}
+
+//----------------------------------------------------------------------------
bool cmListCommand::HandleRemoveAtCommand(
std::vector<std::string> const& args)
{
if(args.size() < 3)
{
- this->SetError("sub-command REMOVE_ITEM requires at least "
+ this->SetError("sub-command REMOVE_AT requires at least "
"two arguments.");
return false;
}
@@ -314,6 +396,7 @@ bool cmListCommand::HandleRemoveAtCommand(
std::vector<std::string> varArgsExpanded;
if ( !this->GetList(varArgsExpanded, listName.c_str()) )
{
+ this->SetError("sub-command REMOVE_AT requires list to be present.");
return false;
}
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 129f045aa2..d42e05dd3a 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -93,6 +93,8 @@ protected:
bool HandleInsertCommand(std::vector<std::string> const& args);
bool HandleRemoveAtCommand(std::vector<std::string> const& args);
bool HandleRemoveItemCommand(std::vector<std::string> const& args);
+ bool HandleSortCommand(std::vector<std::string> const& args);
+ bool HandleReverseCommand(std::vector<std::string> const& args);
bool GetList(std::vector<std::string>& list, const char* var);
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 9457a0c960..e1ca49c85a 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -21,6 +21,10 @@
#include <cmsys/RegularExpression.hxx>
+#ifdef __BORLANDC__
+# pragma warn -8060 /* possibly incorrect assignment */
+#endif
+
bool cmListFileCacheParseFunction(cmListFileLexer* lexer,
cmListFileFunction& function,
const char* filename);
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index 1f8797c620..01e099e316 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -503,33 +503,16 @@ Modify cmListFileLexer.c:
- add a statement "(void)yyscanner;" to the top of these methods:
yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
- remove all YY_BREAK lines occurring right after return statements
+ - remove the isatty forward declaration
*/
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#define YY_NO_INPUT 1
-#define YY_NO_UNPUT 1
-#define YY_NO_UNISTD_H 1
-#define ECHO
+#include "cmStandardLexer.h"
/* Setup the proper cmListFileLexer_yylex declaration. */
#define YY_EXTRA_TYPE cmListFileLexer*
#define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
#include "cmListFileLexer.h"
/*--------------------------------------------------------------------------*/
@@ -1526,10 +1509,6 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
cmListFileLexer_yyfree((void *) b ,yyscanner );
}
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a cmListFileLexer_yyrestart() or at EOF.
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index 02ad5208c8..64a8fe0051 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -27,35 +27,18 @@ Modify cmListFileLexer.c:
- remove TABs
- remove the yyunput function
- add a statement "(void)yyscanner;" to the top of these methods:
- yy_fatal_error, yyalloc, yyrealloc, yyfree
+ yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
- remove all YY_BREAK lines occurring right after return statements
+ - remove the isatty forward declaration
*/
-/* Disable features we do not need. */
-#define YY_NEVER_INTERACTIVE 1
-#define YY_NO_INPUT 1
-#define YY_NO_UNPUT 1
-#define YY_NO_UNISTD_H 1
-#define ECHO
+#include "cmStandardLexer.h"
-/* Setup the proper yylex declaration. */
+/* Setup the proper cmListFileLexer_yylex declaration. */
#define YY_EXTRA_TYPE cmListFileLexer*
#define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
-/* Disable some warnings. */
-#if defined(_MSC_VER)
-# pragma warning ( disable : 4127 )
-# pragma warning ( disable : 4131 )
-# pragma warning ( disable : 4244 )
-# pragma warning ( disable : 4251 )
-# pragma warning ( disable : 4267 )
-# pragma warning ( disable : 4305 )
-# pragma warning ( disable : 4309 )
-# pragma warning ( disable : 4706 )
-# pragma warning ( disable : 4786 )
-#endif
-
#include "cmListFileLexer.h"
/*--------------------------------------------------------------------------*/
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index e13449ca1a..fe73ee8536 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -21,6 +21,12 @@
#include <cmsys/DynamicLoader.hxx>
+#include <stdlib.h>
+
+#ifdef __QNX__
+# include <malloc.h> /* for malloc/free on QNX */
+#endif
+
#include <signal.h>
extern "C" void TrapsForSignalsCFunction(int sig);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0d687dee44..86949391cd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -28,6 +28,8 @@
#include "cmTest.h"
#include "cmake.h"
+#include <cmsys/System.h>
+
#include <ctype.h> // for isalpha
cmLocalGenerator::cmLocalGenerator()
@@ -37,6 +39,8 @@ cmLocalGenerator::cmLocalGenerator()
this->ExcludeFromAll = false;
this->Parent = 0;
this->WindowsShell = false;
+ this->WindowsVSIDE = false;
+ this->MSYSShell = false;
this->IgnoreLibPrefix = false;
this->UseRelativePaths = false;
this->Configured = false;
@@ -397,7 +401,8 @@ void cmLocalGenerator::GenerateInstallRules()
// Include install scripts from subdirectories.
if(!this->Children.empty())
{
- fout << "# Include the install script for each subdirectory.\n";
+ fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
+ fout << " # Include the install script for each subdirectory.\n";
for(std::vector<cmLocalGenerator*>::const_iterator
ci = this->Children.begin(); ci != this->Children.end(); ++ci)
{
@@ -405,11 +410,12 @@ void cmLocalGenerator::GenerateInstallRules()
{
std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ConvertToUnixSlashes(odir);
- fout << "INCLUDE(\"" << odir.c_str()
+ fout << " INCLUDE(\"" << odir.c_str()
<< "/cmake_install.cmake\")" << std::endl;
}
}
fout << "\n";
+ fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
}
// Record the install manifest.
@@ -618,6 +624,10 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
+ std::string langFlags;
+ this->AddLanguageFlags(langFlags, llang, 0);
+ vars.LanguageCompileFlags = langFlags.c_str();
+
cmCustomCommandLines commandLines;
std::vector<std::string> rules;
rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str()));
@@ -749,6 +759,20 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.Source;
}
}
+ if(replaceValues.PreprocessedSource)
+ {
+ if(variable == "PREPROCESSED_SOURCE")
+ {
+ return replaceValues.PreprocessedSource;
+ }
+ }
+ if(replaceValues.AssemblySource)
+ {
+ if(variable == "ASSEMBLY_SOURCE")
+ {
+ return replaceValues.AssemblySource;
+ }
+ }
if(replaceValues.Object)
{
if(variable == "OBJECT")
@@ -795,21 +819,29 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
targetQuoted = '\"';
targetQuoted += replaceValues.Target;
targetQuoted += '\"';
- return targetQuoted;
}
+ return targetQuoted;
}
+ if(replaceValues.LanguageCompileFlags)
+ {
if(variable == "LANGUAGE_COMPILE_FLAGS")
{
return replaceValues.LanguageCompileFlags;
}
+ }
+ if(replaceValues.Target)
+ {
if(variable == "TARGET")
{
return replaceValues.Target;
}
+ }
if(variable == "TARGET_IMPLIB")
{
return this->TargetImplib;
}
+ if(replaceValues.Target)
+ {
if(variable == "TARGET_BASE")
{
// Strip the last extension off the target name.
@@ -825,6 +857,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
}
}
+ }
if(replaceValues.TargetSOName)
{
if(variable == "TARGET_SONAME")
@@ -1011,6 +1044,17 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
// given once i.e. -classpath a:b:c
repeatFlag = false;
}
+
+ // Support special system include flag if it is available and the
+ // normal flag is repeated for each directory.
+ std::string sysFlagVar = "CMAKE_INCLUDE_SYSTEM_FLAG_";
+ sysFlagVar += lang;
+ const char* sysIncludeFlag = 0;
+ if(repeatFlag)
+ {
+ sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar.c_str());
+ }
+
bool flagUsed = false;
std::set<cmStdString> emitted;
for(i = includes.begin(); i != includes.end(); ++i)
@@ -1033,7 +1077,15 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
std::string include = *i;
if(!flagUsed || repeatFlag)
{
+ if(sysIncludeFlag &&
+ this->Makefile->IsSystemIncludeDirectory(i->c_str()))
+ {
+ includeFlags << sysIncludeFlag;
+ }
+ else
+ {
includeFlags << includeFlag;
+ }
flagUsed = true;
}
std::string includePath = this->ConvertToOutputForExisting(i->c_str());
@@ -1064,7 +1116,8 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
}
//----------------------------------------------------------------------------
-void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
+void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
+ bool filter_system_dirs)
{
// Need to decide whether to automatically include the source and
// binary directories at the beginning of the include path.
@@ -1138,6 +1191,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
}
}
+ if(filter_system_dirs)
+ {
// Do not explicitly add the standard include path "/usr/include".
// This can cause problems with certain standard library
// implementations because the wrong headers may be found first.
@@ -1152,6 +1207,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
emitted.insert(implicitIncludeVec[k]);
}
}
+ }
// Get the project-specified include directories.
std::vector<std::string>& includes =
@@ -1610,16 +1666,68 @@ void cmLocalGenerator
const std::vector<std::string>&
linkDirectories = target.GetLinkDirectories();
+ // Lookup link type selection flags.
+ const char* static_link_type_flag = 0;
+ const char* shared_link_type_flag = 0;
+ const char* target_type_str = 0;
+ switch(target.GetType())
+ {
+ case cmTarget::EXECUTABLE: target_type_str = "EXE"; break;
+ case cmTarget::SHARED_LIBRARY: target_type_str = "SHARED_LIBRARY"; break;
+ case cmTarget::MODULE_LIBRARY: target_type_str = "SHARED_MODULE"; break;
+ default: break;
+ }
+ if(target_type_str)
+ {
+ // Get the language used for linking.
+ const char* linkLanguage =
+ target.GetLinkerLanguage(this->GetGlobalGenerator());
+
+ if(!linkLanguage)
+ {
+ cmSystemTools::
+ Error("CMake can not determine linker language for target:",
+ target.GetName());
+ return;
+ }
+ std::string static_link_type_flag_var = "CMAKE_";
+ static_link_type_flag_var += target_type_str;
+ static_link_type_flag_var += "_LINK_STATIC_";
+ static_link_type_flag_var += linkLanguage;
+ static_link_type_flag_var += "_FLAGS";
+ static_link_type_flag =
+ this->Makefile->GetDefinition(static_link_type_flag_var.c_str());
+
+ std::string shared_link_type_flag_var = "CMAKE_";
+ shared_link_type_flag_var += target_type_str;
+ shared_link_type_flag_var += "_LINK_DYNAMIC_";
+ shared_link_type_flag_var += linkLanguage;
+ shared_link_type_flag_var += "_FLAGS";
+ shared_link_type_flag =
+ this->Makefile->GetDefinition(shared_link_type_flag_var.c_str());
+ }
+
// Compute the link directory order needed to link the libraries.
cmOrderLinkDirectories orderLibs;
- orderLibs.SetLinkPrefix(
+ orderLibs.SetLinkTypeInformation(cmOrderLinkDirectories::LinkShared,
+ static_link_type_flag,
+ shared_link_type_flag);
+ orderLibs.AddLinkPrefix(
this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_PREFIX"));
+ orderLibs.AddLinkPrefix(
+ this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_PREFIX"));
+
+ // Import library names should be matched and treated as shared
+ // libraries for the purposes of linking.
orderLibs.AddLinkExtension(
- this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"));
+ this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"),
+ cmOrderLinkDirectories::LinkShared);
orderLibs.AddLinkExtension(
- this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"));
+ this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"),
+ cmOrderLinkDirectories::LinkStatic);
orderLibs.AddLinkExtension(
- this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"));
+ this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"),
+ cmOrderLinkDirectories::LinkShared);
orderLibs.AddLinkExtension(
this->Makefile->GetDefinition("CMAKE_LINK_LIBRARY_SUFFIX"));
if(const char* linkSuffixes =
@@ -1823,61 +1931,11 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
//----------------------------------------------------------------------------
std::string
-cmLocalGenerator::ConstructScript(const cmCustomCommandLines& commandLines,
- const char* workingDirectory,
- const char* newline)
-
-{
- // Store the script in a string.
- std::string script;
- if(workingDirectory)
- {
- script += "cd ";
- script += this->Convert(workingDirectory, START_OUTPUT, SHELL);
- script += newline;
- }
- // for visual studio IDE add extra stuff to the PATH
- // if CMAKE_MSVCIDE_RUN_PATH is set.
- if(this->Makefile->GetDefinition("MSVC_IDE"))
- {
- const char* extraPath =
- this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
- if(extraPath)
- {
- script += "set PATH=";
- script += extraPath;
- script += ";%PATH%";
- script += newline;
- }
- }
- // Write each command on a single line.
- for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
- cl != commandLines.end(); ++cl)
- {
- // Start with the command name.
- const cmCustomCommandLine& commandLine = *cl;
- script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
-
- // Add the arguments.
- for(unsigned int j=1;j < commandLine.size(); ++j)
- {
- script += " ";
- script += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
- }
-
- // End the line.
- script += newline;
- }
- return script;
-}
-
-//----------------------------------------------------------------------------
-std::string
cmLocalGenerator::ConstructComment(const cmCustomCommand& cc,
const char* default_comment)
{
// Check for a comment provided with the command.
- if(cc.GetComment() && *cc.GetComment())
+ if(cc.GetComment())
{
return cc.GetComment();
}
@@ -1975,6 +2033,18 @@ std::string cmLocalGenerator::Convert(const char* source,
{
cmSystemTools::SetForceUnixPaths(true);
}
+
+ // For the MSYS shell convert drive letters to posix paths, so
+ // that c:/some/path becomes /c/some/path. This is needed to
+ // avoid problems with the shell path translation.
+ if(this->MSYSShell)
+ {
+ if(result.size() > 2 && result[1] == ':')
+ {
+ result[1] = result[0];
+ result[0] = '/';
+ }
+ }
}
return result;
}
@@ -2198,3 +2268,77 @@ cmLocalGenerator::GetObjectFileNameWithoutTarget(const cmSourceFile& source)
// Convert to a safe name.
return this->CreateSafeUniqueObjectFileName(objectName.c_str());
}
+
+//----------------------------------------------------------------------------
+const char*
+cmLocalGenerator
+::GetSourceFileLanguage(const cmSourceFile& source)
+{
+ // Check for an explicitly assigned language.
+ if(const char* lang = source.GetProperty("LANGUAGE"))
+ {
+ return lang;
+ }
+
+ // Infer the language from the source file extension.
+ return (this->GlobalGenerator
+ ->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
+}
+
+//----------------------------------------------------------------------------
+std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
+{
+ std::string result;
+ bool forceOn = cmSystemTools::GetForceUnixPaths();
+ if(forceOn && this->WindowsShell)
+ {
+ cmSystemTools::SetForceUnixPaths(false);
+ }
+ result = cmSystemTools::EscapeSpaces(str);
+ if(forceOn && this->WindowsShell)
+ {
+ cmSystemTools::SetForceUnixPaths(true);
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
+ bool forEcho)
+{
+ // Compute the flags for the target shell environment.
+ int flags = 0;
+ if(this->WindowsVSIDE)
+ {
+ flags |= cmsysSystem_Shell_Flag_VSIDE;
+ }
+ else
+ {
+ flags |= cmsysSystem_Shell_Flag_Make;
+ }
+ if(makeVars)
+ {
+ flags |= cmsysSystem_Shell_Flag_AllowMakeVariables;
+ }
+ if(forEcho)
+ {
+ flags |= cmsysSystem_Shell_Flag_EchoWindows;
+ }
+
+ // Compute the buffer size needed.
+ int size = (this->WindowsShell ?
+ cmsysSystem_Shell_GetArgumentSizeForWindows(str, flags) :
+ cmsysSystem_Shell_GetArgumentSizeForUnix(str, flags));
+
+ // Compute the shell argument itself.
+ std::vector<char> arg(size);
+ if(this->WindowsShell)
+ {
+ cmsysSystem_Shell_GetArgumentForWindows(str, &arg[0], flags);
+ }
+ else
+ {
+ cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags);
+ }
+ return std::string(&arg[0]);
+}
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 49bae5b7b0..53b42207f1 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -170,7 +170,11 @@ public:
std::vector<cmStdString>* fullPathLibs=0);
/** Get the include flags for the current makefile and language. */
- void GetIncludeDirectories(std::vector<std::string>& dirs);
+ void GetIncludeDirectories(std::vector<std::string>& dirs,
+ bool filter_system_dirs = true);
+
+ /** Compute the language used to compile the given source file. */
+ const char* GetSourceFileLanguage(const cmSourceFile& source);
// Create a struct to hold the varibles passed into
// ExpandRuleVariables
@@ -178,18 +182,7 @@ public:
{
RuleVariables()
{
- this->Language= 0;
- this->Objects= 0;
- this->Target= 0;
- this->LinkLibraries= 0;
- this->Source= 0;
- this->Object= 0;
- this->ObjectDir= 0;
- this->Flags= 0;
- this->ObjectsQuoted= 0;
- this->TargetSOName= 0;
- this->TargetInstallNameDir = 0;
- this->LinkFlags= 0;
+ memset(this, 0, sizeof(*this));
}
const char* TargetPDB;
const char* Language;
@@ -197,6 +190,8 @@ public:
const char* Target;
const char* LinkLibraries;
const char* Source;
+ const char* AssemblySource;
+ const char* PreprocessedSource;
const char* Object;
const char* ObjectDir;
const char* Flags;
@@ -207,11 +202,18 @@ public:
const char* LanguageCompileFlags;
};
+ /** Escape the given string to be used as a command line argument in
+ the native build system shell. Optionally allow the build
+ system to replace make variable references. Optionally adjust
+ escapes for the special case of passing to the native echo
+ command. */
+ std::string EscapeForShell(const char* str, bool makeVars = false,
+ bool forEcho = false);
+
+ /** Backwards-compatibility version of EscapeForShell. */
+ std::string EscapeForShellOldStyle(const char* str);
+
protected:
- /** Construct a script from the given list of command lines. */
- std::string ConstructScript(const cmCustomCommandLines& commandLines,
- const char* workingDirectory,
- const char* newline = "\n");
/** Construct a comment for a custom command. */
std::string ConstructComment(const cmCustomCommand& cc,
@@ -273,7 +275,9 @@ protected:
std::map<cmStdString, cmStdString> LanguageToIncludeFlags;
std::map<cmStdString, cmStdString> UniqueObjectNamesMap;
bool WindowsShell;
+ bool WindowsVSIDE;
bool ForceUnixPath;
+ bool MSYSShell;
bool UseRelativePaths;
bool IgnoreLibPrefix;
bool Configured;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index edfa61803a..96aa03c40c 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -44,11 +44,13 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->MakefileVariableSize = 0;
this->IgnoreLibPrefix = false;
this->PassMakeflags = false;
- this->EchoNeedsQuote = true;
this->DefineWindowsNULL = false;
this->UnixCD = true;
this->ForceVerboseMakefiles=false;
this->ColorMakefile = false;
+ this->SkipPreprocessedSourceRules = false;
+ this->SkipAssemblySourceRules = false;
+ this->NativeEchoCommand = "@echo ";
}
//----------------------------------------------------------------------------
@@ -76,9 +78,13 @@ void cmLocalUnixMakefileGenerator3::Generate()
// Setup our configuration variables for this directory.
this->ConfigureOutputPaths();
- // Record whether color makefiles are enabled to avoid checking many
+ // Record whether some options are enabled to avoid checking many
// times later.
this->ColorMakefile = this->Makefile->IsOn("CMAKE_COLOR_MAKEFILE");
+ this->SkipPreprocessedSourceRules =
+ this->Makefile->IsOn("CMAKE_SKIP_PREPROCESSED_SOURCE_RULES");
+ this->SkipAssemblySourceRules =
+ this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES");
// Generate the rule files for each target.
cmTargets& targets = this->Makefile->GetTargets();
@@ -155,8 +161,10 @@ void cmLocalUnixMakefileGenerator3
void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable()
{
// write the top level progress for the all target
+ std::string progressFile = cmake::GetCMakeFilesDirectory();
+ progressFile += "/progress.make";
std::string progressFileNameFull =
- this->ConvertToFullPath("progress.make");
+ this->ConvertToFullPath(progressFile.c_str());
cmGeneratedFileStream ruleFileStream(progressFileNameFull.c_str());
if(!ruleFileStream)
{
@@ -167,7 +175,7 @@ void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable()
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
ruleFileStream << "CMAKE_ALL_PROGRESS = "
- << gg->GetNumberOfProgressActionsInAll(this);
+ << gg->GetNumberOfProgressActionsInAll(this) << "\n";
}
//----------------------------------------------------------------------------
@@ -250,12 +258,6 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
ruleFileStream.SetCopyIfDifferent(true);
}
- // Include the progress variables for the target.
- ruleFileStream
- << "# Include the progress variables for this target.\n"
- << this->IncludeDirective << " "
- << "progress.make\n\n";
-
// write the all rules
this->WriteLocalAllRules(ruleFileStream);
@@ -275,34 +277,52 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
gg->WriteConvenienceRules(ruleFileStream,emittedTargets);
}
- std::vector<std::string> depends;
- std::vector<std::string> commands;
+ bool do_preprocess_rules =
+ this->GetCreatePreprocessedSourceRules();
+ bool do_assembly_rules =
+ this->GetCreateAssemblySourceRules();
// now write out the object rules
// for each object file name
- for (std::map<cmStdString,std::vector<cmTarget *> >::iterator lo =
+ for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
this->LocalObjectFiles.begin();
lo != this->LocalObjectFiles.end(); ++lo)
{
- commands.clear();
- // for each target using the object file
- for (std::vector<cmTarget *>::iterator to =
- lo->second.begin(); to != lo->second.end(); ++to)
+ // Add a convenience rule for building the object file.
+ this->WriteObjectConvenienceRule(ruleFileStream,
+ "target to build an object file",
+ lo->first.c_str(), lo->second);
+
+ // Check whether preprocessing and assembly rules make sense.
+ // They make sense only for C and C++ sources.
+ bool lang_is_c_or_cxx = false;
+ for(std::vector<LocalObjectEntry>::const_iterator ei =
+ lo->second.begin(); ei != lo->second.end(); ++ei)
{
- std::string tgtMakefileName = this->GetRelativeTargetDirectory(**to);
- std::string targetName = tgtMakefileName;
- tgtMakefileName += "/build.make";
- targetName += "/";
- targetName += lo->first.c_str();
- commands.push_back(this->GetRecursiveMakeCall
- (tgtMakefileName.c_str(),targetName.c_str()));
- this->CreateCDCommand(commands,
- this->Makefile->GetHomeOutputDirectory(),
- this->Makefile->GetStartOutputDirectory());
+ if(ei->Language == "C" || ei->Language == "CXX")
+ {
+ lang_is_c_or_cxx = true;
+ }
+ }
+
+ // Add convenience rules for preprocessed and assembly files.
+ if(lang_is_c_or_cxx && (do_preprocess_rules || do_assembly_rules))
+ {
+ std::string::size_type dot_pos = lo->first.rfind(".");
+ std::string base = lo->first.substr(0, dot_pos);
+ if(do_preprocess_rules)
+ {
+ this->WriteObjectConvenienceRule(
+ ruleFileStream, "target to preprocess a source file",
+ (base + ".i").c_str(), lo->second);
+ }
+ if(do_assembly_rules)
+ {
+ this->WriteObjectConvenienceRule(
+ ruleFileStream, "target to generate assembly for a file",
+ (base + ".s").c_str(), lo->second);
+ }
}
- this->WriteMakeRule(ruleFileStream,
- "target for object file",
- lo->first.c_str(), depends, commands, false);
}
// add a help target as long as there isn;t a real target named help
@@ -316,6 +336,39 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
this->WriteSpecialTargetsBottom(ruleFileStream);
}
+//----------------------------------------------------------------------------
+void
+cmLocalUnixMakefileGenerator3
+::WriteObjectConvenienceRule(std::ostream& ruleFileStream,
+ const char* comment, const char* output,
+ LocalObjectInfo const& targets)
+{
+ // Recursively make the rule for each target using the object file.
+ std::vector<std::string> commands;
+ for(std::vector<LocalObjectEntry>::const_iterator t = targets.begin();
+ t != targets.end(); ++t)
+ {
+ std::string tgtMakefileName =
+ this->GetRelativeTargetDirectory(*(t->Target));
+ std::string targetName = tgtMakefileName;
+ tgtMakefileName += "/build.make";
+ targetName += "/";
+ targetName += output;
+ commands.push_back(
+ this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str())
+ );
+ this->CreateCDCommand(commands,
+ this->Makefile->GetHomeOutputDirectory(),
+ this->Makefile->GetStartOutputDirectory());
+ }
+
+ // Write the rule to the makefile.
+ std::vector<std::string> no_depends;
+ this->WriteMakeRule(ruleFileStream, comment,
+ output, no_depends, commands, true, true);
+}
+
+//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3
::WriteLocalMakefileTargets(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted)
@@ -416,12 +469,10 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
infoFileStream
<< "SET(CMAKE_C_INCLUDE_PATH\n";
std::vector<std::string> includeDirs;
- this->GetIncludeDirectories(includeDirs);
+ this->GetIncludeDirectories(includeDirs, false);
for(std::vector<std::string>::iterator i = includeDirs.begin();
i != includeDirs.end(); ++i)
{
- // Note: This path conversion must match that used for
- // CMAKE_GENERATED_FILES so that the file names match.
infoFileStream
<< " \"" << this->Convert(i->c_str(),HOME_OUTPUT).c_str() << "\"\n";
}
@@ -452,30 +503,6 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
infoFileStream
<< "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
"${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n";
-
- // Store the set of available generated files.
- infoFileStream
- << "\n"
- << "# The set of files generated by rules in this directory:\n";
- infoFileStream
- << "SET(CMAKE_GENERATED_FILES\n";
- for(std::vector<cmSourceFile*>::const_iterator
- i = this->Makefile->GetSourceFiles().begin();
- i != this->Makefile->GetSourceFiles().end(); ++i)
- {
- cmSourceFile* src = *i;
- if(src->GetPropertyAsBool("GENERATED"))
- {
- // Note: This path conversion must match that used for
- // CMAKE_C_INCLUDE_PATH so that the file names match.
- infoFileStream
- << " \""
- << this->Convert(src->GetFullPath().c_str(), HOME_OUTPUT)
- << "\"\n";
- }
- }
- infoFileStream
- << ")\n";
}
//----------------------------------------------------------------------------
@@ -504,7 +531,8 @@ cmLocalUnixMakefileGenerator3
const char* target,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
- bool symbolic)
+ bool symbolic,
+ bool in_help)
{
// Make sure there is a target.
if(!target || !*target)
@@ -580,6 +608,12 @@ cmLocalUnixMakefileGenerator3
os << "\t" << replace.c_str() << "\n";
}
os << "\n";
+
+ // Add the output to the local help if requested.
+ if(in_help)
+ {
+ this->LocalHelp.push_back(target);
+ }
}
//----------------------------------------------------------------------------
@@ -663,15 +697,28 @@ cmLocalUnixMakefileGenerator3
<< "# Special targets provided by cmake.\n"
<< "\n";
+ std::vector<std::string> no_commands;
+ std::vector<std::string> no_depends;
+
+ // Special target to cleanup operation of make tool.
+ // This should be the first target except for the default_target in
+ // the interface Makefile.
+ this->WriteMakeRule(
+ makefileStream, "Disable implicit rules so canoncical targets will work.",
+ ".SUFFIXES", no_depends, no_commands, false);
+
+ // Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make.
+ std::vector<std::string> depends;
+ depends.push_back(".hpux_make_needs_suffix_list");
+ this->WriteMakeRule(makefileStream, 0,
+ ".SUFFIXES", depends, no_commands, false);
+
// Write special target to silence make output. This must be after
// the default target in case VERBOSE is set (which changes the
// name). The setting of CMAKE_VERBOSE_MAKEFILE to ON will cause a
// "VERBOSE=1" to be added as a make variable which will change the
// name of this special target. This gives a make-time choice to
// the user.
- std::vector<std::string> commands;
- std::vector<std::string> no_depends;
- commands.clear();
if((this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
|| (this->ForceVerboseMakefiles))
{
@@ -690,21 +737,18 @@ cmLocalUnixMakefileGenerator3
"Suppress display of executed commands.",
"$(VERBOSE).SILENT",
no_depends,
- commands, false);
+ no_commands, false);
}
- // Special target to cleanup operation of make tool.
- std::vector<std::string> depends;
+ // Special symbolic target that never exists to force dependers to
+ // run their rules.
this->WriteMakeRule
(makefileStream,
- "Disable implicit rules so canoncical targets will work.",
- ".SUFFIXES",
- depends, commands, false);
+ "A target that is always out of date.",
+ "cmake_force", no_depends, no_commands, true);
- // Add a fake suffix to keep HP happy. Must be max 32 chars for SGI make.
- depends.push_back(".hpux_make_needs_suffix_list");
- this->WriteMakeRule(makefileStream, 0,
- ".SUFFIXES", depends, commands, false);
+ // Variables for reference by other rules.
+ this->WriteMakeVariables(makefileStream);
}
//----------------------------------------------------------------------------
@@ -747,8 +791,6 @@ void cmLocalUnixMakefileGenerator3
no_depends,
commands, true);
}
-
- std::vector<std::string> no_commands;
}
@@ -859,6 +901,8 @@ cmLocalUnixMakefileGenerator3
{
dir = workingDir;
}
+ bool escapeOldStyle = cc.GetEscapeOldStyle();
+ bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars();
// Add each command line to the set of commands.
std::vector<std::string> commands1;
@@ -887,15 +931,14 @@ cmLocalUnixMakefileGenerator3
for(unsigned int j=1; j < commandLine.size(); ++j)
{
cmd += " ";
- bool forceOn = cmSystemTools::GetForceUnixPaths();
- if(forceOn && this->WindowsShell)
+ if(escapeOldStyle)
{
- cmSystemTools::SetForceUnixPaths(false);
+ cmd += this->EscapeForShellOldStyle(commandLine[j].c_str());
}
- cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
- if(forceOn && this->WindowsShell)
+ else
{
- cmSystemTools::SetForceUnixPaths(true);
+ cmd += this->EscapeForShell(commandLine[j].c_str(),
+ escapeAllowMakeVars);
}
}
commands1.push_back(cmd);
@@ -1002,25 +1045,15 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
if(color_name.empty())
{
// Use the native echo command.
- cmd = "@echo ";
- if(this->EchoNeedsQuote)
- {
- cmd += "\"";
- }
- cmd += line;
- if(this->EchoNeedsQuote)
- {
- cmd += "\"";
- }
+ cmd = this->NativeEchoCommand;
+ cmd += this->EscapeForShell(line.c_str(), false, true);
}
else
{
// Use cmake to echo the text in color.
cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) ";
cmd += color_name;
- cmd += "\"";
- cmd += line;
- cmd += "\"";
+ cmd += this->EscapeForShell(line.c_str());
}
commands.push_back(cmd);
}
@@ -1158,7 +1191,7 @@ cmLocalUnixMakefileGenerator3
bool cmLocalUnixMakefileGenerator3::ScanDependencies(const char* tgtInfo)
{
// The info file for this target
- std::string const& infoFile = tgtInfo;
+ std::string infoFile = tgtInfo;
// Read the directory information file.
cmMakefile* mf = this->Makefile;
@@ -1221,24 +1254,6 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(const char* tgtInfo)
this->WriteDisclaimer(ruleFileStream);
this->WriteDisclaimer(internalRuleFileStream);
- // Get the set of generated files.
- std::vector<std::string> generatedFilesVec;
- if(haveDirectoryInfo)
- {
- if(const char* generated = mf->GetDefinition("CMAKE_GENERATED_FILES"))
- {
- cmSystemTools::ExpandListArgument(generated, generatedFilesVec);
- }
- }
-
- // Sort for efficient lookup.
- std::set<cmStdString> generatedFiles;
- for(std::vector<std::string>::iterator gfi = generatedFilesVec.begin();
- gfi != generatedFilesVec.end(); ++gfi)
- {
- generatedFiles.insert(*gfi);
- }
-
// for each language we need to scan, scan it
const char *langStr = mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES");
std::vector<std::string> langs;
@@ -1289,14 +1304,15 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(const char* tgtInfo)
if(lang == "C" || lang == "CXX" || lang == "RC")
{
std::string includeCacheFileName = dir;
- includeCacheFileName += "/includecache.";
+ includeCacheFileName += "/";
includeCacheFileName += lang;
+ includeCacheFileName += ".includecache";
// TODO: Handle RC (resource files) dependencies correctly.
scanner = new cmDependsC(includes,
includeRegexScan.c_str(),
includeRegexComplain.c_str(),
- generatedFiles, includeCacheFileName);
+ includeCacheFileName);
scanner->SetLocalGenerator(this);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
@@ -1350,7 +1366,6 @@ void cmLocalUnixMakefileGenerator3
::WriteLocalAllRules(std::ostream& ruleFileStream)
{
this->WriteDisclaimer(ruleFileStream);
- this->WriteMakeVariables(ruleFileStream);
// Write the main entry point target. This must be the VERY first
// target so that make with no arguments will run it.
@@ -1369,7 +1384,25 @@ void cmLocalUnixMakefileGenerator3
no_commands, true);
}
+ this->WriteSpecialTargetsTop(ruleFileStream);
+
+ // Include the progress variables for the target.
+ std::string progressFile = cmake::GetCMakeFilesDirectory();
+ progressFile += "/progress.make";
+ std::string progressFileNameFull =
+ this->ConvertToFullPath(progressFile.c_str());
+ ruleFileStream
+ << "# Include the progress variables for this target.\n"
+ << this->IncludeDirective << " "
+ << this->Convert(progressFileNameFull.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::MAKEFILE) << "\n\n";
+
// Write all global targets
+ this->WriteDivider(ruleFileStream);
+ ruleFileStream
+ << "# Targets provided globally by CMake.\n"
+ << "\n";
cmTargets* targets = &(this->Makefile->GetTargets());
cmTargets::iterator glIt;
for ( glIt = targets->begin(); glIt != targets->end(); ++ glIt )
@@ -1410,7 +1443,7 @@ void cmLocalUnixMakefileGenerator3
// Provide a "/fast" version of the target.
depends.clear();
- if(targetName == "install")
+ if((targetName == "install") || (targetName == "install_local"))
{
// Provide a fast install target that does not depend on all
// but has the same command.
@@ -1428,16 +1461,15 @@ void cmLocalUnixMakefileGenerator3
}
}
- this->WriteSpecialTargetsTop(ruleFileStream);
-
std::vector<std::string> depends;
std::vector<std::string> commands;
// Write the all rule.
- std::string dir = this->Makefile->GetStartOutputDirectory();
- dir += "/all";
+ std::string dir;
+ std::string recursiveTarget = this->Makefile->GetStartOutputDirectory();
+ recursiveTarget += "/all";
- dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
+ dir = this->Convert(recursiveTarget.c_str(),HOME_OUTPUT,MAKEFILE);
depends.push_back("cmake_check_build_system");
@@ -1456,7 +1488,7 @@ void cmLocalUnixMakefileGenerator3
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
mf2Dir += "Makefile2";
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
- dir.c_str()));
+ recursiveTarget.c_str()));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
this->Makefile->GetStartOutputDirectory());
@@ -1473,13 +1505,13 @@ void cmLocalUnixMakefileGenerator3
depends, commands, true);
// Write the clean rule.
- dir = this->Makefile->GetStartOutputDirectory();
- dir += "/clean";
- dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
+ recursiveTarget = this->Makefile->GetStartOutputDirectory();
+ recursiveTarget += "/clean";
+ dir = this->Convert(recursiveTarget.c_str(),HOME_OUTPUT,MAKEFILE);
commands.clear();
depends.clear();
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
- dir.c_str()));
+ recursiveTarget.c_str()));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
this->Makefile->GetStartOutputDirectory());
@@ -1492,9 +1524,9 @@ void cmLocalUnixMakefileGenerator3
depends, commands, true);
// Write the preinstall rule.
- dir = this->Makefile->GetStartOutputDirectory();
- dir += "/preinstall";
- dir = this->Convert(dir.c_str(), HOME_OUTPUT,MAKEFILE);
+ recursiveTarget = this->Makefile->GetStartOutputDirectory();
+ recursiveTarget += "/preinstall";
+ dir = this->Convert(recursiveTarget.c_str(), HOME_OUTPUT,MAKEFILE);
commands.clear();
depends.clear();
const char* noall =
@@ -1510,7 +1542,7 @@ void cmLocalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system");
}
commands.push_back
- (this->GetRecursiveMakeCall(mf2Dir.c_str(), dir.c_str()));
+ (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget.c_str()));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
this->Makefile->GetStartOutputDirectory());
@@ -1884,19 +1916,3 @@ void cmLocalUnixMakefileGenerator3
}
}
}
-
-//----------------------------------------------------------------------------
-const char*
-cmLocalUnixMakefileGenerator3
-::GetSourceFileLanguage(const cmSourceFile& source)
-{
- const char* lang = source.GetProperty("LANGUAGE");
- if ( lang )
- {
- return lang;
- }
- // Identify the language of the source file.
- return (this->GlobalGenerator
- ->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
-}
-
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index e7b60ba89a..e3b457a913 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -73,7 +73,8 @@ public:
const char* target,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
- bool symbolic);
+ bool symbolic,
+ bool in_help = false);
// write the main variables used by the makefiles
void WriteMakeVariables(std::ostream& makefileStream);
@@ -96,9 +97,6 @@ public:
void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; }
std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; }
- /** Set whether the echo command needs its argument quoted. */
- void SetEchoNeedsQuote(bool b) { this->EchoNeedsQuote = b; }
-
/**
* Set to true if the shell being used is the windows shell.
* This controls if statements in the makefile and the SHELL variable.
@@ -107,6 +105,13 @@ public:
void SetWindowsShell(bool v) {this->WindowsShell = v;}
/**
+ * Set to true if the shell being used is the MSYS shell.
+ * This controls if statements in the makefile and the SHELL variable.
+ * The default is false.
+ */
+ void SetMSYSShell(bool v) {this->MSYSShell = v;}
+
+ /**
* If set to true, then NULL is set to nil for non Windows_NT.
* This uses make syntax used by nmake and borland.
* The default is false.
@@ -126,6 +131,14 @@ public:
void SetSilentNoColon(bool v) {this->SilentNoColon = v;}
/**
+ * Set the command to use for native make shell echo. The value
+ * should include all parts of the command up to the beginning of
+ * the message (including a whitespace separator).
+ */
+ void SetNativeEchoCommand(const char* cmd)
+ { this->NativeEchoCommand = cmd; }
+
+ /**
* Set the string used to include one makefile into another default
* is include.
*/
@@ -174,12 +187,6 @@ public:
// cleanup the name of a potential target
std::string ConvertToMakeTarget(const char* tgt);
-
- const char* GetSourceFileLanguage(const cmSourceFile& source);
-
-
-
-
/** Called from command-line hook to scan dependencies. */
virtual bool ScanDependencies(const char* tgtInfo);
@@ -208,13 +215,36 @@ public:
// write the target rules for the local Makefile into the stream
void WriteLocalAllRules(std::ostream& ruleFileStream);
- std::map<cmStdString,std::vector<cmTarget *> > GetLocalObjectFiles()
+ struct LocalObjectEntry
+ {
+ cmTarget* Target;
+ std::string Language;
+ LocalObjectEntry(): Target(0), Language() {}
+ LocalObjectEntry(cmTarget* t, const char* lang):
+ Target(t), Language(lang) {}
+ };
+ class LocalObjectInfo: public std::vector<LocalObjectEntry> {};
+ std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles()
{ return this->LocalObjectFiles;}
+ std::vector<cmStdString> const& GetLocalHelp() { return this->LocalHelp; }
+
// return info about progress actions
unsigned long GetNumberOfProgressActions();
unsigned long GetNumberOfProgressActionsForTarget(const char *);
+ /** Get whether to create rules to generate preprocessed and
+ assembly sources. This could be converted to a variable lookup
+ later. */
+ bool GetCreatePreprocessedSourceRules()
+ {
+ return !this->SkipPreprocessedSourceRules;
+ }
+ bool GetCreateAssemblySourceRules()
+ {
+ return !this->SkipAssemblySourceRules;
+ }
+
protected:
// these two methods just compute reasonable values for LibraryOutputPath
// and ExecutableOutputPath
@@ -223,6 +253,7 @@ protected:
void WriteLocalMakefile();
+
// write the target rules for the local Makefile into the stream
void WriteLocalMakefileTargets(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted);
@@ -267,6 +298,9 @@ protected:
void WriteTargetRequiresRule(std::ostream& ruleFileStream,
cmTarget& target,
const std::vector<std::string>& objects);
+ void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
+ const char* comment, const char* output,
+ LocalObjectInfo const& targets);
std::string GetObjectFileName(cmTarget& target,
const cmSourceFile& source,
@@ -306,12 +340,11 @@ private:
std::string ExecutableOutputPath;
std::string LibraryOutputPath;
std::string ConfigurationName;
+ std::string NativeEchoCommand;
bool DefineWindowsNULL;
bool UnixCD;
bool PassMakeflags;
bool SilentNoColon;
- // Flag for whether echo command needs quotes.
- bool EchoNeedsQuote;
//==========================================================================
std::string HomeRelativeOutputPath;
@@ -320,7 +353,14 @@ private:
beginning of generation to avoid many duplicate lookups. */
bool ColorMakefile;
- std::map<cmStdString,std::vector<cmTarget *> > LocalObjectFiles;
+ /* Copy the setting of CMAKE_SKIP_PREPROCESSED_SOURCE_RULES and
+ CMAKE_SKIP_ASSEMBLY_SOURCE_RULES at the beginning of generation to
+ avoid many duplicate lookups. */
+ bool SkipPreprocessedSourceRules;
+ bool SkipAssemblySourceRules;
+
+ std::map<cmStdString, LocalObjectInfo> LocalObjectFiles;
+ std::vector<cmStdString> LocalHelp;
/* does the work for each target */
std::vector<cmMakefileTargetGenerator *> TargetGenerators;
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 44246f3a4f..cbc438a452 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -223,12 +223,12 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
std::string args;
args = "-H";
args += this->Convert(this->Makefile->GetHomeDirectory(),
- START_OUTPUT, SHELL, true);
+ START_OUTPUT, UNCHANGED, true);
commandLine.push_back(args);
args = "-B";
args +=
this->Convert(this->Makefile->GetHomeOutputDirectory(),
- START_OUTPUT, SHELL, true);
+ START_OUTPUT, UNCHANGED, true);
commandLine.push_back(args);
std::string configFile =
@@ -461,6 +461,8 @@ void cmLocalVisualStudio6Generator
std::string script =
this->ConstructScript(command->GetCommandLines(),
command->GetWorkingDirectory(),
+ command->GetEscapeOldStyle(),
+ command->GetEscapeAllowMakeVars(),
"\\\n\t");
std::string comment =
this->ConstructComment(*command,
@@ -775,6 +777,8 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
}
customRuleCode += this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(),
+ cr->GetEscapeOldStyle(),
+ cr->GetEscapeAllowMakeVars(),
prelink_newline);
}
for (std::vector<cmCustomCommand>::const_iterator cr =
@@ -787,6 +791,8 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
}
customRuleCode += this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(),
+ cr->GetEscapeOldStyle(),
+ cr->GetEscapeAllowMakeVars(),
prelink_newline);
}
if(prelink_total > 0)
@@ -814,6 +820,8 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
}
customRuleCode += this->ConstructScript(cr->GetCommandLines(),
cr->GetWorkingDirectory(),
+ cr->GetEscapeOldStyle(),
+ cr->GetEscapeAllowMakeVars(),
postbuild_newline);
}
if(postbuild_total > 0)
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 28f930a12b..72db6bc072 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -44,9 +44,45 @@ void cmLocalVisualStudio7Generator::Generate()
lang.insert("IDL");
lang.insert("DEF");
this->CreateCustomTargetsAndCommands(lang);
+ this->FixGlobalTargets();
this->OutputVCProjFile();
}
+void cmLocalVisualStudio7Generator::FixGlobalTargets()
+{
+ // Visual Studio .NET 2003 Service Pack 1 will not run post-build
+ // commands for targets in which no sources are built. Add dummy
+ // rules to force these targets to build.
+ cmTargets &tgts = this->Makefile->GetTargets();
+ for(cmTargets::iterator l = tgts.begin();
+ l != tgts.end(); l++)
+ {
+ cmTarget& tgt = l->second;
+ if(tgt.GetType() == cmTarget::GLOBAL_TARGET)
+ {
+ std::vector<std::string> no_depends;
+ cmCustomCommandLine force_command;
+ force_command.push_back(";");
+ cmCustomCommandLines force_commands;
+ force_commands.push_back(force_command);
+ const char* no_main_dependency = 0;
+ std::string force = this->Makefile->GetStartOutputDirectory();
+ force += cmake::GetCMakeFilesDirectory();
+ force += "/";
+ force += tgt.GetName();
+ force += "_force";
+ this->Makefile->AddCustomCommandToOutput(force.c_str(), no_depends,
+ no_main_dependency,
+ force_commands, " ", 0, true);
+ if(cmSourceFile* file =
+ this->Makefile->GetSourceFileWithOutput(force.c_str()))
+ {
+ tgt.GetSourceFiles().push_back(file);
+ }
+ }
+ }
+}
+
// TODO
// for CommandLine= need to repleace quotes with &quot
// write out configurations
@@ -182,12 +218,12 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule(cmTarget& tgt)
std::string args;
args = "-H";
args += this->Convert(this->Makefile->GetHomeDirectory(),
- START_OUTPUT, SHELL, true);
+ START_OUTPUT, UNCHANGED, true);
commandLine.push_back(args);
args = "-B";
args +=
this->Convert(this->Makefile->GetHomeOutputDirectory(),
- START_OUTPUT, SHELL, true);
+ START_OUTPUT, UNCHANGED, true);
commandLine.push_back(args);
std::string configFile =
@@ -326,6 +362,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
{
// option flags (some flags map to the same option)
+ {"GenerateManifest", "MANIFEST:NO", "disable manifest generation", "FALSE"},
+ {"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE"},
{"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1"},
{"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2"},
{0,0,0,0 }
@@ -527,7 +565,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
flagMap.find("DebugInformationFormat");
if(mi != flagMap.end() && mi->second != "1")
{
- fout << "\t\t\t\tProgramDatabaseFileName=\""
+ fout << "\t\t\t\tProgramDataBaseFileName=\""
<< this->LibraryOutputPath
<< "$(OutDir)/" << libName << ".pdb\"\n";
}
@@ -572,6 +610,17 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
fout << "\t\t\t\tProxyFileName=\"$(InputName)_p.c\"/>\n";
// end of <Tool Name=VCMIDLTool
+ // If we are building a version 8 project file, add a flag telling the
+ // manifest tool to use a workaround for FAT32 file systems, which can cause
+ // an empty manifest to be embedded into the resulting executable.
+ // See CMake bug #2617.
+ if ( this->Version == 8 )
+ {
+ fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCManifestTool\"\n"
+ << "\t\t\t\tUseFAT32Workaround=\"true\"\n"
+ << "\t\t\t/>\n";
+ }
+
this->OutputTargetRules(fout, target, libName);
this->OutputBuildTool(fout, configName, libName, target);
fout << "\t\t</Configuration>\n";
@@ -765,7 +814,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
temp += "$(OutDir)/";
temp += libName;
temp += ".pdb";
- fout << "\t\t\t\tProgramDatabaseFile=\"" <<
+ fout << "\t\t\t\tProgramDataBaseFile=\"" <<
this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
if(strcmp(configName, "Debug") == 0
|| strcmp(configName, "RelWithDebInfo") == 0)
@@ -844,7 +893,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, linkDirs);
fout << "\"\n";
- fout << "\t\t\t\tProgramDatabaseFile=\"" << this->LibraryOutputPath
+ fout << "\t\t\t\tProgramDataBaseFile=\"" << this->LibraryOutputPath
<< "$(OutDir)\\" << libName << ".pdb\"\n";
if(strcmp(configName, "Debug") == 0
|| strcmp(configName, "RelWithDebInfo") == 0)
@@ -982,8 +1031,20 @@ void cmLocalVisualStudio7Generator::OutputDefineFlags(const char* flags,
// Double-quotes in the value of the definition must be escaped
// with a backslash. The entire definition should be quoted in
// the generated xml attribute to avoid confusing the VS parser.
- cmSystemTools::ReplaceString(define, "\"", "\\&quot;");
+ define = this->EscapeForXML(define.c_str());
+ // if the define has something in it that is not a letter or a number
+ // then quote it
+ if(define.
+ find_first_not_of(
+ "-_abcdefghigklmnopqrstuvwxyz1234567890ABCDEFGHIGKLMNOPQRSTUVWXYZ")
+ != define.npos)
+ {
fout << "&quot;" << define << "&quot;,";
+ }
+ else
+ {
+ fout << define << ",";
+ }
if(!done)
{
pos = defs.find("-D", nextpos);
@@ -1145,7 +1206,9 @@ void cmLocalVisualStudio7Generator
// Construct the entire set of commands in one string.
std::string script =
this->ConstructScript(command->GetCommandLines(),
- command->GetWorkingDirectory());
+ command->GetWorkingDirectory(),
+ command->GetEscapeOldStyle(),
+ command->GetEscapeAllowMakeVars());
std::string comment = this->ConstructComment(*command);
const char* flags = compileFlags.size() ? compileFlags.c_str(): 0;
this->WriteCustomRule(fout, source.c_str(), script.c_str(),
@@ -1266,16 +1329,30 @@ WriteCustomRule(std::ostream& fout,
<< "\t\t\t\t\tCommandLine=\""
<< this->EscapeForXML(command) << "\"\n"
<< "\t\t\t\t\tAdditionalDependencies=\"";
+ if(depends.empty())
+ {
+ // There are no real dependencies. Produce an artificial one to
+ // make sure the rule runs reliably.
+ if(!cmSystemTools::FileExists(source))
+ {
+ std::ofstream depout(source);
+ depout << "Artificial dependency for a custom command.\n";
+ }
+ fout << this->ConvertToXMLOutputPath(source);
+ }
+ else
+ {
// Write out the dependencies for the rule.
std::string temp;
for(std::vector<std::string>::const_iterator d = depends.begin();
d != depends.end(); ++d)
{
- // Lookup the real name of the dependency in case it is a CMake target.
+ // Get the real name of the dependency in case it is a CMake target.
std::string dep = this->GetRealDependency(d->c_str(), i->c_str());
fout << this->ConvertToXMLOutputPath(dep.c_str())
<< ";";
}
+ }
fout << "\"\n";
fout << "\t\t\t\t\tOutputs=\"";
if(outputs.empty())
@@ -1339,7 +1416,10 @@ void cmLocalVisualStudio7Generator
init = true;
}
std::string script =
- this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory());
+ this->ConstructScript(cr->GetCommandLines(),
+ cr->GetWorkingDirectory(),
+ cr->GetEscapeOldStyle(),
+ cr->GetEscapeAllowMakeVars());
fout << this->EscapeForXML(script.c_str()).c_str();
}
if (init)
@@ -1360,8 +1440,11 @@ void cmLocalVisualStudio7Generator
fout << "\nCommandLine=\"";
init = true;
}
- std::string script = this->ConstructScript(cr->GetCommandLines(),
- cr->GetWorkingDirectory());
+ std::string script =
+ this->ConstructScript(cr->GetCommandLines(),
+ cr->GetWorkingDirectory(),
+ cr->GetEscapeOldStyle(),
+ cr->GetEscapeAllowMakeVars());
fout << this->EscapeForXML(script.c_str()).c_str();
}
if (init)
@@ -1383,7 +1466,10 @@ void cmLocalVisualStudio7Generator
init = true;
}
std::string script =
- this->ConstructScript(cr->GetCommandLines(), cr->GetWorkingDirectory());
+ this->ConstructScript(cr->GetCommandLines(),
+ cr->GetWorkingDirectory(),
+ cr->GetEscapeOldStyle(),
+ cr->GetEscapeAllowMakeVars());
fout << this->EscapeForXML(script.c_str()).c_str();
}
if (init)
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index ad81085e3b..d52cc63a32 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -71,6 +71,7 @@ private:
std::string& flags);
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
+ void FixGlobalTargets();
void OutputVCProjFile();
void WriteVCProjHeader(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index b4ab9e240f..5a6df53702 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -23,6 +23,8 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator()
{
+ this->WindowsShell = true;
+ this->WindowsVSIDE = true;
}
//----------------------------------------------------------------------------
@@ -31,13 +33,32 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
}
//----------------------------------------------------------------------------
+bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf)
+{
+ // Identify the language of the source file.
+ if(const char* lang = this->GetSourceFileLanguage(*sf))
+ {
+ // Check whether this source will actually be compiled.
+ return (!sf->GetCustomCommand() &&
+ !sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
+ !sf->GetPropertyAsBool("EXTERNAL_OBJECT"));
+ }
+ else
+ {
+ // Unknown source file language. Assume it will not be compiled.
+ return false;
+ }
+}
+
+//----------------------------------------------------------------------------
void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
(std::vector<cmSourceGroup> const& sourceGroups)
{
// Clear the current set of requirements.
this->NeedObjectName.clear();
- // Count the number of object files with each name.
+ // Count the number of object files with each name. Note that
+ // windows file names are not case sensitive.
std::map<cmStdString, int> objectNameCounts;
for(unsigned int i = 0; i < sourceGroups.size(); ++i)
{
@@ -46,14 +67,13 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
for(std::vector<const cmSourceFile*>::const_iterator s = srcs.begin();
s != srcs.end(); ++s)
{
- const cmSourceFile& sf = *(*s);
- if(!sf.GetCustomCommand() &&
- !sf.GetPropertyAsBool("HEADER_FILE_ONLY") &&
- !sf.GetPropertyAsBool("EXTERNAL_OBJECT"))
+ const cmSourceFile* sf = *s;
+ if(this->SourceFileCompiles(sf))
{
std::string objectName =
+ cmSystemTools::LowerCase(
cmSystemTools::GetFilenameWithoutLastExtension(
- sf.GetFullPath().c_str());
+ sf->GetFullPath().c_str()));
objectName += ".obj";
objectNameCounts[objectName] += 1;
}
@@ -70,13 +90,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
s != srcs.end(); ++s)
{
const cmSourceFile* sf = *s;
- if(!sf->GetCustomCommand() &&
- !sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
- !sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
+ if(this->SourceFileCompiles(sf))
{
std::string objectName =
+ cmSystemTools::LowerCase(
cmSystemTools::GetFilenameWithoutLastExtension(
- sf->GetFullPath().c_str());
+ sf->GetFullPath().c_str()));
objectName += ".obj";
if(objectNameCounts[objectName] > 1)
{
@@ -86,3 +105,63 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
}
}
}
+
+//----------------------------------------------------------------------------
+std::string
+cmLocalVisualStudioGenerator
+::ConstructScript(const cmCustomCommandLines& commandLines,
+ const char* workingDirectory,
+ bool escapeOldStyle,
+ bool escapeAllowMakeVars,
+ const char* newline)
+{
+ // Store the script in a string.
+ std::string script;
+ if(workingDirectory)
+ {
+ script += "cd ";
+ script += this->Convert(workingDirectory, START_OUTPUT, SHELL);
+ script += newline;
+ }
+ // for visual studio IDE add extra stuff to the PATH
+ // if CMAKE_MSVCIDE_RUN_PATH is set.
+ if(this->Makefile->GetDefinition("MSVC_IDE"))
+ {
+ const char* extraPath =
+ this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
+ if(extraPath)
+ {
+ script += "set PATH=";
+ script += extraPath;
+ script += ";%PATH%";
+ script += newline;
+ }
+ }
+ // Write each command on a single line.
+ for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
+ cl != commandLines.end(); ++cl)
+ {
+ // Start with the command name.
+ const cmCustomCommandLine& commandLine = *cl;
+ script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
+
+ // Add the arguments.
+ for(unsigned int j=1;j < commandLine.size(); ++j)
+ {
+ script += " ";
+ if(escapeOldStyle)
+ {
+ script += this->EscapeForShellOldStyle(commandLine[j].c_str());
+ }
+ else
+ {
+ script += this->EscapeForShell(commandLine[j].c_str(),
+ escapeAllowMakeVars);
+ }
+ }
+
+ // End the line.
+ script += newline;
+ }
+ return script;
+}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 6fe0034b07..ca9cb6ca61 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -35,8 +35,17 @@ public:
virtual ~cmLocalVisualStudioGenerator();
protected:
+
+ /** Construct a script from the given list of command lines. */
+ std::string ConstructScript(const cmCustomCommandLines& commandLines,
+ const char* workingDirectory,
+ bool escapeOldStyle,
+ bool escapeAllowMakeVars,
+ const char* newline = "\n");
+
// Safe object file name generation.
void ComputeObjectNameRequirements(std::vector<cmSourceGroup> const&);
+ bool SourceFileCompiles(const cmSourceFile* sf);
std::set<const cmSourceFile*> NeedObjectName;
};
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index e4de342be1..db4a4d6a31 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -235,9 +235,14 @@ bool cmMacroHelperCommand::InvokeInitialPass
}
if(!this->Makefile->ExecuteCommand(newLFF))
{
+ const char* filePath = args[0].FilePath;
+ if(!filePath)
+ {
+ filePath = "Unknown";
+ }
cmOStringStream error;
error << "Error in cmake code at\n"
- << args[0].FilePath << ":" << args[0].Line << ":\n"
+ << filePath << ":" << args[0].Line << ":\n"
<< "A command failed during the invocation of macro \""
<< this->Args[0].c_str() << "\".";
cmSystemTools::Error(error.str().c_str());
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index a25a8d4477..951b3c0f17 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -60,7 +60,7 @@ public:
*/
virtual const char* GetTerseDocumentation()
{
- return "Create a directory on the file system.";
+ return "Old directory creation command. Use the FILE command.";
}
/**
@@ -69,12 +69,21 @@ public:
virtual const char* GetFullDocumentation()
{
return
+ "This command has been superceded by the FILE(MAKE_DIRECTORY ...) "
+ "command. "
+ "It is provided for compatibility with older CMake code.\n"
" MAKE_DIRECTORY(directory)\n"
"Creates the specified directory. Full paths should be given. Any "
"parent directories that do not exist will also be created. Use with "
"care.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmMakeDirectoryCommand, cmCommand);
};
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bbcc044447..dacb959ae0 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -63,6 +63,7 @@ cmMakefile::cmMakefile()
this->SourceFileExtensions.push_back( "mm" );
this->HeaderFileExtensions.push_back( "h" );
+ this->HeaderFileExtensions.push_back( "hh" );
this->HeaderFileExtensions.push_back( "h++" );
this->HeaderFileExtensions.push_back( "hm" );
this->HeaderFileExtensions.push_back( "hpp" );
@@ -79,7 +80,7 @@ cmMakefile::cmMakefile()
("Source Files",
"\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|rc|def|r|odl|idl|hpj|bat)$");
this->AddSourceGroup("Header Files",
- "\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
+ "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddSourceGroup("Resources", "\\.plist$");
#endif
@@ -105,6 +106,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf)
this->Tests = mf.Tests;
this->IncludeDirectories = mf.IncludeDirectories;
this->LinkDirectories = mf.LinkDirectories;
+ this->SystemIncludeDirectories = mf.SystemIncludeDirectories;
this->ListFiles = mf.ListFiles;
this->OutputFiles = mf.OutputFiles;
this->LinkLibraries = mf.LinkLibraries;
@@ -553,7 +555,8 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
const cmCustomCommandLines& commandLines,
cmTarget::CustomCommandType type,
const char* comment,
- const char* workingDir)
+ const char* workingDir,
+ bool escapeOldStyle)
{
// Find the target to which to add the custom command.
cmTargets::iterator ti = this->Targets.find(target);
@@ -562,6 +565,7 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
// Add the command to the appropriate build step for the target.
std::vector<std::string> no_output;
cmCustomCommand cc(no_output, depends, commandLines, comment, workingDir);
+ cc.SetEscapeOldStyle(escapeOldStyle);
switch(type)
{
case cmTarget::PRE_BUILD:
@@ -597,7 +601,8 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
const cmCustomCommandLines& commandLines,
const char* comment,
const char* workingDir,
- bool replace)
+ bool replace,
+ bool escapeOldStyle)
{
// Make sure there is at least one output.
if(outputs.empty())
@@ -685,6 +690,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
cmCustomCommand* cc =
new cmCustomCommand(outputs, depends2, commandLines,
comment, workingDir);
+ cc->SetEscapeOldStyle(escapeOldStyle);
file->SetCustomCommand(cc);
}
}
@@ -697,13 +703,14 @@ cmMakefile::AddCustomCommandToOutput(const char* output,
const cmCustomCommandLines& commandLines,
const char* comment,
const char* workingDir,
- bool replace)
+ bool replace,
+ bool escapeOldStyle)
{
std::vector<std::string> outputs;
outputs.push_back(output);
this->AddCustomCommandToOutput(outputs, depends, main_dependency,
commandLines, comment, workingDir,
- replace);
+ replace, escapeOldStyle);
}
//----------------------------------------------------------------------------
@@ -777,7 +784,6 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
//----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
- const char* output,
const std::vector<std::string>& depends,
const char* workingDirectory,
const char* command,
@@ -809,30 +815,53 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
commandLines.push_back(commandLine);
// Call the real signature of this method.
- this->AddUtilityCommand(utilityName, all, output, workingDirectory,
+ this->AddUtilityCommand(utilityName, all, workingDirectory,
depends, commandLines);
}
//----------------------------------------------------------------------------
void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
- const char* output,
const char* workingDirectory,
const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines)
+ const cmCustomCommandLines& commandLines,
+ bool escapeOldStyle, const char* comment)
{
// Create a target instance for this utility.
cmTarget target;
target.SetType(cmTarget::UTILITY, utilityName);
target.SetInAll(all);
target.SetMakefile(this);
+
+ if(!comment)
+ {
+ // Use an empty comment to avoid generation of default comment.
+ comment = "";
+ }
+
// Store the custom command in the target.
- std::vector<std::string> outputs;
- if(output)
+ std::string force = this->GetStartOutputDirectory();
+ force += cmake::GetCMakeFilesDirectory();
+ force += "/";
+ force += utilityName;
+ const char* no_main_dependency = 0;
+ bool no_replace = false;
+ this->AddCustomCommandToOutput(force.c_str(), depends,
+ no_main_dependency,
+ commandLines, comment,
+ workingDirectory, no_replace,
+ escapeOldStyle);
+ target.GetSourceLists().push_back(force);
+
+ // The output is not actually created so mark it symbolic.
+ if(cmSourceFile* sf = this->GetSource(force.c_str()))
+ {
+ sf->SetProperty("SYMBOLIC", "1");
+ }
+ else
{
- outputs.push_back(output);
+ cmSystemTools::Error("Could not get source file entry for ",
+ force.c_str());
}
- cmCustomCommand cc(outputs, depends, commandLines, 0, workingDirectory);
- target.GetPostBuildCommands().push_back(cc);
// Add the target to the set of targets.
cmTargets::iterator it =
@@ -997,6 +1026,7 @@ void cmMakefile::InitializeFromParent()
// copy include paths
this->IncludeDirectories = parent->IncludeDirectories;
+ this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
// define flags
this->DefineFlags = parent->DefineFlags;
@@ -1122,6 +1152,19 @@ void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
}
}
+//----------------------------------------------------------------------------
+void cmMakefile::AddSystemIncludeDirectory(const char* dir)
+{
+ this->SystemIncludeDirectories.insert(dir);
+}
+
+//----------------------------------------------------------------------------
+bool cmMakefile::IsSystemIncludeDirectory(const char* dir)
+{
+ return (this->SystemIncludeDirectories.find(dir) !=
+ this->SystemIncludeDirectories.end());
+}
+
void cmMakefile::AddDefinition(const char* name, const char* value)
{
if (!value )
@@ -1258,7 +1301,8 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
void cmMakefile::AddLibrary(const char* lname, int shared,
- const std::vector<std::string> &srcs)
+ const std::vector<std::string> &srcs,
+ bool in_all)
{
cmTarget target;
switch (shared)
@@ -1280,7 +1324,7 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
// over changes in CMakeLists.txt, making the information stale and
// hence useless.
target.ClearDependencyInformation( *this, lname );
- target.SetInAll(true);
+ target.SetInAll(in_all);
target.GetSourceLists() = srcs;
target.SetMakefile(this);
this->AddGlobalLinkInformation(lname, target);
@@ -1290,11 +1334,12 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
}
cmTarget* cmMakefile::AddExecutable(const char *exeName,
- const std::vector<std::string> &srcs)
+ const std::vector<std::string> &srcs,
+ bool in_all)
{
cmTarget target;
target.SetType(cmTarget::EXECUTABLE, exeName);
- target.SetInAll(true);
+ target.SetInAll(in_all);
target.GetSourceLists() = srcs;
target.SetMakefile(this);
this->AddGlobalLinkInformation(exeName, target);
@@ -1637,7 +1682,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
bool atOnly,
const char* filename,
long line,
- bool removeEmpty) const
+ bool removeEmpty,
+ bool replaceAt) const
{
if ( source.empty() || source.find_first_of("$@\\") == source.npos)
{
@@ -1656,6 +1702,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
parser.SetLineFile(line, filename);
parser.SetEscapeQuotes(escapeQuotes);
parser.SetNoEscapeMode(noEscapes);
+ parser.SetReplaceAtSyntax(replaceAt);
int res = parser.ParseString(source.c_str(), 0);
if ( res )
{
@@ -1906,6 +1953,9 @@ void cmMakefile::AddDefaultDefinitions()
#if defined(__APPLE__)
this->AddDefinition("APPLE", "1");
#endif
+#if defined(__QNXNTO__)
+ this->AddDefinition("QNXNTO", "1");
+#endif
char temp[1024];
sprintf(temp, "%d", cmMakefile::GetMinorVersion());
@@ -1994,7 +2044,8 @@ void cmMakefile::ExpandArguments(
// Expand the variables in the argument.
value = i->Value;
this->ExpandVariablesInString(value, false, false, false,
- i->FilePath, i->Line);
+ i->FilePath, i->Line,
+ false, false);
// If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments.
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 632bf1f079..815e9f289d 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -143,19 +143,22 @@ public:
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
cmTarget::CustomCommandType type,
- const char* comment, const char* workingDir);
+ const char* comment, const char* workingDir,
+ bool escapeOldStyle = true);
void AddCustomCommandToOutput(const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
const char* main_dependency,
const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir,
- bool replace = false);
+ bool replace = false,
+ bool escapeOldStyle = true);
void AddCustomCommandToOutput(const char* output,
const std::vector<std::string>& depends,
const char* main_dependency,
const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir,
- bool replace = false);
+ bool replace = false,
+ bool escapeOldStyle = true);
void AddCustomCommandOldStyle(const char* target,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
@@ -173,14 +176,14 @@ public:
* Add an executable to the build.
*/
cmTarget* AddExecutable(const char *exename,
- const std::vector<std::string> &srcs);
+ const std::vector<std::string> &srcs,
+ bool in_all = true);
/**
* Add a utility to the build. A utiltity target is a command that
* is run every time the target is built.
*/
void AddUtilityCommand(const char* utilityName, bool all,
- const char* output,
const std::vector<std::string>& depends,
const char* workingDirectory,
const char* command,
@@ -189,10 +192,11 @@ public:
const char* arg3=0,
const char* arg4=0);
void AddUtilityCommand(const char* utilityName, bool all,
- const char* output,
const char* workingDirectory,
const std::vector<std::string>& depends,
- const cmCustomCommandLines& commandLines);
+ const cmCustomCommandLines& commandLines,
+ bool escapeOldStyle = true,
+ const char* comment = 0);
/**
* Add a link library to the build.
@@ -283,7 +287,8 @@ public:
* Set the name of the library.
*/
void AddLibrary(const char *libname, int shared,
- const std::vector<std::string> &srcs);
+ const std::vector<std::string> &srcs,
+ bool in_all = true);
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
@@ -436,6 +441,12 @@ public:
this->IncludeDirectories = vec;
}
+ /**
+ * Mark include directories as system directories.
+ */
+ void AddSystemIncludeDirectory(const char* dir);
+ bool IsSystemIncludeDirectory(const char* dir);
+
/** Expand out any arguements in the vector that have ; separated
* strings into multiple arguements. A new vector is created
* containing the expanded versions of all arguments in argsIn.
@@ -566,7 +577,8 @@ public:
bool atOnly = false,
const char* filename = 0,
long line = -1,
- bool removeEmpty = false) const;
+ bool removeEmpty = false,
+ bool replaceAt = true) const;
/**
* Remove any remaining variables in the string. Anything with ${var} or
@@ -734,6 +746,10 @@ protected:
std::vector<std::string> IncludeDirectories;
std::vector<std::string> LinkDirectories;
+ // The set of include directories that are marked as system include
+ // directories.
+ std::set<cmStdString> SystemIncludeDirectories;
+
std::vector<std::string> ListFiles; // list of command files loaded
std::vector<std::string> OutputFiles; // list of command files loaded
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 2f9c0663b6..c8ef4d3a50 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -25,6 +25,12 @@
#include "cmake.h"
//----------------------------------------------------------------------------
+cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator()
+{
+ this->DriveCustomCommandsOnDepends = true;
+}
+
+//----------------------------------------------------------------------------
void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
{
// create the build.make file and directory, put in the common blocks
@@ -272,6 +278,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
exeCleanFiles.push_back(this->Convert(cleanFullName.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
+#ifdef _WIN32
+ // There may be a manifest file for this target. Add it to the
+ // clean set just in case.
+ exeCleanFiles.push_back(this->Convert((cleanFullName+".manifest").c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+#endif
if(cleanRealName != cleanName)
{
exeCleanFiles.push_back(this->Convert(cleanFullRealName.c_str(),
diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h
index f6ffad2beb..269fd5f6ae 100644
--- a/Source/cmMakefileExecutableTargetGenerator.h
+++ b/Source/cmMakefileExecutableTargetGenerator.h
@@ -22,6 +22,8 @@
class cmMakefileExecutableTargetGenerator: public cmMakefileTargetGenerator
{
public:
+ cmMakefileExecutableTargetGenerator();
+
/* the main entry point for this class. Writes the Makefiles associated
with this target */
virtual void WriteRuleFiles();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2c1675584c..d097d6e409 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -27,6 +27,12 @@
#include <memory> // auto_ptr
//----------------------------------------------------------------------------
+cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator()
+{
+ this->DriveCustomCommandsOnDepends = true;
+}
+
+//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
{
// create the build.make file and directory, put in the common blocks
@@ -305,7 +311,41 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Construct a list of files associated with this library that may
// need to be cleaned.
std::vector<std::string> libCleanFiles;
+ if(this->Target->GetPropertyAsBool("CLEAN_DIRECT_OUTPUT"))
{
+ // The user has requested that only the files directly built
+ // by this target be cleaned instead of all possible names.
+ libCleanFiles.push_back(this->Convert(targetFullPath.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ if(targetNameReal != targetName)
+ {
+ libCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(targetNameSO != targetName &&
+ targetNameSO != targetNameReal)
+ {
+ libCleanFiles.push_back(this->Convert(targetFullPathSO.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ if(!targetNameImport.empty() &&
+ targetNameImport != targetName &&
+ targetNameImport != targetNameReal &&
+ targetNameImport != targetNameSO)
+ {
+ libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+ }
+ else
+ {
+ // This target may switch between static and shared based
+ // on a user option or the BUILD_SHARED_LIBS switch. Clean
+ // all possible names.
std::string cleanStaticName;
std::string cleanSharedName;
std::string cleanSharedSOName;
@@ -324,7 +364,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string cleanFullSharedRealName = outpath + cleanSharedRealName;
std::string cleanFullImportName = outpath + cleanImportName;
libCleanFiles.push_back
- (this->Convert(cleanFullStaticName.c_str(),cmLocalGenerator::START_OUTPUT,
+ (this->Convert(cleanFullStaticName.c_str(),
+ cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
if(cleanSharedRealName != cleanStaticName)
{
@@ -358,6 +399,19 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
cmLocalGenerator::UNCHANGED));
}
}
+
+#ifdef _WIN32
+ // There may be a manifest file for this target. Add it to the
+ // clean set just in case.
+ if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
+ {
+ libCleanFiles.push_back(
+ this->Convert((targetFullPath+".manifest").c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED));
+ }
+#endif
+
// Add a command to remove any existing files for this library.
std::vector<std::string> commands1;
this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
@@ -494,19 +548,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string install_name_dir;
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
{
- // Select whether to generate an install_name directory for the
- // install tree or the build tree.
+ // Get the install_name directory for the build tree.
const char* config = this->LocalGenerator->ConfigurationName.c_str();
- if(this->Target->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"))
- {
- install_name_dir =
- this->Target->GetInstallNameDirForInstallTree(config);
- }
- else
- {
- install_name_dir =
- this->Target->GetInstallNameDirForBuildTree(config);
- }
+ install_name_dir = this->Target->GetInstallNameDirForBuildTree(config);
// Set the rule variable replacement value.
if(install_name_dir.empty())
@@ -518,13 +562,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Convert to a path for the native build tool.
install_name_dir =
this->LocalGenerator->Convert(install_name_dir.c_str(),
- cmLocalGenerator::FULL,
+ cmLocalGenerator::NONE,
cmLocalGenerator::SHELL, false);
-
- // The Convert method seems to strip trailing slashes, which should
- // probably be fixed. Since the only platform supporting install_name
- // right now uses forward slashes just add one.
- install_name_dir += "/";
vars.TargetInstallNameDir = install_name_dir.c_str();
}
}
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index 502e35bca0..1194afe803 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -23,6 +23,8 @@ class cmMakefileLibraryTargetGenerator:
public cmMakefileTargetGenerator
{
public:
+ cmMakefileLibraryTargetGenerator();
+
/* the main entry point for this class. Writes the Makefiles associated
with this target */
virtual void WriteRuleFiles();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 35e57cf222..e87e8ab191 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -35,6 +35,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator()
this->BuildFileStream = 0;
this->InfoFileStream = 0;
this->FlagFileStream = 0;
+ this->DriveCustomCommandsOnDepends = false;
}
cmMakefileTargetGenerator *
@@ -58,7 +59,7 @@ cmMakefileTargetGenerator::New(cmLocalUnixMakefileGenerator3 *lg,
break;
default:
return result;
- break;
+ // break; /* unreachable */
}
result->TargetName = tgtName;
@@ -105,7 +106,6 @@ void cmMakefileTargetGenerator::CreateRuleFile()
}
this->LocalGenerator->WriteDisclaimer(*this->BuildFileStream);
this->LocalGenerator->WriteSpecialTargetsTop(*this->BuildFileStream);
- this->LocalGenerator->WriteMakeVariables(*this->BuildFileStream);
}
//----------------------------------------------------------------------------
@@ -350,7 +350,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
}
this->LocalGenerator->LocalObjectFiles[objNoTargetDir].
- push_back(this->Target);
+ push_back(
+ cmLocalUnixMakefileGenerator3::LocalObjectEntry(this->Target, lang)
+ );
}
//----------------------------------------------------------------------------
@@ -495,6 +497,106 @@ cmMakefileTargetGenerator
relativeObj.c_str(),
depends, commands, false);
+ bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) ||
+ (strcmp(lang, "CXX") == 0));
+ bool do_preprocess_rules = lang_is_c_or_cxx &&
+ this->LocalGenerator->GetCreatePreprocessedSourceRules();
+ bool do_assembly_rules = lang_is_c_or_cxx &&
+ this->LocalGenerator->GetCreateAssemblySourceRules();
+ if(do_preprocess_rules || do_assembly_rules)
+ {
+ std::vector<std::string> force_depends;
+ force_depends.push_back("cmake_force");
+ std::string::size_type dot_pos = relativeObj.rfind(".");
+ std::string relativeObjBase = relativeObj.substr(0, dot_pos);
+
+ if(do_preprocess_rules)
+ {
+ commands.clear();
+ std::string relativeObjI = relativeObjBase + ".i";
+
+ std::string preprocessEcho = "Preprocessing ";
+ preprocessEcho += lang;
+ preprocessEcho += " source to ";
+ preprocessEcho += relativeObjI;
+ this->LocalGenerator->AppendEcho(
+ commands, preprocessEcho.c_str(),
+ cmLocalUnixMakefileGenerator3::EchoBuild
+ );
+
+ std::string preprocessRuleVar = "CMAKE_";
+ preprocessRuleVar += lang;
+ preprocessRuleVar += "_CREATE_PREPROCESSED_SOURCE";
+ if(const char* preprocessRule =
+ this->Makefile->GetDefinition(preprocessRuleVar.c_str()))
+ {
+ cmSystemTools::ExpandListArgument(preprocessRule, commands);
+
+ vars.PreprocessedSource = relativeObjI.c_str();
+
+ // Expand placeholders in the commands.
+ for(std::vector<std::string>::iterator i = commands.begin();
+ i != commands.end(); ++i)
+ {
+ this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ }
+ }
+ else
+ {
+ std::string cmd = "$(CMAKE_COMMAND) -E cmake_unimplemented_variable ";
+ cmd += preprocessRuleVar;
+ commands.push_back(cmd);
+ }
+
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ relativeObjI.c_str(),
+ force_depends, commands, false);
+ }
+
+ if(do_assembly_rules)
+ {
+ commands.clear();
+ std::string relativeObjS = relativeObjBase + ".s";
+
+ std::string assemblyEcho = "Compiling ";
+ assemblyEcho += lang;
+ assemblyEcho += " source to assembly ";
+ assemblyEcho += relativeObjS;
+ this->LocalGenerator->AppendEcho(
+ commands, assemblyEcho.c_str(),
+ cmLocalUnixMakefileGenerator3::EchoBuild
+ );
+
+ std::string assemblyRuleVar = "CMAKE_";
+ assemblyRuleVar += lang;
+ assemblyRuleVar += "_CREATE_ASSEMBLY_SOURCE";
+ if(const char* assemblyRule =
+ this->Makefile->GetDefinition(assemblyRuleVar.c_str()))
+ {
+ cmSystemTools::ExpandListArgument(assemblyRule, commands);
+
+ vars.AssemblySource = relativeObjS.c_str();
+
+ // Expand placeholders in the commands.
+ for(std::vector<std::string>::iterator i = commands.begin();
+ i != commands.end(); ++i)
+ {
+ this->LocalGenerator->ExpandRuleVariables(*i, vars);
+ }
+ }
+ else
+ {
+ std::string cmd = "$(CMAKE_COMMAND) -E cmake_unimplemented_variable ";
+ cmd += assemblyRuleVar;
+ commands.push_back(cmd);
+ }
+
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
+ relativeObjS.c_str(),
+ force_depends, commands, false);
+ }
+ }
+
// If the language needs provides-requires mode, create the
// corresponding targets.
std::string objectRequires = relativeObj;
@@ -673,6 +775,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
cmLocalGenerator::FULL, cmLocalGenerator::SHELL);
commands.push_back(depCmd.str());
+ // Make sure all custom command outputs in this target are built.
+ if(this->DriveCustomCommandsOnDepends)
+ {
+ this->DriveCustomCommands(depends);
+ }
+
// Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
depMark.c_str(),
@@ -680,6 +788,29 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
}
//----------------------------------------------------------------------------
+void
+cmMakefileTargetGenerator
+::DriveCustomCommands(std::vector<std::string>& depends)
+{
+ // Depend on all custom command outputs.
+ const std::vector<cmSourceFile*>& sources =
+ this->Target->GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
+ source != sources.end(); ++source)
+ {
+ if(cmCustomCommand* cc = (*source)->GetCustomCommand())
+ {
+ const std::vector<std::string>& outputs = cc->GetOutputs();
+ for(std::vector<std::string>::const_iterator o = outputs.begin();
+ o != outputs.end(); ++o)
+ {
+ depends.push_back(*o);
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void cmMakefileTargetGenerator
::WriteObjectDependRules(cmSourceFile& source,
std::vector<std::string>& depends)
@@ -731,12 +862,25 @@ void cmMakefileTargetGenerator
std::vector<std::string> depends;
this->LocalGenerator->AppendCustomDepend(depends, cc);
+ // Check whether we need to bother checking for a symbolic output.
+ bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
+
// Write the rule.
const std::vector<std::string>& outputs = cc.GetOutputs();
std::vector<std::string>::const_iterator o = outputs.begin();
+ {
+ bool symbolic = false;
+ if(need_symbolic)
+ {
+ if(cmSourceFile* sf = this->Makefile->GetSource(o->c_str()))
+ {
+ symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+ }
+ }
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
o->c_str(), depends, commands,
- false);
+ symbolic);
+ }
// If the rule has multiple outputs, add a rule for the extra
// outputs to just depend on the first output with no command. Also
@@ -756,9 +900,17 @@ void cmMakefileTargetGenerator
}
for(++o; o != outputs.end(); ++o)
{
+ bool symbolic = false;
+ if(need_symbolic)
+ {
+ if(cmSourceFile* sf = this->Makefile->GetSource(o->c_str()))
+ {
+ symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+ }
+ }
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
o->c_str(), depends, commands,
- false);
+ symbolic);
gg->AddMultipleOutputPair(o->c_str(), depends[0].c_str());
}
}
@@ -896,9 +1048,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
bool relink)
{
// Compute the name of the driver target.
- std::string dir = this->Makefile->GetStartOutputDirectory();
- dir += "/";
- dir += this->LocalGenerator->GetTargetDirectory(*this->Target);
+ std::string dir =
+ this->LocalGenerator->GetRelativeTargetDirectory(*this->Target);
std::string buildTargetRuleName = dir;
buildTargetRuleName += relink?"/preinstall":"/build";
buildTargetRuleName = this->Convert(buildTargetRuleName.c_str(),
@@ -924,20 +1075,9 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
comment = "Rule to build all files generated by this target.";
// Make sure all custom command outputs in this target are built.
- const std::vector<cmSourceFile*>& sources =
- this->Target->GetSourceFiles();
- for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
- source != sources.end(); ++source)
- {
- if(cmCustomCommand* cc = (*source)->GetCustomCommand())
- {
- const std::vector<std::string>& outputs = cc->GetOutputs();
- for(std::vector<std::string>::const_iterator o = outputs.begin();
- o != outputs.end(); ++o)
+ if(!this->DriveCustomCommandsOnDepends)
{
- depends.push_back(*o);
- }
- }
+ this->DriveCustomCommands(depends);
}
}
@@ -1012,7 +1152,7 @@ void cmMakefileTargetGenerator
// Don't emit the same library twice for this target.
if(emitted.insert(lib->first).second)
{
- // Depend only on other CMake targets.
+ // Depend on other CMake targets.
if(cmTarget* tgt =
this->GlobalGenerator->FindTarget(0, lib->first.c_str()))
{
@@ -1022,6 +1162,11 @@ void cmMakefileTargetGenerator
depends.push_back(location);
}
}
+ // depend on full path libs as well
+ else if(cmSystemTools::FileIsFullPath(lib->first.c_str()))
+ {
+ depends.push_back(lib->first.c_str());
+ }
}
}
}
@@ -1089,6 +1234,7 @@ void cmMakefileTargetGenerator::WriteProgressVariables(unsigned long total,
}
*progressFileStream << "\n";
}
+ *progressFileStream << "\n";
current += this->NumberOfProgressActions;
delete progressFileStream;
}
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 02223e6ded..dd6bbe62f6 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -107,6 +107,8 @@ protected:
// write the driver rule to build target outputs
void WriteTargetDriverRule(const char* main_output, bool relink);
+ void DriveCustomCommands(std::vector<std::string>& depends);
+
// Return the a string with -F flags on apple
std::string GetFrameworkFlags();
@@ -122,6 +124,8 @@ protected:
cmGlobalGenerator *GlobalGenerator;
cmMakefile *Makefile;
+ bool DriveCustomCommandsOnDepends;
+
// the full path to the build file
std::string BuildFileName;
std::string BuildFileNameFull;
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 5856b51b33..fdcba740b6 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -59,9 +59,15 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
if (send_error || fatal_error)
{
- //cmSystemTools::Error(message.c_str());
+ if( !this->Makefile->GetCMakeInstance()->GetDebugOutput())
+ {
+ cmSystemTools::Error(message.c_str());
+ }
+ else
+ {
this->SetError(message.c_str());
}
+ }
else
{
if (status)
@@ -77,6 +83,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
{
cmSystemTools::SetFatalErrorOccured();
}
+ // if debug is on then retru
+ if(this->Makefile->GetCMakeInstance()->GetDebugOutput())
+ {
return (!send_error && !fatal_error);
+ }
+ return true;
}
diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx
index d2be2413e3..bd07f8ac41 100644
--- a/Source/cmOrderLinkDirectories.cxx
+++ b/Source/cmOrderLinkDirectories.cxx
@@ -3,14 +3,63 @@
#include "cmsys/RegularExpression.hxx"
#include <ctype.h>
+//#define CM_ORDER_LINK_DIRECTORIES_DEBUG
//-------------------------------------------------------------------
cmOrderLinkDirectories::cmOrderLinkDirectories()
{
+ this->StartLinkType = LinkUnknown;
+ this->LinkTypeEnabled = false;
this->Debug = false;
}
//-------------------------------------------------------------------
+void
+cmOrderLinkDirectories
+::SetLinkTypeInformation(LinkType start_link_type,
+ const char* static_link_type_flag,
+ const char* shared_link_type_flag)
+{
+ // We can support link type switching only if all needed flags are
+ // known.
+ this->StartLinkType = start_link_type;
+ if(static_link_type_flag && *static_link_type_flag &&
+ shared_link_type_flag && *shared_link_type_flag)
+ {
+ this->LinkTypeEnabled = true;
+ this->StaticLinkTypeFlag = static_link_type_flag;
+ this->SharedLinkTypeFlag = shared_link_type_flag;
+ }
+ else
+ {
+ this->LinkTypeEnabled = false;
+ this->StaticLinkTypeFlag = "";
+ this->SharedLinkTypeFlag = "";
+ }
+}
+
+//-------------------------------------------------------------------
+void cmOrderLinkDirectories::SetCurrentLinkType(LinkType lt)
+{
+ if(this->CurrentLinkType != lt)
+ {
+ this->CurrentLinkType = lt;
+
+ if(this->LinkTypeEnabled)
+ {
+ switch(this->CurrentLinkType)
+ {
+ case LinkStatic:
+ this->LinkItems.push_back(this->StaticLinkTypeFlag); break;
+ case LinkShared:
+ this->LinkItems.push_back(this->SharedLinkTypeFlag); break;
+ default: break;
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------
bool cmOrderLinkDirectories::LibraryInDirectory(const char* desiredLib,
const char* dir,
const char* libIn)
@@ -126,16 +175,76 @@ std::string cmOrderLinkDirectories::NoCaseExpression(const char* str)
void cmOrderLinkDirectories::CreateRegularExpressions()
{
this->SplitFramework.compile("(.*)/(.*)\\.framework$");
- cmStdString libext = "(";
- bool first = true;
- for(std::vector<cmStdString>::iterator i = this->LinkExtensions.begin();
- i != this->LinkExtensions.end(); ++i)
+
+ // Compute a regex to match link extensions.
+ cmStdString libext = this->CreateExtensionRegex(this->LinkExtensions);
+
+ // Create regex to remove any library extension.
+ cmStdString reg("(.*)");
+ reg += libext;
+ this->RemoveLibraryExtension.compile(reg.c_str());
+
+ // Create a regex to match a library name. Match index 1 will be
+ // the prefix if it exists and empty otherwise. Match index 2 will
+ // be the library name. Match index 3 will be the library
+ // extension.
+ reg = "^(";
+ for(std::set<cmStdString>::iterator p = this->LinkPrefixes.begin();
+ p != this->LinkPrefixes.end(); ++p)
+ {
+ reg += *p;
+ reg += "|";
+ }
+ reg += ")";
+ reg += "([^/]*)";
+
+ // Create a regex to match any library name.
+ cmStdString reg_any = reg;
+ reg_any += libext;
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "any regex [%s]\n", reg_any.c_str());
+#endif
+ this->ExtractAnyLibraryName.compile(reg_any.c_str());
+
+ // Create a regex to match static library names.
+ if(!this->StaticLinkExtensions.empty())
{
- if(!first)
+ cmStdString reg_static = reg;
+ reg_static += this->CreateExtensionRegex(this->StaticLinkExtensions);
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "static regex [%s]\n", reg_static.c_str());
+#endif
+ this->ExtractStaticLibraryName.compile(reg_static.c_str());
+ }
+
+ // Create a regex to match shared library names.
+ if(!this->SharedLinkExtensions.empty())
{
- libext += "|";
+ cmStdString reg_shared = reg;
+ reg_shared += this->CreateExtensionRegex(this->SharedLinkExtensions);
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "shared regex [%s]\n", reg_shared.c_str());
+#endif
+ this->ExtractSharedLibraryName.compile(reg_shared.c_str());
}
- first = false;
+}
+
+//-------------------------------------------------------------------
+std::string
+cmOrderLinkDirectories::CreateExtensionRegex(
+ std::vector<cmStdString> const& exts)
+{
+ // Build a list of extension choices.
+ cmStdString libext = "(";
+ const char* sep = "";
+ for(std::vector<cmStdString>::const_iterator i = exts.begin();
+ i != exts.end(); ++i)
+ {
+ // Separate this choice from the previous one.
+ libext += sep;
+ sep = "|";
+
+ // Store this extension choice with the "." escaped.
libext += "\\";
#if defined(_WIN32) && !defined(__CYGWIN__)
libext += this->NoCaseExpression(i->c_str());
@@ -143,41 +252,74 @@ void cmOrderLinkDirectories::CreateRegularExpressions()
libext += *i;
#endif
}
+
+ // Finish the list.
libext += ").*";
- cmStdString reg("(.*)");
- reg += libext;
- this->RemoveLibraryExtension.compile(reg.c_str());
- reg = "";
- if(this->LinkPrefix.size())
- {
- reg = "^";
- reg += this->LinkPrefix;
- }
- reg += "([^/]*)";
- reg += libext;
- this->ExtractBaseLibraryName.compile(reg.c_str());
- reg = "([^/]*)";
- reg += libext;
- this->ExtractBaseLibraryNameNoPrefix.compile(reg.c_str());
+ return libext;
}
-
//-------------------------------------------------------------------
void cmOrderLinkDirectories::PrepareLinkTargets()
{
- for(std::vector<cmStdString>::iterator i = this->LinkItems.begin();
- i != this->LinkItems.end(); ++i)
+ std::vector<cmStdString> originalLinkItems = this->LinkItems;
+ this->LinkItems.clear();
+ this->CurrentLinkType = this->StartLinkType;
+ for(std::vector<cmStdString>::iterator i = originalLinkItems.begin();
+ i != originalLinkItems.end(); ++i)
+ {
+ // Parse out the prefix, base, and suffix components of the
+ // library name. If the name matches that of a shared or static
+ // library then set the link type accordingly.
+ //
+ // Search for shared library names first because some platforms
+ // have shared libraries with names that match the static library
+ // pattern. For example cygwin and msys use the convention
+ // libfoo.dll.a for import libraries and libfoo.a for static
+ // libraries. On AIX a library with the name libfoo.a can be
+ // shared!
+ if(this->ExtractSharedLibraryName.find(*i))
+ {
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "shared regex matched [%s] [%s] [%s]\n",
+ this->ExtractSharedLibraryName.match(1).c_str(),
+ this->ExtractSharedLibraryName.match(2).c_str(),
+ this->ExtractSharedLibraryName.match(3).c_str());
+#endif
+ this->SetCurrentLinkType(LinkShared);
+ this->LinkItems.push_back(this->ExtractSharedLibraryName.match(2));
+ }
+ else if(this->ExtractStaticLibraryName.find(*i))
{
- // separate the library name from libfoo.a or foo.a
- if(this->ExtractBaseLibraryName.find(*i))
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "static regex matched [%s] [%s] [%s]\n",
+ this->ExtractStaticLibraryName.match(1).c_str(),
+ this->ExtractStaticLibraryName.match(2).c_str(),
+ this->ExtractStaticLibraryName.match(3).c_str());
+#endif
+ this->SetCurrentLinkType(LinkStatic);
+ this->LinkItems.push_back(this->ExtractStaticLibraryName.match(2));
+ }
+ else if(this->ExtractAnyLibraryName.find(*i))
{
- *i = this->ExtractBaseLibraryName.match(1);
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "any regex matched [%s] [%s] [%s]\n",
+ this->ExtractAnyLibraryName.match(1).c_str(),
+ this->ExtractAnyLibraryName.match(2).c_str(),
+ this->ExtractAnyLibraryName.match(3).c_str());
+#endif
+ this->SetCurrentLinkType(this->StartLinkType);
+ this->LinkItems.push_back(this->ExtractAnyLibraryName.match(2));
}
- else if(this->ExtractBaseLibraryNameNoPrefix.find(*i))
+ else
{
- *i = this->ExtractBaseLibraryNameNoPrefix.match(1);
+ this->SetCurrentLinkType(this->StartLinkType);
+ this->LinkItems.push_back(*i);
}
}
+
+ // Restore the original linking type so system runtime libraries are
+ // linked properly.
+ this->SetCurrentLinkType(this->StartLinkType);
}
//-------------------------------------------------------------------
@@ -318,6 +460,9 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder()
for(unsigned int i=0; i < this->RawLinkItems.size(); ++i)
{
bool framework = false;
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "Raw link item [%s]\n", this->RawLinkItems[i].c_str());
+#endif
if(cmSystemTools::FileIsFullPath(this->RawLinkItems[i].c_str()))
{
if(cmSystemTools::FileIsDirectory(this->RawLinkItems[i].c_str()))
@@ -378,6 +523,9 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder()
aLib.File = file;
aLib.Path = dir;
this->FullPathLibraries[aLib.FullPath] = aLib;
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "Storing item [%s]\n", file.c_str());
+#endif
this->LinkItems.push_back(file);
}
}
diff --git a/Source/cmOrderLinkDirectories.h b/Source/cmOrderLinkDirectories.h
index 3f421435c6..a3bc75a6dc 100644
--- a/Source/cmOrderLinkDirectories.h
+++ b/Source/cmOrderLinkDirectories.h
@@ -66,19 +66,28 @@ public:
// should be set from CMAKE_STATIC_LIBRARY_SUFFIX,
// CMAKE_SHARED_LIBRARY_SUFFIX
// CMAKE_LINK_LIBRARY_SUFFIX
- void AddLinkExtension(const char* e)
+ enum LinkType { LinkUnknown, LinkStatic, LinkShared };
+ void AddLinkExtension(const char* e, LinkType type = LinkUnknown)
{
if(e && *e)
{
+ if(type == LinkStatic)
+ {
+ this->StaticLinkExtensions.push_back(e);
+ }
+ if(type == LinkShared)
+ {
+ this->SharedLinkExtensions.push_back(e);
+ }
this->LinkExtensions.push_back(e);
}
}
// should be set from CMAKE_STATIC_LIBRARY_PREFIX
- void SetLinkPrefix(const char* s)
+ void AddLinkPrefix(const char* s)
{
if(s)
{
- this->LinkPrefix = s;
+ this->LinkPrefixes.insert(s);
}
}
// Return any warnings if the exist
@@ -86,6 +95,11 @@ public:
// return a list of all full path libraries
void GetFullPathLibraries(std::vector<cmStdString>& libs);
+ // Provide flags for switching library link type.
+ void SetLinkTypeInformation(LinkType start_link_type,
+ const char* static_link_type_flag,
+ const char* shared_link_type_flag);
+
// structure to hold a full path library link item
struct Library
{
@@ -101,6 +115,7 @@ public:
private:
void CreateRegularExpressions();
+ std::string CreateExtensionRegex(std::vector<cmStdString> const& exts);
void DetermineLibraryPathOrder(std::vector<cmStdString>& searchPaths,
std::vector<cmStdString>& libs,
std::vector<cmStdString>& sortedPaths);
@@ -145,19 +160,31 @@ private:
// This is the set of -L paths unsorted, but unique
std::set<cmStdString> LinkPathSet;
// the names of link extensions
+ std::vector<cmStdString> StaticLinkExtensions;
+ std::vector<cmStdString> SharedLinkExtensions;
std::vector<cmStdString> LinkExtensions;
// the names of link prefixes
- cmStdString LinkPrefix;
+ std::set<cmStdString> LinkPrefixes;
// set of directories that can not be put in the correct order
std::set<cmStdString> ImpossibleDirectories;
// Name of target
cmStdString TargetName;
// Subdirectory used for this configuration if any.
cmStdString ConfigSubdir;
+
+ // Link type adjustment.
+ LinkType StartLinkType;
+ LinkType CurrentLinkType;
+ cmStdString StaticLinkTypeFlag;
+ cmStdString SharedLinkTypeFlag;
+ bool LinkTypeEnabled;
+ void SetCurrentLinkType(LinkType lt);
+
// library regular expressions
cmsys::RegularExpression RemoveLibraryExtension;
- cmsys::RegularExpression ExtractBaseLibraryName;
- cmsys::RegularExpression ExtractBaseLibraryNameNoPrefix;
+ cmsys::RegularExpression ExtractStaticLibraryName;
+ cmsys::RegularExpression ExtractSharedLibraryName;
+ cmsys::RegularExpression ExtractAnyLibraryName;
cmsys::RegularExpression SplitFramework;
bool Debug;
};
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index a1de0101b9..7062770528 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -56,7 +56,7 @@ public:
*/
virtual const char* GetTerseDocumentation()
{
- return "Remove a value from a list in a variable.";
+ return "Old list item removal command. Use the LIST command.";
}
/**
@@ -65,12 +65,20 @@ public:
virtual const char* GetFullDocumentation()
{
return
+ "This command has been superceded by the LIST(REMOVE ...) command. "
+ "It is provided for compatibility with older CMake code.\n"
" REMOVE(VAR VALUE VALUE ...)\n"
"Removes VALUE from the variable VAR. "
"This is typically used to remove entries from a vector "
"(e.g. semicolon separated list). VALUE is expanded.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmRemoveCommand, cmCommand);
};
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index c0bf6ceaaf..ffa2ce0ed1 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -92,7 +92,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
}
// collect any values into a single semi-colon seperated value list
- if(args.size() >
+ if(static_cast<unsigned short>(args.size()) >
static_cast<unsigned short>(1 + (cache ? 3 : 0) + (force ? 1 : 0)))
{
value = args[1];
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index c1501f96b5..63d3f73e7f 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -74,7 +74,10 @@ public:
"only used by Makefiles). "
"OBJECT_DEPENDS (string) adds dependencies to the object file. "
"COMPILE_FLAGS (string) is passed to the compiler as additional "
- "command line arguments when the source file is compiled. ";
+ "command line arguments when the source file is compiled. "
+ "If SYMBOLIC (boolean) is set to true the build system will be "
+ "informed that the source file is not actually created on disk but "
+ "instead used as a symbolic name for a build rule.";
}
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index a605a77b27..86cb41a0aa 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -133,6 +133,13 @@ public:
"the target in an IDE like visual studio. VS_KEYWORD can be set "
"to change the visual studio keyword, for example QT integration "
"works better if this is set to Qt4VSv1.0.\n"
+ "When a library is built CMake by default generates code to remove "
+ "any existing library using all possible names. This is needed "
+ "to support libraries that switch between STATIC and SHARED by "
+ "a user option. However when using OUTPUT_NAME to build a static "
+ "and shared library of the same name using different logical target "
+ "names the two targets will remove each other's files. This can be "
+ "prevented by setting the CLEAN_DIRECT_OUTPUT property to 1.\n"
"The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
"old way to specify CMake scripts to run before and after "
"installing a target. They are used only when the old "
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 39a605929b..eb77a973f5 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -27,6 +27,7 @@
// include configure generated header to define CMAKE_NO_ANSI_STREAM_HEADERS,
// CMAKE_NO_STD_NAMESPACE, and other macros.
#include "cmConfigure.h"
+#include <cmsys/Configure.hxx>
#define CMake_VERSION \
CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \
@@ -40,9 +41,14 @@
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#pragma warning ( disable : 4503 )
+#pragma warning ( disable : 4512 ) /* operator=() could not be generated */
#define CMAKE_NO_ANSI_FOR_SCOPE
#endif
+#ifdef __BORLANDC__
+#pragma warn -8030 /* Temporary used for parameter */
+#endif
+
#ifdef __ICL
#pragma warning ( disable : 985 )
#endif
@@ -68,6 +74,19 @@ public:
};
#endif
+// Include stream compatibility layer from KWSys.
+// This is needed to work with large file support
+// on some platforms whose stream operators do not
+// support the large integer types.
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+# include <cmsys/IOStream.hxx>
+#endif
+
+// Avoid warnings in system headers.
+#if defined(_MSC_VER)
+# pragma warning (push,1)
+#endif
+
#ifndef CMAKE_NO_ANSI_STREAM_HEADERS
# include <fstream>
# include <iostream>
@@ -97,6 +116,10 @@ public:
#include <set>
#include <deque>
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif
+
// include the "c" string header
#include <string.h>
#include <stdio.h>
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
new file mode 100644
index 0000000000..57982421bf
--- /dev/null
+++ b/Source/cmStandardLexer.h
@@ -0,0 +1,78 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmStandardLexer_h
+#define cmStandardLexer_h
+
+/* Disable some warnings. */
+#if defined(_MSC_VER)
+# pragma warning ( disable : 4127 )
+# pragma warning ( disable : 4131 )
+# pragma warning ( disable : 4244 )
+# pragma warning ( disable : 4251 )
+# pragma warning ( disable : 4267 )
+# pragma warning ( disable : 4305 )
+# pragma warning ( disable : 4309 )
+# pragma warning ( disable : 4706 )
+# pragma warning ( disable : 4786 )
+#endif
+
+#if defined(__BORLANDC__)
+# pragma warn -8008 /* condition always returns true */
+# pragma warn -8066 /* unreachable code */
+#endif
+
+/* Borland system header defines these macros without first undef-ing them. */
+#if defined(__BORLANDC__) && __BORLANDC__ >= 0x580
+# undef INT8_MIN
+# undef INT16_MIN
+# undef INT32_MIN
+# undef INT8_MAX
+# undef INT16_MAX
+# undef INT32_MAX
+# undef UINT8_MAX
+# undef UINT16_MAX
+# undef UINT32_MAX
+# include <stdint.h>
+#endif
+
+/* Make sure SGI termios does not define ECHO differently. */
+#if defined(__sgi) && !defined(__GNUC__)
+# include <sys/termios.h>
+# undef ECHO
+#endif
+
+/* Define isatty on windows. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# include <io.h>
+# if defined( _MSC_VER )
+# define isatty _isatty
+# endif
+# define YY_NO_UNISTD_H 1
+#endif
+
+/* Make sure malloc and free are available on QNX. */
+#ifdef __QNX__
+# include <malloc.h>
+#endif
+
+/* Disable features we do not need. */
+#define YY_NEVER_INTERACTIVE 1
+#define YY_NO_INPUT 1
+#define YY_NO_UNPUT 1
+#define ECHO
+
+#endif
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 71cc31e0a0..fe7c392ab6 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -80,6 +80,12 @@ public:
"top level project or be built each time make is run from the top.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmSubdirCommand, cmCommand);
};
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index 3e9760259c..6e1986d5c1 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -67,6 +67,12 @@ public:
"parallel builds correctly. This functionality is now automatic.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmSubdirDependsCommand, cmCommand);
};
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 26bc47d9d7..57b01b1b8d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -908,6 +908,14 @@ const char *cmTarget::GetProperty(const char* prop)
this->SetProperty("LOCATION", this->GetLocation(0));
}
+ // Per-configuration location can be computed.
+ int len = static_cast<int>(strlen(prop));
+ if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
+ {
+ std::string configName(prop, len-9);
+ this->SetProperty(prop, this->GetLocation(configName.c_str()));
+ }
+
// the type property returns what type the target is
if (!strcmp(prop,"TYPE"))
{
@@ -915,31 +923,31 @@ const char *cmTarget::GetProperty(const char* prop)
{
case cmTarget::STATIC_LIBRARY:
return "STATIC_LIBRARY";
- break;
+ // break; /* unreachable */
case cmTarget::MODULE_LIBRARY:
return "MODULE_LIBRARY";
- break;
+ // break; /* unreachable */
case cmTarget::SHARED_LIBRARY:
return "SHARED_LIBRARY";
- break;
+ // break; /* unreachable */
case cmTarget::EXECUTABLE:
return "EXECUTABLE";
- break;
+ // break; /* unreachable */
case cmTarget::UTILITY:
return "UTILITY";
- break;
+ // break; /* unreachable */
case cmTarget::GLOBAL_TARGET:
return "GLOBAL_TARGET";
- break;
+ // break; /* unreachable */
case cmTarget::INSTALL_FILES:
return "INSTALL_FILES";
- break;
+ // break; /* unreachable */
case cmTarget::INSTALL_PROGRAMS:
return "INSTALL_PROGRAMS";
- break;
+ // break; /* unreachable */
case cmTarget::INSTALL_DIRECTORY:
return "INSTALL_DIRECTORY";
- break;
+ // break; /* unreachable */
}
return 0;
}
@@ -1158,6 +1166,17 @@ void cmTarget::GetFullNameInternal(TargetType type,
return;
}
+ // Return an empty name for the import library if this platform
+ // does not support import libraries.
+ if(implib &&
+ !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
+ {
+ outPrefix = "";
+ outBase = "";
+ outSuffix = "";
+ return;
+ }
+
// The implib option is only allowed for shared libraries.
if(type != cmTarget::SHARED_LIBRARY)
{
@@ -1236,6 +1255,17 @@ void cmTarget::GetFullNameInternal(TargetType type,
// Append the per-configuration postfix.
outBase += configPostfix?configPostfix:"";
+ // Name shared libraries with their version number on some platforms.
+ if(const char* version = this->GetProperty("VERSION"))
+ {
+ if(type == cmTarget::SHARED_LIBRARY && !implib &&
+ this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION"))
+ {
+ outBase += "-";
+ outBase += version;
+ }
+ }
+
// Append the suffix.
outSuffix = targetSuffix?targetSuffix:"";
}
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index f3fe8937ab..d299162814 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -178,6 +178,7 @@ int cmTryCompileCommand::CoreTryCompileCode(
}
err << "\nSee PROJECT command for help enabling other languages.";
cmSystemTools::Error(err.str().c_str());
+ fclose(fout);
return -1;
}
std::string langFlags = "CMAKE_";
diff --git a/Source/cmVTKMakeInstantiatorCommand.h b/Source/cmVTKMakeInstantiatorCommand.h
index 377cf75817..6eefed9574 100644
--- a/Source/cmVTKMakeInstantiatorCommand.h
+++ b/Source/cmVTKMakeInstantiatorCommand.h
@@ -75,6 +75,12 @@ public:
"C++ code.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
cmTypeMacro(cmVTKMakeInstantiatorCommand, cmCommand);
protected:
diff --git a/Source/cmVTKWrapJavaCommand.cxx b/Source/cmVTKWrapJavaCommand.cxx
index 690ba0a324..fd1c16f477 100644
--- a/Source/cmVTKWrapJavaCommand.cxx
+++ b/Source/cmVTKWrapJavaCommand.cxx
@@ -190,9 +190,8 @@ void cmVTKWrapJavaCommand::FinalPass()
alldepends.push_back(res2);
}
- const char* no_output = 0;
const char* no_working_directory = 0;
- this->Makefile->AddUtilityCommand((this->LibraryName+"JavaClasses").c_str(),
- true, no_output,
- alldepends, no_working_directory, "");
+ this->Makefile->AddUtilityCommand(
+ (this->LibraryName+"JavaClasses").c_str(),
+ true, alldepends, no_working_directory, "");
}
diff --git a/Source/cmVTKWrapJavaCommand.h b/Source/cmVTKWrapJavaCommand.h
index 2532bd2b2c..419e399421 100644
--- a/Source/cmVTKWrapJavaCommand.h
+++ b/Source/cmVTKWrapJavaCommand.h
@@ -77,6 +77,12 @@ public:
"Create Java wrappers for VTK classes.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
private:
std::vector<cmSourceFile> WrapClasses;
std::vector<std::string> WrapHeaders;
diff --git a/Source/cmVTKWrapPythonCommand.h b/Source/cmVTKWrapPythonCommand.h
index b92b65a2c9..b9f4e698a3 100644
--- a/Source/cmVTKWrapPythonCommand.h
+++ b/Source/cmVTKWrapPythonCommand.h
@@ -77,6 +77,12 @@ public:
"Create Python wrappers for VTK classes.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
/**
* Helper methods
*/
diff --git a/Source/cmVTKWrapTclCommand.h b/Source/cmVTKWrapTclCommand.h
index 77488bcbff..4fa061e4ca 100644
--- a/Source/cmVTKWrapTclCommand.h
+++ b/Source/cmVTKWrapTclCommand.h
@@ -79,6 +79,12 @@ public:
"Create Tcl wrappers for VTK classes.";
}
+ /** This command is kept for compatibility with older CMake versions. */
+ virtual bool IsDiscouraged()
+ {
+ return true;
+ }
+
/**
* Helper methods
*/
diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx
index 88b0127fb5..550fc1d8d5 100644
--- a/Source/cmWin32ProcessExecution.cxx
+++ b/Source/cmWin32ProcessExecution.cxx
@@ -293,14 +293,14 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
char *s1=0,*s2=0, *s3 = " /c ";
- int i;
- int x;
- if (i = GetEnvironmentVariable("COMSPEC",NULL,0))
+ int i = GetEnvironmentVariable("COMSPEC",NULL,0);
+ if (i)
{
char *comshell;
s1 = (char *)malloc(i);
- if (!(x = GetEnvironmentVariable("COMSPEC", s1, i)))
+ int x = GetEnvironmentVariable("COMSPEC", s1, i);
+ if (!x)
{
free(s1);
return x;
@@ -443,25 +443,25 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
return TRUE;
}
- LPVOID lpMsgBuf;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
-
- // Free the buffer.
-
- char* str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf);
- LocalFree( lpMsgBuf );
-
output += "CreateProcessError: ";
- output += str;
+ {
+ /* Format the error message. */
+ char message[1024];
+ DWORD original = GetLastError();
+ DWORD length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS, 0, original,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ message, 1023, 0);
+ if(length < 1)
+ {
+ /* FormatMessage failed. Use a default message. */
+ _snprintf(message, 1023,
+ "Process execution failed with error 0x%X. "
+ "FormatMessage failed with error 0x%X",
+ original, GetLastError());
+ }
+ output += message;
+ }
output += "\n";
output += "for command: ";
output += s2;
@@ -471,7 +471,6 @@ static BOOL RealPopenCreateProcess(const char *cmdstring,
output += path;
}
output += "\n";
- delete [] str;
free(s2);
free(s1);
return FALSE;
@@ -607,7 +606,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
case POPEN_2:
case POPEN_4:
- if ( 1 )
+ //if ( 1 )
{
fd1 = _open_osfhandle(TO_INTPTR(this->hChildStdinWrDup), mode);
fd2 = _open_osfhandle(TO_INTPTR(this->hChildStdoutRdDup), mode);
@@ -615,7 +614,7 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
}
case POPEN_3:
- if ( 1)
+ //if ( 1)
{
fd1 = _open_osfhandle(TO_INTPTR(this->hChildStdinWrDup), mode);
fd2 = _open_osfhandle(TO_INTPTR(this->hChildStdoutRdDup), mode);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 275c32dc1f..f19d9d14f8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -111,6 +111,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
cmake::cmake()
{
+ this->DebugOutput = false;
this->DebugTryCompile = false;
this->ClearBuildSystem = false;
this->FileComparison = new cmFileTimeComparison;
@@ -446,6 +447,11 @@ void cmake::SetArgs(const std::vector<std::string>& args)
std::cout << "debug trycompile on\n";
this->DebugTryCompileOn();
}
+ else if(arg.find("--debug-output",0) == 0)
+ {
+ std::cout << "Running with debug output on.\n";
+ this->DebugOutputOn();
+ }
else if(arg.find("-G",0) == 0)
{
std::string value = arg.substr(2);
@@ -1184,6 +1190,18 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return cmake::ExecuteLinkScript(args);
}
+ // Internal CMake unimplemented feature notification.
+ else if (args[1] == "cmake_unimplemented_variable")
+ {
+ std::cerr << "Feature not implemented for this platform.";
+ if(args.size() == 3)
+ {
+ std::cerr << " Variable " << args[2] << " is not set.";
+ }
+ std::cerr << std::endl;
+ return 1;
+ }
+
#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake color makefile support.
else if (args[1] == "cmake_echo_color")
@@ -1319,6 +1337,11 @@ void cmake::SetHomeOutputDirectory(const char* lib)
void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
{
+ if(!gg)
+ {
+ cmSystemTools::Error("Error SetGlobalGenerator called with null");
+ return;
+ }
// delete the old generator
if (this->GlobalGenerator)
{
diff --git a/Source/cmake.h b/Source/cmake.h
index d63cf7e3eb..a870676b09 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -281,6 +281,9 @@ class cmake
const char* GetCPackCommand();
const char* GetCMakeCommand() { return this->CMakeCommand.c_str(); }
+ // Do we want debug output during the cmake run.
+ bool GetDebugOutput() { return this->DebugOutput; }
+ void DebugOutputOn() { this->DebugOutput = true;}
protected:
typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
typedef std::map<cmStdString,
@@ -333,6 +336,7 @@ private:
bool Verbose;
bool InTryCompile;
bool ScriptMode;
+ bool DebugOutput;
std::string CMakeCommand;
std::string CXXEnvironment;
std::string CCEnvironment;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index c16cd1c26c..db0f53137e 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -85,6 +85,9 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
{"--debug-trycompile", "Do not delete the try compile directories..",
"Do not delete the files and directories created for try_compile calls. "
"This is useful in debugging failed try_compiles."},
+ {"--debug-output", "Put cmake in a debug mode.",
+ "Print extra stuff during the cmake run like stack traces with "
+ "message(send_error ) calls."},
{"--help-command cmd [file]", "Print help for a single command and exit.",
"Full documentation specific to the given command is displayed."},
{"--help-command-list [file]", "List available listfile commands and exit.",
diff --git a/Source/kwsys/CMakeEmptyInputFile.in b/Source/kwsys/CMakeEmptyInputFile.in
new file mode 100644
index 0000000000..40b7ea245e
--- /dev/null
+++ b/Source/kwsys/CMakeEmptyInputFile.in
@@ -0,0 +1 @@
+@CMAKE_EMPTY_INPUT_FILE_CONTENT@
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 2145b7d482..e3f8ff2c70 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -123,10 +123,12 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_USE_Process 1)
SET(KWSYS_USE_RegularExpression 1)
SET(KWSYS_USE_Registry 1)
+ SET(KWSYS_USE_System 1)
SET(KWSYS_USE_SystemTools 1)
SET(KWSYS_USE_CommandLineArguments 1)
SET(KWSYS_USE_FundamentalType 1)
SET(KWSYS_USE_Terminal 1)
+ SET(KWSYS_USE_IOStream 1)
ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
#-----------------------------------------------------------------------------
@@ -142,6 +144,10 @@ IF(KWSYS_STANDALONE)
ENDIF(BUILD_TESTING)
ENDIF(KWSYS_STANDALONE)
+# Include helper macros.
+INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformTests.cmake)
+INCLUDE(CheckTypeSize)
+
# Do full dependency headers.
INCLUDE_REGULAR_EXPRESSION("^.*$")
@@ -262,13 +268,35 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no_implicit_include")
ENDIF(NOT KWSYS_CXX_FLAGS_HAVE_NO_IMPLICIT_INCLUDE)
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
+ IF(CMAKE_SYSTEM MATCHES "HP-UX")
+ SET(KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p")
+ ENDIF(CMAKE_SYSTEM MATCHES "HP-UX")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
#-----------------------------------------------------------------------------
+# Configure Large File Support.
+SET(KWSYS_LFS_REQUESTED 1)
+SET(KWSYS_LFS_AVAILABLE 0)
+IF(KWSYS_LFS_REQUESTED)
+ # Large File Support is requested.
+ SET(KWSYS_LFS_REQUESTED 1)
+
+ # Check for large file support.
+ KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_LFS_WORKS
+ "Checking for Large File Support" DIRECT)
+
+ IF(KWSYS_LFS_WORKS)
+ SET(KWSYS_LFS_AVAILABLE 1)
+ ENDIF(KWSYS_LFS_WORKS)
+ELSE(KWSYS_LFS_REQUESTED)
+ # Large File Support is not requested.
+ SET(KWSYS_LFS_REQUESTED 0)
+ENDIF(KWSYS_LFS_REQUESTED)
+
+#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
"Checking whether STL classes are in std namespace" DIRECT)
@@ -371,7 +399,6 @@ ENDIF(UNIX)
IF(KWSYS_USE_FundamentalType)
# Determine type sizes.
- INCLUDE(CheckTypeSize)
CHECK_TYPE_SIZE("char" KWSYS_SIZEOF_CHAR)
CHECK_TYPE_SIZE("short" KWSYS_SIZEOF_SHORT)
CHECK_TYPE_SIZE("int" KWSYS_SIZEOF_INT)
@@ -421,26 +448,28 @@ IF(KWSYS_USE_FundamentalType)
ENDIF(KWSYS_USE___INT64)
# Check signedness of "char" type.
- IF("KWSYS_CHAR_IS_SIGNED" MATCHES "^KWSYS_CHAR_IS_SIGNED$")
- MESSAGE(STATUS "Checking signedness of char")
- TRY_RUN(KWSYS_CHAR_IS_SIGNED KWSYS_CHAR_IS_SIGNED_COMPILED
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx
- COMPILE_DEFINITIONS -DTEST_KWSYS_CHAR_IS_SIGNED)
- IF(KWSYS_CHAR_IS_SIGNED_COMPILED)
- IF(KWSYS_CHAR_IS_SIGNED)
- MESSAGE(STATUS "Checking signedness of char -- signed")
- SET(KWSYS_CHAR_IS_SIGNED 1 CACHE INTERNAL "Whether char is signed.")
- ELSE(KWSYS_CHAR_IS_SIGNED)
- MESSAGE(STATUS "Checking signedness of char -- unsigned")
- SET(KWSYS_CHAR_IS_SIGNED 0 CACHE INTERNAL "Whether char is signed.")
- ENDIF(KWSYS_CHAR_IS_SIGNED)
- ELSE(KWSYS_CHAR_IS_SIGNED_COMPILED)
- MESSAGE(FATAL_ERROR "Checking signedness of char -- failed")
- ENDIF(KWSYS_CHAR_IS_SIGNED_COMPILED)
- ENDIF("KWSYS_CHAR_IS_SIGNED" MATCHES "^KWSYS_CHAR_IS_SIGNED$")
+ KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_CHAR_IS_SIGNED
+ "Checking whether char is signed" DIRECT)
ENDIF(KWSYS_USE_FundamentalType)
+IF(KWSYS_USE_IOStream)
+ # Determine whether iostreams support long long.
+ CHECK_TYPE_SIZE("long long" KWSYS_SIZEOF_LONG_LONG)
+ IF(KWSYS_SIZEOF_LONG_LONG)
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
+ -DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
+ -DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG
+ "Checking if istream supports long long" DIRECT)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_OSTREAM_LONG_LONG
+ "Checking if ostream supports long long" DIRECT)
+ SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
+ ELSE(KWSYS_SIZEOF_LONG_LONG)
+ SET(KWSYS_IOS_HAS_ISTREAM_LONG_LONG 0)
+ SET(KWSYS_IOS_HAS_OSTREAM_LONG_LONG 0)
+ ENDIF(KWSYS_SIZEOF_LONG_LONG)
+ENDIF(KWSYS_USE_IOStream)
+
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
SET(KWSYS_NAME_IS_KWSYS 1)
ELSE(KWSYS_NAMESPACE MATCHES "^kwsys$")
@@ -472,8 +501,25 @@ INCLUDE_DIRECTORIES(${KWSYS_HEADER_ROOT})
# Create STL header wrappers to block warnings in the STL headers and
# give standard names by which they may be included.
SET(KWSYS_STL_HEADER_EXTRA_string 1)
-FOREACH(header algorithm deque iterator list map numeric queue set stack string
- utility vector memory functional)
+FOREACH(header
+ algorithm
+ deque
+ exception
+ functional
+ iterator
+ list
+ map
+ memory
+ new
+ numeric
+ queue
+ set
+ stack
+ stdexcept
+ string
+ utility
+ vector
+ )
# Configure the header wrapper.
SET(KWSYS_STL_HEADER "${header}")
IF(KWSYS_STL_HEADER_EXTRA_${header})
@@ -552,9 +598,15 @@ IF(KWSYS_USE_Glob)
SET(KWSYS_USE_SystemTools 1)
SET(KWSYS_USE_RegularExpression 1)
ENDIF(KWSYS_USE_Glob)
+IF(KWSYS_USE_Process)
+ SET(KWSYS_USE_System 1)
+ENDIF(KWSYS_USE_Process)
# Add selected C++ classes.
-SET(cppclasses Directory DynamicLoader Glob RegularExpression SystemTools CommandLineArguments Registry)
+SET(cppclasses
+ Directory DynamicLoader Glob RegularExpression SystemTools
+ CommandLineArguments Registry IOStream
+ )
FOREACH(cpp ${cppclasses})
IF(KWSYS_USE_${cpp})
SET(KWSYS_CLASSES ${KWSYS_CLASSES} ${cpp})
@@ -562,7 +614,7 @@ FOREACH(cpp ${cppclasses})
ENDFOREACH(cpp)
# Add selected C components.
-FOREACH(c Process Base64 FundamentalType Terminal)
+FOREACH(c Process Base64 FundamentalType Terminal System)
IF(KWSYS_USE_${c})
SET(KWSYS_H_FILES ${KWSYS_H_FILES} ${c})
ENDIF(KWSYS_USE_${c})
@@ -586,11 +638,20 @@ IF(KWSYS_USE_Process)
ELSE(NOT UNIX)
# Use the UNIX implementation.
SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessUNIX.c)
+
+ # Help ProcessUNIX.c compile properly on all platforms.
+ KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_PTRDIFF_T
+ "Checking whether C compiler has ptrdiff_t in stddef.h" DIRECT)
+ KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_SSIZE_T
+ "Checking whether C compiler has ssize_t in unistd.h" DIRECT)
+ SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c PROPERTIES
+ COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T}"
+ )
ENDIF(NOT UNIX)
ENDIF(KWSYS_USE_Process)
# Add selected C sources.
-FOREACH(c Base64 Terminal)
+FOREACH(c Base64 Terminal System)
IF(KWSYS_USE_${c})
SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ${c}.c)
ENDIF(KWSYS_USE_${c})
diff --git a/Source/kwsys/CheckCXXSourceRuns.cmake b/Source/kwsys/CheckCXXSourceRuns.cmake
new file mode 100644
index 0000000000..7bcc873874
--- /dev/null
+++ b/Source/kwsys/CheckCXXSourceRuns.cmake
@@ -0,0 +1,62 @@
+# - Check if the source code provided in the SOURCE argument compiles.
+# CHECK_CXX_SOURCE_COMPILES(SOURCE VAR)
+# - macro which checks if the source code compiles\
+# SOURCE - source code to try to compile
+# VAR - variable to store size if the type exists.
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+
+MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR COMMENT)
+ IF("HAVE_${VAR}" MATCHES "^HAVE_${VAR}$")
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+ SET(CMAKE_EMPTY_INPUT_FILE_CONTENT "${SOURCE}")
+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/CMakeEmptyInputFile.in"
+ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx" IMMEDIATE)
+
+ MESSAGE(STATUS "Performing Test ${COMMENT}")
+ TRY_RUN(${VAR} HAVE_${VAR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+ IF(HAVE_${VAR})
+ SET(${VAR} 1 CACHE INTERNAL "Test ${COMMENT}")
+ MESSAGE(STATUS "Performing Test ${COMMENT} - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
+ "Performing C++ SOURCE FILE Test ${COMMENT} succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ ELSE(HAVE_${VAR})
+ MESSAGE(STATUS "Performing Test ${COMMENT} - Failed")
+ SET(${VAR} "" CACHE INTERNAL "Test ${COMMENT}")
+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+ "Performing C++ SOURCE FILE Test ${COMMENT} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${SOURCE}\n")
+ ENDIF(HAVE_${VAR})
+ ENDIF("HAVE_${VAR}" MATCHES "^HAVE_${VAR}$")
+ENDMACRO(CHECK_CXX_SOURCE_RUNS)
+
+
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 586d6fd661..4db4819d64 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -216,7 +216,7 @@ int CommandLineArguments::Parse()
// additional value
CommandLineArgumentsCallbackStructure *cs
= &this->Internals->Callbacks[matches[maxidx]];
- const CommandLineArguments::Internal::String& sarg = matches[maxidx];
+ const kwsys_stl::string& sarg = matches[maxidx];
if ( cs->Argument != sarg )
{
abort();
diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in
index 744e884d4e..01867ed137 100644
--- a/Source/kwsys/Configure.h.in
+++ b/Source/kwsys/Configure.h.in
@@ -22,6 +22,46 @@
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
#endif
+/* Whether Large File Support is requested. */
+#define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@
+
+/* Whether Large File Support is available. */
+#if @KWSYS_NAMESPACE@_LFS_REQUESTED
+# define @KWSYS_NAMESPACE@_LFS_AVAILABLE @KWSYS_LFS_AVAILABLE@
+#endif
+
+/* Setup Large File Support if requested. */
+#if @KWSYS_NAMESPACE@_LFS_REQUESTED
+ /* Since LFS is requested this header must be included before system
+ headers whether or not LFS is available. */
+# if 0 && (defined(_SYS_TYPES_H) || defined(_SYS_TYPES_INCLUDED))
+# error "@KWSYS_NAMESPACE@/Configure.h must be included before sys/types.h"
+# endif
+ /* Enable the large file API if it is available. */
+# if @KWSYS_NAMESPACE@_LFS_AVAILABLE && \
+ !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINES)
+# if !defined(_LARGEFILE_SOURCE) && \
+ !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE_SOURCE)
+# define _LARGEFILE_SOURCE
+# endif
+# if !defined(_LARGEFILE64_SOURCE) && \
+ !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE64_SOURCE)
+# define _LARGEFILE64_SOURCE
+# endif
+# if !defined(_LARGE_FILES) && \
+ !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGE_FILES)
+# define _LARGE_FILES
+# endif
+# if !defined(_FILE_OFFSET_BITS) && \
+ !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_FILE_OFFSET_BITS)
+# define _FILE_OFFSET_BITS 64
+# endif
+# if 0 && (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64)
+# error "_FILE_OFFSET_BITS must be defined to at least 64"
+# endif
+# endif
+#endif
+
/* Setup the export macro. */
#if defined(_WIN32) && @KWSYS_BUILD_SHARED@
# if defined(@KWSYS_NAMESPACE@_EXPORTS)
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index f7fb5e98c3..bc775e9441 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -199,6 +199,11 @@ namespace KWSYS_NAMESPACE
bool Directory::Load(const char* name)
{
this->Clear();
+
+ if (!name)
+ {
+ return 0;
+ }
DIR* dir = opendir(name);
if (!dir)
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 15f0e71947..48f6a5f438 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -39,14 +39,14 @@
#include <string.h>
namespace KWSYS_NAMESPACE
{
-#if defined( _WIN32 ) || defined( APPLE ) || defined( __CYGWIN__ )
- // On Windows and apple, no difference between lower and upper case
- #define KWSYS_GLOB_CASE_INDEPENDENT
+#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+// On Windows and apple, no difference between lower and upper case
+# define KWSYS_GLOB_CASE_INDEPENDENT
#endif
-#if defined( _WIN32 ) || defined( __CYGWIN__ )
- // Handle network paths
- #define KWSYS_GLOB_SUPPORT_NETWORK_PATHS
+#if defined(_WIN32) || defined(__CYGWIN__)
+// Handle network paths
+# define KWSYS_GLOB_SUPPORT_NETWORK_PATHS
#endif
//----------------------------------------------------------------------------
@@ -55,7 +55,6 @@ class GlobInternals
public:
kwsys_stl::vector<kwsys_stl::string> Files;
kwsys_stl::vector<kwsys::RegularExpression> Expressions;
- kwsys_stl::vector<kwsys_stl::string> TextExpressions;
};
//----------------------------------------------------------------------------
@@ -73,109 +72,138 @@ Glob::~Glob()
}
//----------------------------------------------------------------------------
-void Glob::Escape(int ch, char* buffer)
-{
- if (! (
- 'a' <= ch && ch <= 'z' ||
- 'A' <= ch && ch <= 'Z' ||
- '0' <= ch && ch <= '9') )
- {
- sprintf(buffer, "\\%c", ch);
- }
- else
- {
-#if defined( KWSYS_GLOB_CASE_INDEPENDENT )
- // On Windows and apple, no difference between lower and upper case
- sprintf(buffer, "%c", tolower(ch));
-#else
- sprintf(buffer, "%c", ch);
-#endif
- }
-}
-
-//----------------------------------------------------------------------------
kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles()
{
return this->Internals->Files;
}
//----------------------------------------------------------------------------
-kwsys_stl::string Glob::ConvertExpression(const kwsys_stl::string& expr)
+kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
+ bool require_whole_string)
{
-
- kwsys_stl::string::size_type i = 0;
- kwsys_stl::string::size_type n = expr.size();
-
- kwsys_stl::string res = "^";
- kwsys_stl::string stuff = "";
-
- while ( i < n )
+ // Incrementally build the regular expression from the pattern.
+ kwsys_stl::string regex = require_whole_string? "^" : "";
+ kwsys_stl::string::const_iterator pattern_first = pattern.begin();
+ kwsys_stl::string::const_iterator pattern_last = pattern.end();
+ for(kwsys_stl::string::const_iterator i = pattern_first;
+ i != pattern_last; ++i)
{
- int c = expr[i];
- i = i+1;
- if ( c == '*' )
+ int c = *i;
+ if(c == '*')
{
- res = res + ".*";
+ // A '*' (not between brackets) matches any string.
+ // We modify this to not match slashes since the orignal glob
+ // pattern documentation was meant for matching file name
+ // components separated by slashes.
+ regex += "[^/]*";
}
- else if ( c == '?' )
+ else if(c == '?')
{
- res = res + ".";
+ // A '?' (not between brackets) matches any single character.
+ // We modify this to not match slashes since the orignal glob
+ // pattern documentation was meant for matching file name
+ // components separated by slashes.
+ regex += "[^/]";
}
- else if ( c == '[' )
+ else if(c == '[')
{
- kwsys_stl::string::size_type j = i;
- if ( j < n && ( expr[j] == '!' || expr[j] == '^' ) )
+ // Parse out the bracket expression. It begins just after the
+ // opening character.
+ kwsys_stl::string::const_iterator bracket_first = i+1;
+ kwsys_stl::string::const_iterator bracket_last = bracket_first;
+
+ // The first character may be complementation '!' or '^'.
+ if(bracket_last != pattern_last &&
+ (*bracket_last == '!' || *bracket_last == '^'))
{
- j = j+1;
+ ++bracket_last;
}
- if ( j < n && expr[j] == ']' )
+
+ // If the next character is a ']' it is included in the brackets
+ // because the bracket string may not be empty.
+ if(bracket_last != pattern_last && *bracket_last == ']')
{
- j = j+1;
+ ++bracket_last;
}
- while ( j < n && expr[j] != ']' )
+
+ // Search for the closing ']'.
+ while(bracket_last != pattern_last && *bracket_last != ']')
{
- j = j+1;
+ ++bracket_last;
}
- if ( j >= n )
+
+ // Check whether we have a complete bracket string.
+ if(bracket_last == pattern_last)
{
- res = res + "\\[";
+ // The bracket string did not end, so it was opened simply by
+ // a '[' that is supposed to be matched literally.
+ regex += "\\[";
}
else
{
- stuff = "";
- kwsys_stl::string::size_type cc;
- for ( cc = i; cc < j; cc ++ )
- {
- if ( expr[cc] == '\\' )
+ // Convert the bracket string to its regex equivalent.
+ kwsys_stl::string::const_iterator k = bracket_first;
+
+ // Open the regex block.
+ regex += "[";
+
+ // A regex range complement uses '^' instead of '!'.
+ if(k != bracket_last && *k == '!')
{
- stuff += "\\\\";
+ regex += "^";
+ ++k;
}
- else
+
+ // Convert the remaining characters.
+ for(; k != bracket_last; ++k)
+ {
+ // Backslashes must be escaped.
+ if(*k == '\\')
{
- stuff += expr[cc];
+ regex += "\\";
}
+
+ // Store this character.
+ regex += *k;
}
- i = j+1;
- if ( stuff[0] == '!' || stuff[0] == '^' )
+
+ // Close the regex block.
+ regex += "]";
+
+ // Jump to the end of the bracket string.
+ i = bracket_last;
+ }
+ }
+ else
+ {
+ // A single character matches itself.
+ int ch = c;
+ if(!(('a' <= ch && ch <= 'z') ||
+ ('A' <= ch && ch <= 'Z') ||
+ ('0' <= ch && ch <= '9')))
{
- stuff = '^' + stuff.substr(1);
+ // Escape the non-alphanumeric character.
+ regex += "\\";
}
- else if ( stuff[0] == '^' )
+#if defined(KWSYS_GLOB_CASE_INDEPENDENT)
+ else
{
- stuff = '\\' + stuff;
+ // On case-insensitive systems file names are converted to lower
+ // case before matching.
+ ch = tolower(ch);
}
- res = res + "[" + stuff + "]";
+#endif
+
+ // Store the character.
+ regex.append(1, static_cast<char>(ch));
}
}
- else
+
+ if(require_whole_string)
{
- char buffer[100];
- buffer[0] = 0;
- this->Escape(c, buffer);
- res = res + buffer;
+ regex += "$";
}
- }
- return res + "$";
+ return regex;
}
//----------------------------------------------------------------------------
@@ -276,8 +304,8 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
realname = dir + "/" + fname;
}
-#if defined( KWSYS_GLOB_CASE_INDEPENDENT )
- // On Windows and apple, no difference between lower and upper case
+#if defined(KWSYS_GLOB_CASE_INDEPENDENT)
+ // On case-insensitive file systems convert to lower case for matching.
fname = kwsys::SystemTools::LowerCase(fname);
#endif
@@ -427,8 +455,7 @@ void Glob::AddExpression(const char* expr)
{
this->Internals->Expressions.push_back(
kwsys::RegularExpression(
- this->ConvertExpression(expr).c_str()));
- this->Internals->TextExpressions.push_back(this->ConvertExpression(expr));
+ this->PatternToRegex(expr).c_str()));
}
//----------------------------------------------------------------------------
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index 728276fca6..ad9961dc12 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -61,6 +61,16 @@ public:
void SetRelative(const char* dir);
const char* GetRelative();
+ /** Convert the given globbing pattern to a regular expression.
+ There is no way to quote meta-characters. The
+ require_whole_string argument specifies whether the regex is
+ automatically surrounded by "^" and "$" to match the whole
+ string. This is on by default because patterns always match
+ whole strings, but may be disabled to support concatenating
+ expressions more easily (regex1|regex2|etc). */
+ static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern,
+ bool require_whole_string = true);
+
protected:
//! Process directory
void ProcessDirectory(kwsys_stl::string::size_type start,
@@ -71,14 +81,6 @@ protected:
void RecurseDirectory(kwsys_stl::string::size_type start,
const kwsys_stl::string& dir, bool dir_only);
- //! Escape all non-alphanumeric characters in pattern.
- void Escape(int ch, char* buffer);
-
- //!
- // Translate a shell PATTERN to a regular expression.
- // There is no way to quote meta-characters.
- kwsys_stl::string ConvertExpression(const kwsys_stl::string& expr);
-
//! Add regular expression
void AddExpression(const char* expr);
@@ -92,4 +94,9 @@ protected:
} // namespace @KWSYS_NAMESPACE@
+/* Undefine temporary macro. */
+#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
+# undef kwsys_stl
+#endif
+
#endif
diff --git a/Source/kwsys/IOStream.cxx b/Source/kwsys/IOStream.cxx
new file mode 100644
index 0000000000..2e1a3790de
--- /dev/null
+++ b/Source/kwsys/IOStream.cxx
@@ -0,0 +1,270 @@
+/*=========================================================================
+
+ Program: KWSys - Kitware System Library
+ Module: $RCSfile$
+
+ Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "kwsysPrivate.h"
+#include KWSYS_HEADER(Configure.hxx)
+
+// Configure the implementation for the current streams library.
+#if !KWSYS_IOS_USE_ANSI
+# define ios_base ios
+# if defined(__HP_aCC)
+# define protected public
+# include <iostream.h> // Hack access to some private stream methods.
+# undef protected
+# endif
+#endif
+
+// Include the streams library.
+#include KWSYS_HEADER(ios/iostream)
+#include KWSYS_HEADER(IOStream.hxx)
+
+// Work-around CMake dependency scanning limitation. This must
+// duplicate the above list of headers.
+#if 0
+# include "Configure.hxx.in"
+# include "kwsys_ios_iostream.hxx.in"
+# include "IOStream.hxx.in"
+#endif
+
+// Implement the rest of this file only if it is needed.
+#if KWSYS_IOS_NEED_OPERATORS_LL
+
+# include <stdio.h> // sscanf, sprintf
+# include <string.h> // memchr
+
+# if defined(_MAX_INT_DIG)
+# define KWSYS_IOS_INT64_MAX_DIG _MAX_INT_DIG
+# else
+# define KWSYS_IOS_INT64_MAX_DIG 32
+# endif
+
+namespace KWSYS_NAMESPACE
+{
+
+// Scan an input stream for an integer value.
+static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
+{
+ // Prepare to write to buffer.
+ char* out = buffer;
+ char* end = buffer + KWSYS_IOS_INT64_MAX_DIG - 1;
+
+ // Look for leading sign.
+ if(is.peek() == '+') { *out++ = '+'; is.ignore(); }
+ else if(is.peek() == '-') { *out++ = '-'; is.ignore(); }
+
+ // Determine the base. If not specified in the stream, try to
+ // detect it from the input. A leading 0x means hex, and a leading
+ // 0 alone means octal.
+ int base = 0;
+ int flags = is.flags() & kwsys_ios::ios_base::basefield;
+ if(flags == kwsys_ios::ios_base::oct) { base = 8; }
+ else if(flags == kwsys_ios::ios_base::dec) { base = 10; }
+ else if(flags == kwsys_ios::ios_base::hex) { base = 16; }
+ bool foundDigit = false;
+ bool foundNonZero = false;
+ if(is.peek() == '0')
+ {
+ foundDigit = true;
+ is.ignore();
+ if((is.peek() == 'x' || is.peek() == 'X') && (base == 0 || base == 16))
+ {
+ base = 16;
+ foundDigit = false;
+ is.ignore();
+ }
+ else if (base == 0)
+ {
+ base = 8;
+ }
+ }
+
+ // Determine the range of digits allowed for this number.
+ const char* digits = "0123456789abcdefABCDEF";
+ int maxDigitIndex = 10;
+ if(base == 8)
+ {
+ maxDigitIndex = 8;
+ }
+ else if(base == 16)
+ {
+ maxDigitIndex = 10+6+6;
+ }
+
+ // Scan until an invalid digit is found.
+ for(;is.peek() != EOF; is.ignore())
+ {
+ if(memchr(digits, *out = (char)is.peek(), maxDigitIndex) != 0)
+ {
+ if((foundNonZero || *out != '0') && out < end)
+ {
+ ++out;
+ foundNonZero = true;
+ }
+ foundDigit = true;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // Correct the buffer contents for degenerate cases.
+ if(foundDigit && !foundNonZero)
+ {
+ *out++ = '0';
+ }
+ else if (!foundDigit)
+ {
+ out = buffer;
+ }
+
+ // Terminate the string in the buffer.
+ *out = '\0';
+
+ return base;
+}
+
+// Read an integer value from an input stream.
+template <class T>
+kwsys_ios::istream&
+IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type)
+{
+ int state = kwsys_ios::ios_base::goodbit;
+
+ // Skip leading whitespace.
+# if KWSYS_IOS_USE_ANSI
+ kwsys_ios::istream::sentry okay(is);
+# else
+ is.eatwhite();
+ kwsys_ios::istream& okay = is;
+# endif
+
+ if(okay)
+ {
+# if KWSYS_IOS_USE_ANSI
+ try {
+# endif
+ // Copy the string to a buffer and construct the format string.
+ char buffer[KWSYS_IOS_INT64_MAX_DIG];
+# if defined(_MSC_VER)
+ char format[] = "%I64_";
+ const int typeIndex = 4;
+# else
+ char format[] = "%ll_";
+ const int typeIndex = 3;
+# endif
+ switch(IOStreamScanStream(is, buffer))
+ {
+ case 8: format[typeIndex] = 'o'; break;
+ case 0: // Default to decimal if not told otherwise.
+ case 10: format[typeIndex] = type; break;
+ case 16: format[typeIndex] = 'x'; break;
+ };
+
+ // Use sscanf to parse the number from the buffer.
+ T result;
+ int success = (sscanf(buffer, format, &result) == 1)?1:0;
+
+ // Set flags for resulting state.
+ if(is.peek() == EOF) { state |= kwsys_ios::ios_base::eofbit; }
+ if(!success) { state |= kwsys_ios::ios_base::failbit; }
+ else { value = result; }
+# if KWSYS_IOS_USE_ANSI
+ } catch(...) { state |= kwsys_ios::ios_base::badbit; }
+# endif
+ }
+
+# if KWSYS_IOS_USE_ANSI
+ is.setstate(kwsys_ios::ios_base::iostate(state));
+# else
+ is.clear(state);
+# endif
+ return is;
+}
+
+// Print an integer value to an output stream.
+template <class T>
+kwsys_ios::ostream&
+IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type)
+{
+# if KWSYS_IOS_USE_ANSI
+ kwsys_ios::ostream::sentry okay(os);
+# else
+ kwsys_ios::ostream& okay = os;
+# endif
+ if(okay)
+ {
+# if KWSYS_IOS_USE_ANSI
+ try {
+# endif
+ // Construct the format string.
+ char format[8];
+ char* f = format;
+ *f++ = '%';
+ if(os.flags() & kwsys_ios::ios_base::showpos) { *f++ = '+'; }
+ if(os.flags() & kwsys_ios::ios_base::showbase) { *f++ = '#'; }
+# if defined(_MSC_VER)
+ *f++ = 'I'; *f++ = '6'; *f++ = '4';
+# else
+ *f++ = 'l'; *f++ = 'l';
+# endif
+ long bflags = os.flags() & kwsys_ios::ios_base::basefield;
+ if(bflags == kwsys_ios::ios_base::oct) { *f++ = 'o'; }
+ else if(bflags != kwsys_ios::ios_base::hex) { *f++ = type; }
+ else if(os.flags() & kwsys_ios::ios_base::uppercase) { *f++ = 'X'; }
+ else { *f++ = 'x'; }
+ *f = '\0';
+
+ // Use sprintf to print to a buffer and then write the
+ // buffer to the stream.
+ char buffer[2*KWSYS_IOS_INT64_MAX_DIG];
+ sprintf(buffer, format, value);
+ os << buffer;
+# if KWSYS_IOS_USE_ANSI
+ } catch(...) { os.clear(os.rdstate() | kwsys_ios::ios_base::badbit); }
+# endif
+ }
+ return os;
+}
+
+# if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG
+// Implement input stream operator for IOStreamSLL.
+kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamSLL& value)
+{
+ return IOStreamScanTemplate(is, value, 'd');
+}
+
+// Implement input stream operator for IOStreamULL.
+kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value)
+{
+ return IOStreamScanTemplate(is, value, 'u');
+}
+# endif
+
+# if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG
+// Implement output stream operator for IOStreamSLL.
+kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamSLL value)
+{
+ return IOStreamPrintTemplate(os, value, 'd');
+}
+
+// Implement output stream operator for IOStreamULL.
+kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamULL value)
+{
+ return IOStreamPrintTemplate(os, value, 'u');
+}
+# endif
+
+} // namespace KWSYS_NAMESPACE
+
+#endif // KWSYS_IOS_NEED_OPERATORS_LL
diff --git a/Source/kwsys/IOStream.hxx.in b/Source/kwsys/IOStream.hxx.in
new file mode 100644
index 0000000000..5b08689aec
--- /dev/null
+++ b/Source/kwsys/IOStream.hxx.in
@@ -0,0 +1,148 @@
+/*=========================================================================
+
+ Program: KWSys - Kitware System Library
+ Module: $RCSfile$
+
+ Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef @KWSYS_NAMESPACE@_IOStream_hxx
+#define @KWSYS_NAMESPACE@_IOStream_hxx
+
+#include <@KWSYS_NAMESPACE@/ios/iosfwd>
+
+/* Define these macros temporarily to keep the code readable. */
+#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
+# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
+# define kwsys_ios @KWSYS_NAMESPACE@_ios
+#endif
+
+/* Whether istream supports long long. */
+#define @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_IOS_HAS_ISTREAM_LONG_LONG@
+
+/* Whether ostream supports long long. */
+#define @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@
+
+/* Size of type long long and 0 if not available. */
+#define @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG @KWSYS_SIZEOF_LONG_LONG@
+
+/* Determine whether we need to define the streaming operators for
+ long long or __int64. */
+#if @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG
+# if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \
+ !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
+# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
+ namespace @KWSYS_NAMESPACE@
+ {
+ typedef long long IOStreamSLL;
+ typedef unsigned long long IOStreamULL;
+ }
+# endif
+#elif defined(_MSC_VER) && _MSC_VER < 1300
+# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
+ namespace @KWSYS_NAMESPACE@
+ {
+ typedef __int64 IOStreamSLL;
+ typedef unsigned __int64 IOStreamULL;
+ }
+#endif
+#if !defined(@KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL)
+# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0
+#endif
+
+#if @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
+# if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
+
+/* Input stream operator implementation functions. */
+namespace @KWSYS_NAMESPACE@
+{
+kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
+ IOStreamSLL&);
+kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
+ IOStreamULL&);
+}
+
+/* Provide input stream operator for long long. */
+# if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_LONG_LONG) && \
+ !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
+# define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
+# define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED
+inline kwsys_ios::istream&
+operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
+}
+# endif
+
+/* Provide input stream operator for unsigned long long. */
+# if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) && \
+ !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
+# define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
+# define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
+inline kwsys_ios::istream&
+operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
+}
+# endif
+# endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */
+
+# if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
+
+/* Output stream operator implementation functions. */
+namespace @KWSYS_NAMESPACE@
+{
+kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
+ IOStreamSLL);
+kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
+ IOStreamULL);
+}
+
+/* Provide output stream operator for long long. */
+# if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_LONG_LONG) && \
+ !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
+# define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
+# define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED
+inline kwsys_ios::ostream&
+operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
+}
+# endif
+
+/* Provide output stream operator for unsigned long long. */
+# if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) && \
+ !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
+# define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
+# define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
+inline kwsys_ios::ostream&
+operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
+}
+# endif
+# endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */
+#endif /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */
+
+/* Undefine temporary macros. */
+#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
+# undef kwsysEXPORT
+# undef kwsys_ios
+#endif
+
+/* If building a C++ file in kwsys itself, give the source file
+ access to the macros without a configured namespace. */
+#if defined(KWSYS_NAMESPACE)
+# define KWSYS_IOS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG
+# define KWSYS_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
+# define KWSYS_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
+# define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
+#endif
+
+#endif
+
diff --git a/Source/kwsys/Process.h.in b/Source/kwsys/Process.h.in
index 3d2db7b475..26ff75e0eb 100644
--- a/Source/kwsys/Process.h.in
+++ b/Source/kwsys/Process.h.in
@@ -33,6 +33,7 @@
#define kwsysProcess_SetTimeout kwsys_ns(Process_SetTimeout)
#define kwsysProcess_SetWorkingDirectory kwsys_ns(Process_SetWorkingDirectory)
#define kwsysProcess_SetPipeFile kwsys_ns(Process_SetPipeFile)
+#define kwsysProcess_SetPipeNative kwsys_ns(Process_SetPipeNative)
#define kwsysProcess_SetPipeShared kwsys_ns(Process_SetPipeShared)
#define kwsysProcess_Option_Detach kwsys_ns(Process_Option_Detach)
#define kwsysProcess_Option_HideWindow kwsys_ns(Process_Option_HideWindow)
@@ -71,6 +72,7 @@
#define kwsysProcess_Pipe_STDOUT kwsys_ns(Process_Pipe_STDOUT)
#define kwsysProcess_Pipe_STDERR kwsys_ns(Process_Pipe_STDERR)
#define kwsysProcess_Pipe_Timeout kwsys_ns(Process_Pipe_Timeout)
+#define kwsysProcess_Pipe_Handle kwsys_ns(Process_Pipe_Handle)
#define kwsysProcess_WaitForExit kwsys_ns(Process_WaitForExit)
#define kwsysProcess_Kill kwsys_ns(Process_Kill)
@@ -84,6 +86,13 @@ extern "C"
*/
typedef struct kwsysProcess_s kwsysProcess;
+/* Platform-specific pipe handle type. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+typedef void* kwsysProcess_Pipe_Handle;
+#else
+typedef int kwsysProcess_Pipe_Handle;
+#endif
+
/**
* Create a new Process instance.
*/
@@ -146,6 +155,27 @@ kwsysEXPORT void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe,
int shared);
/**
+ * Specify a platform-specific native pipe for use as one of the child
+ * interface pipes. The native pipe is specified by an array of two
+ * descriptors or handles. The first entry in the array (index 0)
+ * should be the read end of the pipe. The second entry in the array
+ * (index 1) should be the write end of the pipe. If a null pointer
+ * is given the option will be disabled.
+ *
+ * For Pipe_STDIN the native pipe is connected to the first child in
+ * the pipeline as its stdin. After the children are created the
+ * write end of the pipe will be closed in the child process and the
+ * read end will be closed in the parent process.
+ *
+ * For Pipe_STDOUT and Pipe_STDERR the pipe is connected to the last
+ * child as its stdout or stderr. After the children are created the
+ * write end of the pipe will be closed in the parent process and the
+ * read end will be closed in the child process.
+ */
+kwsysEXPORT void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe,
+ kwsysProcess_Pipe_Handle p[2]);
+
+/**
* Get/Set a possibly platform-specific option. Possible options are:
*
* kwsysProcess_Option_Detach = Whether to detach the process.
@@ -349,6 +379,7 @@ kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
# undef kwsysProcess_SetTimeout
# undef kwsysProcess_SetWorkingDirectory
# undef kwsysProcess_SetPipeFile
+# undef kwsysProcess_SetPipeNative
# undef kwsysProcess_SetPipeShared
# undef kwsysProcess_Option_Detach
# undef kwsysProcess_Option_HideWindow
@@ -387,6 +418,7 @@ kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
# undef kwsysProcess_Pipe_STDOUT
# undef kwsysProcess_Pipe_STDERR
# undef kwsysProcess_Pipe_Timeout
+# undef kwsysProcess_Pipe_Handle
# undef kwsysProcess_WaitForExit
# undef kwsysProcess_Kill
#endif
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index ea257b0d2b..d4b874962a 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -47,6 +47,7 @@ do.
*/
+#include <stddef.h> /* ptrdiff_t */
#include <stdio.h> /* snprintf */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* strdup, strerror, memset */
@@ -62,6 +63,18 @@ do.
#include <dirent.h> /* DIR, dirent */
#include <ctype.h> /* isspace */
+#if defined(KWSYS_C_HAS_PTRDIFF_T) && KWSYS_C_HAS_PTRDIFF_T
+typedef ptrdiff_t kwsysProcess_ptrdiff_t;
+#else
+typedef int kwsysProcess_ptrdiff_t;
+#endif
+
+#if defined(KWSYS_C_HAS_SSIZE_T) && KWSYS_C_HAS_SSIZE_T
+typedef ssize_t kwsysProcess_ssize_t;
+#else
+typedef int kwsysProcess_ssize_t;
+#endif
+
/* The number of pipes for the child's output. The standard stdout
and stderr pipes are the first two. One more pipe is used to
detect when the child process has terminated. The third pipe is
@@ -102,6 +115,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
kwsysProcessCreateInformation* si, int* readEnd);
static void kwsysProcessDestroy(kwsysProcess* cp);
static int kwsysProcessSetupOutputPipeFile(int* p, const char* name);
+static int kwsysProcessSetupOutputPipeNative(int* p, int des[2]);
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
kwsysProcessTime* timeoutTime);
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
@@ -217,6 +231,11 @@ struct kwsysProcess_s
int PipeSharedSTDOUT;
int PipeSharedSTDERR;
+ /* Native pipes provided by the user. */
+ int PipeNativeSTDIN[2];
+ int PipeNativeSTDOUT[2];
+ int PipeNativeSTDERR[2];
+
/* The real working directory of this process. */
int RealWorkingDirectoryLength;
char* RealWorkingDirectory;
@@ -236,6 +255,14 @@ kwsysProcess* kwsysProcess_New(void)
/* Share stdin with the parent process by default. */
cp->PipeSharedSTDIN = 1;
+ /* No native pipes by default. */
+ cp->PipeNativeSTDIN[0] = -1;
+ cp->PipeNativeSTDIN[1] = -1;
+ cp->PipeNativeSTDOUT[0] = -1;
+ cp->PipeNativeSTDOUT[1] = -1;
+ cp->PipeNativeSTDERR[0] = -1;
+ cp->PipeNativeSTDERR[1] = -1;
+
/* Set initial status. */
cp->State = kwsysProcess_State_Starting;
@@ -354,8 +381,8 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
{
/* Copy each argument string individually. */
char const* const* c = command;
- int n = 0;
- int i = 0;
+ kwsysProcess_ptrdiff_t n = 0;
+ kwsysProcess_ptrdiff_t i = 0;
while(*c++);
n = c - command - 1;
newCommands[cp->NumberOfCommands] = (char**)malloc((n+1)*sizeof(char*));
@@ -470,9 +497,11 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
strcpy(*pfile, file);
}
- /* If we are redirecting the pipe, do not share it. */
+ /* If we are redirecting the pipe, do not share it or use a native
+ pipe. */
if(*pfile)
{
+ kwsysProcess_SetPipeNative(cp, prPipe, 0);
kwsysProcess_SetPipeShared(cp, prPipe, 0);
}
return 1;
@@ -494,10 +523,51 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared)
default: return;
}
- /* If we are sharing the pipe, do not redirect it to a file. */
+ /* If we are sharing the pipe, do not redirect it to a file or use a
+ native pipe. */
if(shared)
{
kwsysProcess_SetPipeFile(cp, prPipe, 0);
+ kwsysProcess_SetPipeNative(cp, prPipe, 0);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, int p[2])
+{
+ int* pPipeNative = 0;
+
+ if(!cp)
+ {
+ return;
+ }
+
+ switch(prPipe)
+ {
+ case kwsysProcess_Pipe_STDIN: pPipeNative = cp->PipeNativeSTDIN; break;
+ case kwsysProcess_Pipe_STDOUT: pPipeNative = cp->PipeNativeSTDOUT; break;
+ case kwsysProcess_Pipe_STDERR: pPipeNative = cp->PipeNativeSTDERR; break;
+ default: return;
+ }
+
+ /* Copy the native pipe descriptors provided. */
+ if(p)
+ {
+ pPipeNative[0] = p[0];
+ pPipeNative[1] = p[1];
+ }
+ else
+ {
+ pPipeNative[0] = -1;
+ pPipeNative[1] = -1;
+ }
+
+ /* If we are using a native pipe, do not share it or redirect it to
+ a file. */
+ if(p)
+ {
+ kwsysProcess_SetPipeFile(cp, prPipe, 0);
+ kwsysProcess_SetPipeShared(cp, prPipe, 0);
}
}
@@ -684,6 +754,19 @@ void kwsysProcess_Execute(kwsysProcess* cp)
si.StdErr = 2;
}
+ /* Replace the stderr pipe with the native pipe provided if any. In
+ this case the select call will report that stderr is closed
+ immediately. */
+ if(cp->PipeNativeSTDERR[1] >= 0)
+ {
+ if(!kwsysProcessSetupOutputPipeNative(&si.StdErr, cp->PipeNativeSTDERR))
+ {
+ kwsysProcessCleanup(cp, 1);
+ kwsysProcessCleanupDescriptor(&si.StdErr);
+ return;
+ }
+ }
+
/* The timeout period starts now. */
cp->StartTime = kwsysProcessTimeGetCurrent();
cp->TimeoutTime.tv_sec = -1;
@@ -834,7 +917,7 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
if(cp->PipeReadEnds[i] >= 0 &&
FD_ISSET(cp->PipeReadEnds[i], &cp->PipeSet))
{
- int n;
+ kwsysProcess_ssize_t n;
/* We are handling this pipe now. Remove it from the set. */
FD_CLR(cp->PipeReadEnds[i], &cp->PipeSet);
@@ -1297,6 +1380,19 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
{
si->StdIn = 0;
}
+ else if(cp->PipeNativeSTDIN[0] >= 0)
+ {
+ si->StdIn = cp->PipeNativeSTDIN[0];
+
+ /* Set close-on-exec flag on the pipe's ends. The read end will
+ be dup2-ed into the stdin descriptor after the fork but before
+ the exec. */
+ if((fcntl(cp->PipeNativeSTDIN[0], F_SETFD, FD_CLOEXEC) < 0) ||
+ (fcntl(cp->PipeNativeSTDIN[1], F_SETFD, FD_CLOEXEC) < 0))
+ {
+ return 0;
+ }
+ }
else
{
si->StdIn = -1;
@@ -1340,6 +1436,17 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
si->StdOut = 1;
}
+ /* Replace the stdout pipe with the native pipe provided if any. In
+ this case the select call will report that stdout is closed
+ immediately. */
+ if(prIndex == cp->NumberOfCommands-1 && cp->PipeNativeSTDOUT[1] >= 0)
+ {
+ if(!kwsysProcessSetupOutputPipeNative(&si->StdOut, cp->PipeNativeSTDOUT))
+ {
+ return 0;
+ }
+ }
+
/* Create the error reporting pipe. */
if(pipe(si->ErrorPipe) < 0)
{
@@ -1407,8 +1514,8 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
/* Block until the child's exec call succeeds and closes the error
pipe or writes data to the pipe to report an error. */
{
- int total = 0;
- int n = 1;
+ kwsysProcess_ssize_t total = 0;
+ kwsysProcess_ssize_t n = 1;
/* Read the entire error message up to the length of our buffer. */
while(total < KWSYSPE_PIPE_BUFFER_SIZE && n > 0)
{
@@ -1520,6 +1627,26 @@ static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
}
/*--------------------------------------------------------------------------*/
+static int kwsysProcessSetupOutputPipeNative(int* p, int des[2])
+{
+ /* Close the existing descriptor. */
+ kwsysProcessCleanupDescriptor(p);
+
+ /* Set close-on-exec flag on the pipe's ends. The proper end will
+ be dup2-ed into the standard descriptor number after fork but
+ before exec. */
+ if((fcntl(des[0], F_SETFD, FD_CLOEXEC) < 0) ||
+ (fcntl(des[1], F_SETFD, FD_CLOEXEC) < 0))
+ {
+ return 0;
+ }
+
+ /* Assign the replacement descriptor. */
+ *p = des[1];
+ return 1;
+}
+
+/*--------------------------------------------------------------------------*/
/* Get the time at which either the process or user timeout will
expire. Returns 1 if the user timeout is first, and 0 otherwise. */
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
@@ -2201,7 +2328,10 @@ static int kwsysProcessesAdd(kwsysProcess* cp)
struct sigaction newSigChldAction;
memset(&newSigChldAction, 0, sizeof(struct sigaction));
newSigChldAction.sa_sigaction = kwsysProcessesSignalHandler;
- newSigChldAction.sa_flags = SA_NOCLDSTOP | SA_RESTART | SA_SIGINFO;
+ newSigChldAction.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
+#ifdef SA_RESTART
+ newSigChldAction.sa_flags |= SA_RESTART;
+#endif
while((sigaction(SIGCHLD, &newSigChldAction,
&kwsysProcessesOldSigChldAction) < 0) &&
(errno == EINTR));
@@ -2287,7 +2417,7 @@ static int kwsysProcessAppendByte(char* local,
/* Allocate space for the character. */
if((*end - *begin) >= *size)
{
- int length = *end - *begin;
+ kwsysProcess_ptrdiff_t length = *end - *begin;
char* newBuffer = (char*)malloc(*size*2);
if(!newBuffer)
{
@@ -2325,7 +2455,7 @@ static int kwsysProcessAppendArgument(char** local,
/* Allocate space for the argument pointer. */
if((*end - *begin) >= *size)
{
- int length = *end - *begin;
+ kwsysProcess_ptrdiff_t length = *end - *begin;
char** newPointers = (char**)malloc(*size*2*sizeof(char*));
if(!newPointers)
{
@@ -2498,14 +2628,14 @@ static char** kwsysProcessParseVerbatimCommand(const char* command)
buffer. */
if(!failed)
{
- int n = pointer_end - pointer_begin;
+ kwsysProcess_ptrdiff_t n = pointer_end - pointer_begin;
newCommand = (char**)malloc((n+1)*sizeof(char*));
}
if(newCommand)
{
/* Copy the arguments into the new command buffer. */
- int n = pointer_end - pointer_begin;
+ kwsysProcess_ptrdiff_t n = pointer_end - pointer_begin;
memcpy(newCommand, pointer_begin, sizeof(char*)*n);
newCommand[n] = 0;
}
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index 6b943dc993..c5719982b5 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -13,11 +13,13 @@
=========================================================================*/
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Process.h)
+#include KWSYS_HEADER(System.h)
/* Work-around CMake dependency scanning limitation. This must
duplicate the above list of headers. */
#if 0
# include "Process.h.in"
+# include "System.h.in"
#endif
/*
@@ -63,6 +65,7 @@ Q190351 and Q150956.
#endif
#if defined(__BORLANDC__)
+# pragma warn -8004 /* assigned a value that is never used */
# pragma warn -8060 /* Assignment inside if() condition. */
#endif
@@ -103,6 +106,8 @@ static int kwsysProcessCreate(kwsysProcess* cp, int index,
static void kwsysProcessDestroy(kwsysProcess* cp, int event);
static int kwsysProcessSetupOutputPipeFile(PHANDLE handle, const char* name);
static int kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle);
+static int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2],
+ int isWrite);
static void kwsysProcessCleanupHandle(PHANDLE h);
static void kwsysProcessCleanupHandleSafe(PHANDLE h, DWORD nStdHandle);
static void kwsysProcessCleanup(kwsysProcess* cp, int error);
@@ -245,6 +250,11 @@ struct kwsysProcess_s
int PipeSharedSTDOUT;
int PipeSharedSTDERR;
+ /* Native pipes provided by the user. */
+ HANDLE PipeNativeSTDIN[2];
+ HANDLE PipeNativeSTDOUT[2];
+ HANDLE PipeNativeSTDERR[2];
+
/* Handle to automatically delete the Win9x forwarding executable. */
HANDLE Win9xHandle;
@@ -788,9 +798,11 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
strcpy(*pfile, file);
}
- /* If we are redirecting the pipe, do not share it. */
+ /* If we are redirecting the pipe, do not share it or use a native
+ pipe. */
if(*pfile)
{
+ kwsysProcess_SetPipeNative(cp, pipe, 0);
kwsysProcess_SetPipeShared(cp, pipe, 0);
}
@@ -813,10 +825,51 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe, int shared)
default: return;
}
- /* If we are sharing the pipe, do not redirect it to a file. */
+ /* If we are sharing the pipe, do not redirect it to a file or use a
+ native pipe. */
if(shared)
{
kwsysProcess_SetPipeFile(cp, pipe, 0);
+ kwsysProcess_SetPipeNative(cp, pipe, 0);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe, HANDLE p[2])
+{
+ HANDLE* pPipeNative = 0;
+
+ if(!cp)
+ {
+ return;
+ }
+
+ switch(pipe)
+ {
+ case kwsysProcess_Pipe_STDIN: pPipeNative = cp->PipeNativeSTDIN; break;
+ case kwsysProcess_Pipe_STDOUT: pPipeNative = cp->PipeNativeSTDOUT; break;
+ case kwsysProcess_Pipe_STDERR: pPipeNative = cp->PipeNativeSTDERR; break;
+ default: return;
+ }
+
+ /* Copy the native pipe handles provided. */
+ if(p)
+ {
+ pPipeNative[0] = p[0];
+ pPipeNative[1] = p[1];
+ }
+ else
+ {
+ pPipeNative[0] = 0;
+ pPipeNative[1] = 0;
+ }
+
+ /* If we are using a native pipe, do not share it or redirect it to
+ a file. */
+ if(p)
+ {
+ kwsysProcess_SetPipeFile(cp, pipe, 0);
+ kwsysProcess_SetPipeShared(cp, pipe, 0);
}
}
@@ -1018,6 +1071,21 @@ void kwsysProcess_Execute(kwsysProcess* cp)
}
}
+ /* Replace the stderr pipe with the native pipe provided if any. In
+ this case the pipe thread will still run but never report
+ data. */
+ if(cp->PipeNativeSTDERR[1])
+ {
+ if(!kwsysProcessSetupPipeNative(&si.StartupInfo.hStdError,
+ cp->PipeNativeSTDERR, 1))
+ {
+ kwsysProcessCleanup(cp, 1);
+ kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError,
+ STD_ERROR_HANDLE);
+ return;
+ }
+ }
+
/* Create the pipeline of processes. */
{
HANDLE readEnd = 0;
@@ -1620,6 +1688,15 @@ int kwsysProcessCreate(kwsysProcess* cp, int index,
return 0;
}
}
+ else if(cp->PipeNativeSTDIN[0])
+ {
+ /* Use the provided native pipe. */
+ if(!kwsysProcessSetupPipeNative(&si->StartupInfo.hStdInput,
+ cp->PipeNativeSTDIN, 0))
+ {
+ return 0;
+ }
+ }
else
{
/* Explicitly give the child no stdin. */
@@ -1678,6 +1755,18 @@ int kwsysProcessCreate(kwsysProcess* cp, int index,
}
}
+ /* Replace the stdout pipe with the native pipe provided if any. In
+ this case the pipe thread will still run but never report
+ data. */
+ if(index == cp->NumberOfCommands-1 && cp->PipeNativeSTDOUT[1])
+ {
+ if(!kwsysProcessSetupPipeNative(&si->StartupInfo.hStdOutput,
+ cp->PipeNativeSTDOUT, 1))
+ {
+ return 0;
+ }
+ }
+
/* Create the child process. */
{
BOOL r;
@@ -1927,6 +2016,25 @@ int kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle)
}
/*--------------------------------------------------------------------------*/
+int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2], int isWrite)
+{
+ /* Close the existing inherited handle. */
+ kwsysProcessCleanupHandle(handle);
+
+ /* Create an inherited duplicate of the handle. This also closes
+ the non-inherited version. */
+ if(!DuplicateHandle(GetCurrentProcess(), p[isWrite? 1:0],
+ GetCurrentProcess(), handle,
+ 0, TRUE, (DUPLICATE_CLOSE_SOURCE |
+ DUPLICATE_SAME_ACCESS)))
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+/*--------------------------------------------------------------------------*/
/* Close the given handle if it is open. Reset its value to 0. */
void kwsysProcessCleanupHandle(PHANDLE h)
@@ -2085,59 +2193,9 @@ int kwsysProcessComputeCommandLength(kwsysProcess* cp,
char const* const* arg;
for(arg = command; *arg; ++arg)
{
- /* Keep track of how many backslashes have been encountered in a
- row in this argument. */
- int backslashes = 0;
- int spaces = 0;
- const char* c;
-
- /* Scan the string for spaces. If there are no spaces, we can
- pass the argument verbatim. */
- for(c=*arg; *c; ++c)
- {
- if(*c == ' ' || *c == '\t')
- {
- spaces = 1;
- break;
- }
- }
-
- /* Add the length of the argument, plus 1 for the space
- separating the arguments. */
- length += (int)strlen(*arg) + 1;
-
- if(spaces)
- {
- /* Add 2 for double quotes since spaces are present. */
- length += 2;
-
- /* Scan the string to find characters that need escaping. */
- for(c=*arg; *c; ++c)
- {
- if(*c == '\\')
- {
- /* Found a backslash. It may need to be escaped later. */
- ++backslashes;
- }
- else if(*c == '"')
- {
- /* Found a double-quote. We need to escape it and all
- immediately preceding backslashes. */
- length += backslashes + 1;
- backslashes = 0;
- }
- else
- {
- /* Found another character. This eliminates the possibility
- that any immediately preceding backslashes will be
- escaped. */
- backslashes = 0;
- }
- }
-
- /* We need to escape all ending backslashes. */
- length += backslashes;
- }
+ /* Add the length of this argument. It already includes room
+ for a separating space or terminating null. */
+ length += kwsysSystem_Shell_GetArgumentSizeForWindows(*arg, 0);
}
}
@@ -2160,87 +2218,14 @@ void kwsysProcessComputeCommandLine(kwsysProcess* cp,
char const* const* arg;
for(arg = command; *arg; ++arg)
{
- /* Keep track of how many backslashes have been encountered in a
- row in an argument. */
- int backslashes = 0;
- int spaces = 0;
- const char* c;
-
- /* Scan the string for spaces. If there are no spaces, we can
- pass the argument verbatim. */
- for(c=*arg; *c; ++c)
- {
- if(*c == ' ' || *c == '\t')
- {
- spaces = 1;
- break;
- }
- }
-
/* Add the separating space if this is not the first argument. */
if(arg != command)
{
*cmd++ = ' ';
}
- if(spaces)
- {
- /* Add the opening double-quote for this argument. */
- *cmd++ = '"';
-
- /* Add the characters of the argument, possibly escaping them. */
- for(c=*arg; *c; ++c)
- {
- if(*c == '\\')
- {
- /* Found a backslash. It may need to be escaped later. */
- ++backslashes;
- *cmd++ = '\\';
- }
- else if(*c == '"')
- {
- /* Add enough backslashes to escape any that preceded the
- double-quote. */
- while(backslashes > 0)
- {
- --backslashes;
- *cmd++ = '\\';
- }
-
- /* Add the backslash to escape the double-quote. */
- *cmd++ = '\\';
-
- /* Add the double-quote itself. */
- *cmd++ = '"';
- }
- else
- {
- /* We encountered a normal character. This eliminates any
- escaping needed for preceding backslashes. Add the
- character. */
- backslashes = 0;
- *cmd++ = *c;
- }
- }
-
- /* Add enough backslashes to escape any trailing ones. */
- while(backslashes > 0)
- {
- --backslashes;
- *cmd++ = '\\';
- }
-
- /* Add the closing double-quote for this argument. */
- *cmd++ = '"';
- }
- else
- {
- /* No spaces. Add the argument verbatim. */
- for(c=*arg; *c; ++c)
- {
- *cmd++ = *c;
- }
- }
+ /* Add the current argument. */
+ cmd = kwsysSystem_Shell_GetArgumentForWindows(*arg, cmd, 0);
}
/* Add the terminating null character to the command line. */
diff --git a/Source/kwsys/Registry.cxx b/Source/kwsys/Registry.cxx
index a4e8d027d7..dcfec52ec1 100644
--- a/Source/kwsys/Registry.cxx
+++ b/Source/kwsys/Registry.cxx
@@ -36,6 +36,8 @@
#include <ctype.h> // for isspace
#include <stdio.h>
+#include <string.h> /* strlen, strncpy */
+#include <stdlib.h> /* getenv */
#ifdef _WIN32
# include <windows.h>
@@ -210,13 +212,13 @@ bool Registry::ReadValue(const char *subkey,
const char *key,
const char **value)
{
- *value = 0;
bool res = false;
bool open = false;
if ( ! value )
{
return res;
}
+ *value = 0;
if ( !m_Opened )
{
if ( !this->Open(this->GetTopLevel(), subkey,
diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in
index 67ad58c2fd..921a24064c 100644
--- a/Source/kwsys/SharedForward.h.in
+++ b/Source/kwsys/SharedForward.h.in
@@ -26,6 +26,7 @@
#define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL "../lib/foo-1.2"
#define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD "foo-real"
#define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL "../lib/foo-1.2/foo-real"
+ #define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND "--command"
#define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT "--print"
#define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD "--ldd"
#if defined(CMAKE_INTDIR)
@@ -36,12 +37,32 @@
{
return @KWSYS_NAMESPACE@_shared_forward_to_real(argc, argv);
}
- */
+
+ Specify search and executable paths relative to the forwarding
+ executable location or as full paths. Include no trailing slash.
+ In the case of a multi-configuration build, when CMAKE_INTDIR is
+ defined, the build-tree paths should be specified relative to the
+ directory above the executable (the one containing the
+ per-configuration subdirectory specified by CMAKE_INTDIR).
+
+ Additional paths may be specified in the PATH_BUILD and PATH_INSTALL
+ variables by using comma-separated strings. Paths pointing at build
+ trees should contain CMAKE_INTDIR as necessary. For example:
+
+ #if defined(CMAKE_INTDIR)
+ # define CONFIG_DIR "/" CMAKE_INTDIR
+ #else
+ # define CONFIG_DIR ""
+ #endif
+ #define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD \
+ "." CONFIG_DIR, "/path/to/bar-build" CONFIG_DIR
+ #define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL \
+ "../lib/foo-1.2", "../lib/bar-4.5"
+
+ See the comments below for specific explanations of each macro.
+*/
/*--------------------------------------------------------------------------*/
-/* Configuration for this executable. Specify search and executable
- paths relative to the forwarding executable location or as full
- paths. Include no trailing slash. */
/* Full path to the directory in which this executable is built. Do
not include a trailing slash. */
@@ -91,6 +112,15 @@
# undef KWSYS_SHARED_FORWARD_CONFIG_NAME
#endif
+/* Create command line option to replace executable. */
+#if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND)
+# if !defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND)
+# define KWSYS_SHARED_FORWARD_OPTION_COMMAND @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND
+# endif
+#else
+# undef KWSYS_SHARED_FORWARD_OPTION_COMMAND
+#endif
+
/* Create command line option to print environment setting and exit. */
#if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT)
# if !defined(KWSYS_SHARED_FORWARD_OPTION_PRINT)
@@ -274,14 +304,6 @@ static void kwsys_shared_forward_strerror(char* message)
/*--------------------------------------------------------------------------*/
/* Functions to execute a child process. */
-static void kwsys_shared_forward_execv(const char* cmd, char* const argv[])
-{
-#if defined(_MSC_VER)
- _execv(cmd, argv);
-#else
- execv(cmd, argv);
-#endif
-}
static void kwsys_shared_forward_execvp(const char* cmd, char* const argv[])
{
#if defined(_MSC_VER)
@@ -611,6 +633,27 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv)
/* Store the environment variable. */
putenv(kwsys_shared_forward_ldpath);
+#if defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND)
+ /* Look for the command line replacement option. */
+ if(argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_COMMAND) == 0)
+ {
+ if(argc > 2)
+ {
+ /* Use the command line given. */
+ strcpy(exe, argv[2]);
+ argv += 2;
+ argc -= 2;
+ }
+ else
+ {
+ /* The option was not given an executable. */
+ fprintf(stderr, "Option " KWSYS_SHARED_FORWARD_OPTION_COMMAND
+ " must be followed by a command line.\n");
+ return 1;
+ }
+ }
+#endif
+
#if defined(KWSYS_SHARED_FORWARD_OPTION_PRINT)
/* Look for the print command line option. */
if(argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_PRINT) == 0)
@@ -644,7 +687,7 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv)
/* Replace this process with the real executable. */
argv[0] = exe;
- kwsys_shared_forward_execv(argv[0], argv);
+ kwsys_shared_forward_execvp(argv[0], argv);
/* Report why execution failed. */
kwsys_shared_forward_print_failure(argv);
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
new file mode 100644
index 0000000000..33e1149280
--- /dev/null
+++ b/Source/kwsys/System.c
@@ -0,0 +1,460 @@
+/*=========================================================================
+
+ Program: KWSys - Kitware System Library
+ Module: $RCSfile$
+
+ Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "kwsysPrivate.h"
+#include KWSYS_HEADER(System.h)
+
+/* Work-around CMake dependency scanning limitation. This must
+ duplicate the above list of headers. */
+#if 0
+# include "System.h.in"
+#endif
+
+#include <string.h> /* strlen */
+#include <ctype.h> /* isalpha */
+
+#include <stdio.h>
+
+/*
+
+Notes:
+
+Make variable replacements open a can of worms. Sometimes they should
+be quoted and sometimes not. Sometimes their replacement values are
+already quoted.
+
+VS variables cause problems. In order to pass the referenced value
+with spaces the reference must be quoted. If the variable value ends
+in a backslash then it will escape the ending quote! In order to make
+the ending backslash appear we need this:
+
+ "$(InputDir)\"
+
+However if there is not a trailing backslash then this will put a
+quote in the value so we need:
+
+ "$(InputDir)"
+
+Make variable references are platform specific so we should probably
+just NOT quote them and let the listfile author deal with it.
+
+*/
+
+/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__CharIsWhitespace(char c)
+{
+ return ((c == ' ') || (c == '\t'));
+}
+
+/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
+{
+ return ((c == '\'') || (c == '`') || (c == ';') ||
+ (c == '&') || (c == '$') || (c == '(') || (c == ')'));
+}
+
+/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
+{
+ /* On Windows the built-in command shell echo never needs quotes. */
+ if(!isUnix && (flags & kwsysSystem_Shell_Flag_EchoWindows))
+ {
+ return 0;
+ }
+
+ /* On all platforms quotes are needed to preserve whitespace. */
+ if(kwsysSystem_Shell__CharIsWhitespace(c))
+ {
+ return 1;
+ }
+
+ if(isUnix)
+ {
+ /* On UNIX several special characters need quotes to preserve them. */
+ if(kwsysSystem_Shell__CharNeedsQuotesOnUnix(c))
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ /* On Windows single-quotes must be escaped in some make
+ environments, such as in mingw32-make. */
+ if(flags & kwsysSystem_Shell_Flag_Make)
+ {
+ if(c == '\'')
+ {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__CharIsMakeVariableName(char c)
+{
+ return c && (c == '_' || isalpha(((int)c)));
+}
+
+/*--------------------------------------------------------------------------*/
+static const char* kwsysSystem_Shell__SkipMakeVariables(const char* c)
+{
+ while(*c == '$' && *(c+1) == '(')
+ {
+ const char* skip = c+2;
+ while(kwsysSystem_Shell__CharIsMakeVariableName(*skip))
+ {
+ ++skip;
+ }
+ if(*skip == ')')
+ {
+ c = skip+1;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return c;
+}
+
+/*
+Allowing make variable replacements opens a can of worms. Sometimes
+they should be quoted and sometimes not. Sometimes their replacement
+values are already quoted or contain escapes.
+
+Some Visual Studio variables cause problems. In order to pass the
+referenced value with spaces the reference must be quoted. If the
+variable value ends in a backslash then it will escape the ending
+quote! In order to make the ending backslash appear we need this:
+
+ "$(InputDir)\"
+
+However if there is not a trailing backslash then this will put a
+quote in the value so we need:
+
+ "$(InputDir)"
+
+This macro decides whether we quote an argument just because it
+contains a make variable reference. This should be replaced with a
+flag later when we understand applications of this better.
+*/
+#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
+
+/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
+ int flags)
+{
+ /* Scan the string for characters that require quoting. */
+ const char* c;
+ for(c=in; *c; ++c)
+ {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
+ {
+#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES
+ const char* skip = kwsysSystem_Shell__SkipMakeVariables(c);
+ if(skip != c)
+ {
+ /* We need to quote make variable references to preserve the
+ string with contents substituted in its place. */
+ return 1;
+ }
+#else
+ /* Skip over the make variable references if any are present. */
+ c = kwsysSystem_Shell__SkipMakeVariables(c);
+
+ /* Stop if we have reached the end of the string. */
+ if(!*c)
+ {
+ break;
+ }
+#endif
+ }
+
+ /* Check whether this character needs quotes. */
+ if(kwsysSystem_Shell__CharNeedsQuotes(*c, isUnix, flags))
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__GetArgumentSize(const char* in,
+ int isUnix, int flags)
+{
+ /* Start with the length of the original argument, plus one for
+ either a terminating null or a separating space. */
+ int size = (int)strlen(in) + 1;
+
+ /* String iterator. */
+ const char* c;
+
+ /* Keep track of how many backslashes have been encountered in a row. */
+ int windows_backslashes = 0;
+
+ /* Scan the string for characters that require escaping or quoting. */
+ for(c=in; *c; ++c)
+ {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
+ {
+ /* Skip over the make variable references if any are present. */
+ c = kwsysSystem_Shell__SkipMakeVariables(c);
+
+ /* Stop if we have reached the end of the string. */
+ if(!*c)
+ {
+ break;
+ }
+ }
+
+ /* Check whether this character needs escaping. */
+ if(isUnix)
+ {
+ /* On Unix a few special characters need escaping even inside a
+ quoted argument. */
+ if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
+ {
+ /* This character needs a backslash to escape it. */
+ ++size;
+ }
+ }
+ else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
+ {
+ /* On Windows the built-in command shell echo never needs escaping. */
+ }
+ else
+ {
+ /* On Windows only backslashes and double-quotes need escaping. */
+ if(*c == '\\')
+ {
+ /* Found a backslash. It may need to be escaped later. */
+ ++windows_backslashes;
+ }
+ else if(*c == '"')
+ {
+ /* Found a double-quote. We need to escape it and all
+ immediately preceding backslashes. */
+ size += windows_backslashes + 1;
+ windows_backslashes = 0;
+ }
+ else
+ {
+ /* Found another character. This eliminates the possibility
+ that any immediately preceding backslashes will be
+ escaped. */
+ windows_backslashes = 0;
+ }
+ }
+
+ /* The dollar sign needs special handling in some environments. */
+ if(*c == '$')
+ {
+ if(flags & kwsysSystem_Shell_Flag_Make)
+ {
+ /* In Makefiles a dollar is written $$ so we need one extra
+ character. */
+ ++size;
+ }
+ else if(flags & kwsysSystem_Shell_Flag_VSIDE)
+ {
+ /* In a VS IDE a dollar is written "$" so we need two extra
+ characters. */
+ size += 2;
+ }
+ }
+ }
+
+ /* Check whether the argument needs surrounding quotes. */
+ if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags))
+ {
+ /* Surrounding quotes are needed. Allocate space for them. */
+ size += 2;
+
+ /* We must escape all ending backslashes when quoting on windows. */
+ size += windows_backslashes;
+ }
+
+ return size;
+}
+
+/*--------------------------------------------------------------------------*/
+static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
+ int isUnix, int flags)
+{
+ /* String iterator. */
+ const char* c;
+
+ /* Keep track of how many backslashes have been encountered in a row. */
+ int windows_backslashes = 0;
+
+ /* Whether the argument must be quoted. */
+ int needQuotes = kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags);
+ if(needQuotes)
+ {
+ /* Add the opening quote for this argument. */
+ *out++ = '"';
+ }
+
+ /* Scan the string for characters that require escaping or quoting. */
+ for(c=in; *c; ++c)
+ {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
+ {
+ const char* skip = kwsysSystem_Shell__SkipMakeVariables(c);
+ if(skip != c)
+ {
+ /* Copy to the end of the make variable references. */
+ while(c != skip)
+ {
+ *out++ = *c++;
+ }
+
+ /* Stop if we have reached the end of the string. */
+ if(!*c)
+ {
+ break;
+ }
+ }
+ }
+
+ /* Check whether this character needs escaping. */
+ if(isUnix)
+ {
+ /* On Unix a few special characters need escaping even inside a
+ quoted argument. */
+ if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
+ {
+ /* This character needs a backslash to escape it. */
+ *out++ = '\\';
+ }
+ }
+ else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
+ {
+ /* On Windows the built-in command shell echo never needs escaping. */
+ }
+ else
+ {
+ /* On Windows only backslashes and double-quotes need escaping. */
+ if(*c == '\\')
+ {
+ /* Found a backslash. It may need to be escaped later. */
+ ++windows_backslashes;
+ }
+ else if(*c == '"')
+ {
+ /* Found a double-quote. Escape all immediately preceding
+ backslashes. */
+ while(windows_backslashes > 0)
+ {
+ --windows_backslashes;
+ *out++ = '\\';
+ }
+
+ /* Add the backslash to escape the double-quote. */
+ *out++ = '\\';
+ }
+ else
+ {
+ /* We encountered a normal character. This eliminates any
+ escaping needed for preceding backslashes. */
+ windows_backslashes = 0;
+ }
+ }
+
+ /* The dollar sign needs special handling in some environments. */
+ if(*c == '$')
+ {
+ if(flags & kwsysSystem_Shell_Flag_Make)
+ {
+ /* In Makefiles a dollar is written $$. The make tool will
+ replace it with just $ before passing it to the shell. */
+ *out++ = '$';
+ *out++ = '$';
+ }
+ else if(flags & kwsysSystem_Shell_Flag_VSIDE)
+ {
+ /* In a VS IDE a dollar is written "$". If this is written in
+ an un-quoted argument it starts a quoted segment, inserts
+ the $ and ends the segment. If it is written in a quoted
+ argument it ends quoting, inserts the $ and restarts
+ quoting. Either way the $ is isolated from surrounding
+ text to avoid looking like a variable reference. */
+ *out++ = '"';
+ *out++ = '$';
+ *out++ = '"';
+ }
+ else
+ {
+ /* Otherwise a dollar is written just $. */
+ *out++ = '$';
+ }
+ }
+ else
+ {
+ /* Store this character. */
+ *out++ = *c;
+ }
+ }
+
+ if(needQuotes)
+ {
+ /* Add enough backslashes to escape any trailing ones. */
+ while(windows_backslashes > 0)
+ {
+ --windows_backslashes;
+ *out++ = '\\';
+ }
+
+ /* Add the closing quote for this argument. */
+ *out++ = '"';
+ }
+
+ /* Store a terminating null without incrementing. */
+ *out = 0;
+
+ return out;
+}
+
+/*--------------------------------------------------------------------------*/
+char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
+ char* out,
+ int flags)
+{
+ return kwsysSystem_Shell__GetArgument(in, out, 0, flags);
+}
+
+/*--------------------------------------------------------------------------*/
+char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
+ char* out,
+ int flags)
+{
+ return kwsysSystem_Shell__GetArgument(in, out, 1, flags);
+}
+
+/*--------------------------------------------------------------------------*/
+int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, int flags)
+{
+ return kwsysSystem_Shell__GetArgumentSize(in, 0, flags);
+}
+
+/*--------------------------------------------------------------------------*/
+int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, int flags)
+{
+ return kwsysSystem_Shell__GetArgumentSize(in, 1, flags);
+}
diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in
new file mode 100644
index 0000000000..8c7d2a857e
--- /dev/null
+++ b/Source/kwsys/System.h.in
@@ -0,0 +1,113 @@
+/*=========================================================================
+
+ Program: KWSys - Kitware System Library
+ Module: $RCSfile$
+
+ Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef @KWSYS_NAMESPACE@_System_h
+#define @KWSYS_NAMESPACE@_System_h
+
+#include <@KWSYS_NAMESPACE@/Configure.h>
+
+/* Redefine all public interface symbol names to be in the proper
+ namespace. These macros are used internally to kwsys only, and are
+ not visible to user code. Use kwsysHeaderDump.pl to reproduce
+ these macros after making changes to the interface. */
+#if !defined(KWSYS_NAMESPACE)
+# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
+# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
+#endif
+#define kwsysSystem_Shell_GetArgumentForWindows kwsys_ns(System_Shell_GetArgumentForWindows)
+#define kwsysSystem_Shell_GetArgumentForUnix kwsys_ns(System_Shell_GetArgumentForUnix)
+#define kwsysSystem_Shell_GetArgumentSizeForWindows kwsys_ns(System_Shell_GetArgumentSizeForWindows)
+#define kwsysSystem_Shell_GetArgumentSizeForUnix kwsys_ns(System_Shell_GetArgumentSizeForUnix)
+#define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e)
+#define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
+#define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
+#define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
+#define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+/**
+ * Transform the given command line argument for use in a Windows or
+ * Unix shell. Returns a pointer to the end of the command line
+ * argument in the provided output buffer. Flags may be passed to
+ * modify the generated quoting and escape sequences to work under
+ * alternative environments.
+ */
+kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
+ char* out,
+ int flags);
+kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
+ char* out,
+ int flags);
+
+/**
+ * Compute the size of the buffer required to store the output from
+ * kwsysSystem_Shell_GetArgumentForWindows or
+ * kwsysSystem_Shell_GetArgumentForUnix. The flags passed must be
+ * identical between the two calls.
+ */
+kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in,
+ int flags);
+kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in,
+ int flags);
+
+/**
+ * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or
+ * kwsysSystem_Shell_GetArgumentForUnix. These modify the generated
+ * quoting and escape sequences to work under alternative
+ * environments.
+ */
+enum kwsysSystem_Shell_Flag_e
+{
+ /** The target shell is in a makefile. */
+ kwsysSystem_Shell_Flag_Make = (1<<0),
+
+ /** The target shell is in a VS project file. Do not use with
+ Shell_Flag_Make. */
+ kwsysSystem_Shell_Flag_VSIDE = (1<<1),
+
+ /** In a windows whell the argument is being passed to "echo". */
+ kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
+
+ /** Make variable reference syntax $(MAKEVAR) should not be escaped
+ to allow a build tool to replace it. Replacement values
+ containing spaces, quotes, backslashes, or other
+ non-alphanumeric characters that have significance to some makes
+ or shells produce undefined behavior. */
+ kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<3)
+};
+
+#if defined(__cplusplus)
+} /* extern "C" */
+#endif
+
+/* If we are building a kwsys .c or .cxx file, let it use these macros.
+ Otherwise, undefine them to keep the namespace clean. */
+#if !defined(KWSYS_NAMESPACE)
+# undef kwsys_ns
+# undef kwsysEXPORT
+# undef kwsysSystem_Shell_GetArgumentForWindows
+# undef kwsysSystem_Shell_GetArgumentForUnix
+# undef kwsysSystem_Shell_GetArgumentSizeForWindows
+# undef kwsysSystem_Shell_GetArgumentSizeForUnix
+# undef kwsysSystem_Shell_Flag_e
+# undef kwsysSystem_Shell_Flag_Make
+# undef kwsysSystem_Shell_Flag_VSIDE
+# undef kwsysSystem_Shell_Flag_EchoWindows
+# undef kwsysSystem_Shell_Flag_AllowMakeVariables
+#endif
+
+#endif
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 8d95811b29..86873fb80b 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -337,6 +337,10 @@ const char* SystemTools::GetExecutableExtension()
bool SystemTools::MakeDirectory(const char* path)
{
+ if(!path)
+ {
+ return false;
+ }
if(SystemTools::FileExists(path))
{
return true;
@@ -1366,18 +1370,32 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
{
ret.erase(pos, 1);
}
- // now escape spaces if there is a space in the path
- if(ret.find(" ") != kwsys_stl::string::npos)
+ // escape spaces and () in the path
+ if(ret.find_first_of(" ()") != kwsys_stl::string::npos)
{
kwsys_stl::string result = "";
char lastch = 1;
+ bool inDollarVariable = false;
for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
{
// if it is already escaped then don't try to escape it again
- if(*ch == ' ' && lastch != '\\')
+ if((*ch == ' ' || *ch == '(' || *ch == ')') && lastch != '\\')
+ {
+ if(*ch == '(' && lastch == '$')
+ {
+ inDollarVariable = true;
+ }
+ // if we are in a $(..... and we get a ) then do not escape
+ // the ) and but set inDollarVariable to false
+ else if(*ch == ')' && inDollarVariable)
+ {
+ inDollarVariable = false;
+ }
+ else
{
result += '\\';
}
+ }
result += *ch;
lastch = *ch;
}
@@ -1764,7 +1782,7 @@ long int SystemTools::CreationTime(const char* filename)
bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt)
{
- if (!str || !tmt || strlen(str) < 12)
+ if (!str || !tmt || strlen(str) > 11)
{
return false;
}
@@ -1812,7 +1830,7 @@ bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt)
bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt)
{
- if (!str || !tmt || strlen(str) < 27)
+ if (!str || !tmt || strlen(str) > 26)
{
return false;
}
@@ -2242,6 +2260,17 @@ kwsys_stl::string SystemTools
bool SystemTools::FileIsDirectory(const char* name)
{
+ // Remove any trailing slash from the name.
+ char buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
+ int last = static_cast<int>(strlen(name))-1;
+ if(last >= 0 && (name[last] == '/' || name[last] == '\\'))
+ {
+ memcpy(buffer, name, last);
+ buffer[last] = 0;
+ name = buffer;
+ }
+
+ // Now check the file node type.
struct stat fs;
if(stat(name, &fs) == 0)
{
@@ -2441,7 +2470,8 @@ void SystemTools::AddTranslationPath(const char * a, const char * b)
void SystemTools::AddKeepPath(const char* dir)
{
- kwsys_stl::string cdir = SystemTools::CollapseFullPath(dir);
+ kwsys_stl::string cdir;
+ Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir);
SystemTools::AddTranslationPath(cdir.c_str(), dir);
}
@@ -2798,20 +2828,36 @@ void SystemTools::SplitPath(const char* p,
kwsys_stl::string
SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components)
{
+ return SystemTools::JoinPath(components.begin(), components.end());
+}
+
+//----------------------------------------------------------------------------
+kwsys_stl::string
+SystemTools
+::JoinPath(kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
+ kwsys_stl::vector<kwsys_stl::string>::const_iterator last)
+{
+ // Construct result in a single string.
kwsys_stl::string result;
- if(components.size() > 0)
+
+ // The first two components do not add a slash.
+ if(first != last)
{
- result += components[0];
+ result += *first++;
}
- if(components.size() > 1)
+ if(first != last)
{
- result += components[1];
+ result += *first++;
}
- for(unsigned int i=2; i < components.size(); ++i)
+
+ // All remaining components are always separated with a slash.
+ while(first != last)
{
result += "/";
- result += components[i];
+ result += *first++;
}
+
+ // Return the concatenated result.
return result;
}
@@ -3348,7 +3394,7 @@ kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format)
time_t t;
time(&t);
strftime(buf, sizeof(buf), format, localtime(&t));
- return buf;
+ return kwsys_stl::string(buf);
}
kwsys_stl::string SystemTools::MakeCindentifier(const char* s)
@@ -3374,39 +3420,49 @@ kwsys_stl::string SystemTools::MakeCindentifier(const char* s)
// Due to a buggy stream library on the HP and another on Mac OSX, we
// need this very carefully written version of getline. Returns true
// if any data were read before the end-of-file was reached.
-bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, kwsys_stl::string& line,
- bool *has_newline /* = 0 */)
+bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
+ kwsys_stl::string& line,
+ bool* has_newline /* = 0 */)
{
const int bufferSize = 1024;
char buffer[bufferSize];
- line = "";
bool haveData = false;
- if ( has_newline )
- {
- *has_newline = false;
- }
+ bool haveNewline = false;
+
+ // Start with an empty line.
+ line = "";
// If no characters are read from the stream, the end of file has
- // been reached.
- while((is.getline(buffer, bufferSize), is.gcount() > 0))
+ // been reached. Clear the fail bit just before reading.
+ while(!haveNewline &&
+ (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
+ is.getline(buffer, bufferSize), is.gcount() > 0))
{
+ // We have read at least one byte.
haveData = true;
- line.append(buffer);
- // If newline character was read, the gcount includes the
- // character, but the buffer does not. The end of line has been
- // reached.
- if(strlen(buffer) < static_cast<size_t>(is.gcount()))
+ // If newline character was read the gcount includes the character
+ // but the buffer does not: the end of line has been reached.
+ size_t length = strlen(buffer);
+ if(length < static_cast<size_t>(is.gcount()))
{
- if ( has_newline )
+ haveNewline = true;
+ }
+
+ // Avoid storing a carriage return character.
+ if(length > 0 && buffer[length-1] == '\r')
{
- *has_newline = true;
+ buffer[length-1] = 0;
}
- break;
+
+ // Append the data read to the line.
+ line.append(buffer);
}
- // The fail bit may be set. Clear it.
- is.clear(is.rdstate() & ~kwsys_ios::ios::failbit);
+ // Return the results.
+ if(has_newline)
+ {
+ *has_newline = haveNewline;
}
return haveData;
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index b18bc5bc76..948424f8c0 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -256,6 +256,20 @@ public:
static kwsys_stl::string ConvertToOutputPath(const char*);
/**
+ * Convert the path to a string that can be used in a unix makefile.
+ * double slashes are removed, and spaces are escaped.
+ */
+ static kwsys_stl::string ConvertToUnixOutputPath(const char*);
+
+ /**
+ * Convert the path to string that can be used in a windows project or
+ * makefile. Double slashes are removed if they are not at the start of
+ * the string, the slashes are converted to windows style backslashes, and
+ * if there are spaces in the string it is double quoted.
+ */
+ static kwsys_stl::string ConvertToWindowsOutputPath(const char*);
+
+ /**
* Return true if a file exists in the current directory
*/
static bool FileExists(const char* filename);
@@ -350,6 +364,9 @@ public:
*/
static kwsys_stl::string JoinPath(
const kwsys_stl::vector<kwsys_stl::string>& components);
+ static kwsys_stl::string JoinPath(
+ kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
+ kwsys_stl::vector<kwsys_stl::string>::const_iterator last);
/**
* Compare a path or components of a path.
@@ -429,12 +446,6 @@ public:
*/
static bool IsSubDirectory(const char* fileOrDir, const char* dir);
- /**
- * Convert the path to a string that can be used in a unix makefile.
- * double slashes are removed, and spaces are escaped.
- */
- static kwsys_stl::string ConvertToUnixOutputPath(const char*);
-
/** -----------------------------------------------------------------
* File Manipulation Routines
* -----------------------------------------------------------------
@@ -754,17 +765,6 @@ public:
static void ConvertWindowsCommandLineToUnixArguments(
const char *cmd_line, int *argc, char ***argv);
-protected:
- // these two functions can be called from ConvertToOutputPath
-
- /**
- * Convert the path to string that can be used in a windows project or
- * makefile. Double slashes are removed if they are not at the start of
- * the string, the slashes are converted to windows style backslashes, and
- * if there are spaces in the string it is double quoted.
- */
- static kwsys_stl::string ConvertToWindowsOutputPath(const char*);
-
private:
/**
* Allocate the std::map that serve as the Path Translation table.
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index 59b223591f..dad32722d4 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -144,14 +144,17 @@ static const char* kwsysTerminalVT100Names[] =
"console",
"cygwin",
"konsole",
+ "konsole-256color",
"linux",
"msys",
"rxvt",
"rxvt-unicode",
"screen",
+ "screen-256color",
"vt100",
"xterm",
"xterm-color",
+ "xterm-256color",
0
};
diff --git a/Source/kwsys/kwsysPlatformTests.cmake b/Source/kwsys/kwsysPlatformTests.cmake
new file mode 100644
index 0000000000..5c942af256
--- /dev/null
+++ b/Source/kwsys/kwsysPlatformTests.cmake
@@ -0,0 +1,153 @@
+SET(KWSYS_PLATFORM_TEST_FILE_C kwsysPlatformTestsC.c)
+SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx)
+
+MACRO(KWSYS_PLATFORM_TEST lang var description invert)
+ IF("${var}_COMPILED" MATCHES "^${var}_COMPILED$")
+ MESSAGE(STATUS "${description}")
+ TRY_COMPILE(${var}_COMPILED
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}}
+ COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS}
+ OUTPUT_VARIABLE OUTPUT)
+ IF(${var}_COMPILED)
+ FILE(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "${description} compiled with the following output:\n${OUTPUT}\n\n")
+ ELSE(${var}_COMPILED)
+ FILE(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${description} failed to compile with the following output:\n${OUTPUT}\n\n")
+ ENDIF(${var}_COMPILED)
+ IF(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ MESSAGE(STATUS "${description} - no")
+ ELSE(${var}_COMPILED)
+ MESSAGE(STATUS "${description} - yes")
+ ENDIF(${var}_COMPILED)
+ ELSE(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ MESSAGE(STATUS "${description} - yes")
+ ELSE(${var}_COMPILED)
+ MESSAGE(STATUS "${description} - no")
+ ENDIF(${var}_COMPILED)
+ ENDIF(${invert} MATCHES INVERT)
+ ENDIF("${var}_COMPILED" MATCHES "^${var}_COMPILED$")
+ IF(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ SET(${var} 0)
+ ELSE(${var}_COMPILED)
+ SET(${var} 1)
+ ENDIF(${var}_COMPILED)
+ ELSE(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ SET(${var} 1)
+ ELSE(${var}_COMPILED)
+ SET(${var} 0)
+ ENDIF(${var}_COMPILED)
+ ENDIF(${invert} MATCHES INVERT)
+ENDMACRO(KWSYS_PLATFORM_TEST)
+
+MACRO(KWSYS_PLATFORM_TEST_RUN lang var description invert)
+ IF("${var}" MATCHES "^${var}$")
+ MESSAGE(STATUS "${description}")
+ TRY_RUN(${var} ${var}_COMPILED
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}}
+ COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS}
+ OUTPUT_VARIABLE OUTPUT)
+
+ # Note that ${var} will be a 0 return value on success.
+ IF(${var}_COMPILED)
+ IF(${var})
+ FILE(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${description} compiled but failed to run with the following output:\n${OUTPUT}\n\n")
+ ELSE(${var})
+ FILE(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "${description} compiled and ran with the following output:\n${OUTPUT}\n\n")
+ ENDIF(${var})
+ ELSE(${var}_COMPILED)
+ FILE(APPEND
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "${description} failed to compile with the following output:\n${OUTPUT}\n\n")
+ SET(${var} -1 CACHE INTERNAL "${description} failed to compile.")
+ ENDIF(${var}_COMPILED)
+
+ IF(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ IF(${var})
+ MESSAGE(STATUS "${description} - yes")
+ ELSE(${var})
+ MESSAGE(STATUS "${description} - no")
+ ENDIF(${var})
+ ELSE(${var}_COMPILED)
+ MESSAGE(STATUS "${description} - failed to compile")
+ ENDIF(${var}_COMPILED)
+ ELSE(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ IF(${var})
+ MESSAGE(STATUS "${description} - no")
+ ELSE(${var})
+ MESSAGE(STATUS "${description} - yes")
+ ENDIF(${var})
+ ELSE(${var}_COMPILED)
+ MESSAGE(STATUS "${description} - failed to compile")
+ ENDIF(${var}_COMPILED)
+ ENDIF(${invert} MATCHES INVERT)
+ ENDIF("${var}" MATCHES "^${var}$")
+
+ IF(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ IF(${var})
+ SET(${var} 1)
+ ELSE(${var})
+ SET(${var} 0)
+ ENDIF(${var})
+ ELSE(${var}_COMPILED)
+ SET(${var} 1)
+ ENDIF(${var}_COMPILED)
+ ELSE(${invert} MATCHES INVERT)
+ IF(${var}_COMPILED)
+ IF(${var})
+ SET(${var} 0)
+ ELSE(${var})
+ SET(${var} 1)
+ ENDIF(${var})
+ ELSE(${var}_COMPILED)
+ SET(${var} 0)
+ ENDIF(${var}_COMPILED)
+ ENDIF(${invert} MATCHES INVERT)
+ENDMACRO(KWSYS_PLATFORM_TEST_RUN)
+
+MACRO(KWSYS_PLATFORM_C_TEST var description invert)
+ SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_C_TEST_DEFINES})
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_C_TEST_EXTRA_FLAGS})
+ KWSYS_PLATFORM_TEST(C "${var}" "${description}" "${invert}")
+ SET(KWSYS_PLATFORM_TEST_DEFINES)
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS)
+ENDMACRO(KWSYS_PLATFORM_C_TEST)
+
+MACRO(KWSYS_PLATFORM_C_TEST_RUN var description invert)
+ SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_C_TEST_DEFINES})
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_C_TEST_EXTRA_FLAGS})
+ KWSYS_PLATFORM_TEST_RUN(C "${var}" "${description}" "${invert}")
+ SET(KWSYS_PLATFORM_TEST_DEFINES)
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS)
+ENDMACRO(KWSYS_PLATFORM_C_TEST_RUN)
+
+MACRO(KWSYS_PLATFORM_CXX_TEST var description invert)
+ SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_CXX_TEST_DEFINES})
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS})
+ KWSYS_PLATFORM_TEST(CXX "${var}" "${description}" "${invert}")
+ SET(KWSYS_PLATFORM_TEST_DEFINES)
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS)
+ENDMACRO(KWSYS_PLATFORM_CXX_TEST)
+
+MACRO(KWSYS_PLATFORM_CXX_TEST_RUN var description invert)
+ SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_CXX_TEST_DEFINES})
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS})
+ KWSYS_PLATFORM_TEST_RUN(CXX "${var}" "${description}" "${invert}")
+ SET(KWSYS_PLATFORM_TEST_DEFINES)
+ SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS)
+ENDMACRO(KWSYS_PLATFORM_CXX_TEST_RUN)
diff --git a/Source/kwsys/kwsysPlatformTestsC.c b/Source/kwsys/kwsysPlatformTestsC.c
new file mode 100644
index 0000000000..58b22f3a56
--- /dev/null
+++ b/Source/kwsys/kwsysPlatformTestsC.c
@@ -0,0 +1,51 @@
+/*
+ Macros to define main() in a cross-platform way.
+
+ Usage:
+
+ int KWSYS_PLATFORM_TEST_C_MAIN()
+ {
+ return 0;
+ }
+
+ int KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv)
+ {
+ (void)argc; (void)argv;
+ return 0;
+ }
+*/
+#if defined(__CLASSIC_C__)
+# define KWSYS_PLATFORM_TEST_C_MAIN() \
+ main()
+# define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \
+ main(argc,argv) int argc; char* argv[];
+#else
+# define KWSYS_PLATFORM_TEST_C_MAIN() \
+ main(void)
+# define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \
+ main(int argc, char* argv[])
+#endif
+
+/*--------------------------------------------------------------------------*/
+#ifdef TEST_KWSYS_C_HAS_PTRDIFF_T
+#include <stddef.h>
+int f(ptrdiff_t n) { return n > 0; }
+int KWSYS_PLATFORM_TEST_C_MAIN()
+{
+ char* p = 0;
+ ptrdiff_t d = p - p;
+ (void)d;
+ return f(p - p);
+}
+#endif
+
+/*--------------------------------------------------------------------------*/
+#ifdef TEST_KWSYS_C_HAS_SSIZE_T
+#include <unistd.h>
+int f(ssize_t n) { return (int)n; }
+int KWSYS_PLATFORM_TEST_C_MAIN()
+{
+ ssize_t n = 0;
+ return f(n);
+}
+#endif
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
new file mode 100644
index 0000000000..ccc46fe9a1
--- /dev/null
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -0,0 +1,439 @@
+// Setup for tests that use result of stl namespace test.
+#if defined(KWSYS_STL_HAVE_STD)
+# if KWSYS_STL_HAVE_STD
+# define kwsys_stl std
+# else
+# define kwsys_stl
+# endif
+#endif
+
+// Setup for tests that use iostreams.
+#if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
+# if defined(_MSC_VER)
+# pragma warning (push,1)
+# endif
+# if KWSYS_IOS_USE_ANSI
+# include <iostream>
+# else
+# include <iostream.h>
+# endif
+# if defined(_MSC_VER)
+# pragma warning (pop)
+# endif
+# if KWSYS_IOS_HAVE_STD
+# define kwsys_ios std
+# else
+# define kwsys_ios
+# endif
+#endif
+
+#ifdef TEST_KWSYS_STL_HAVE_STD
+#include <list>
+void f(std::list<int>*) {}
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_IOS_USE_ANSI
+#include <iosfwd>
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_IOS_HAVE_STD
+#include <iosfwd>
+void f(std::ostream*) {}
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_IOS_USE_SSTREAM
+#include <sstream>
+int main()
+{
+ std::ostringstream ostr;
+ ostr << "hello";
+ if(ostr.str().size() == 5)
+ {
+ return 0;
+ }
+ return -1;
+}
+#endif
+
+#ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
+#include <strstream.h>
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
+#include <strstrea.h>
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
+# include <iostream.h>
+# include <string>
+void f(ostream& os, const kwsys_stl::string& s) { os << s; }
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
+# include <iostream.h>
+# include <string>
+void f(istream& is, kwsys_stl::string& s) { is >> s; }
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
+# include <string>
+bool f(const kwsys_stl::string& s) { return s != ""; }
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
+#include <cstddef>
+void f(size_t) {}
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
+template <class T> class A;
+template <class T> int f(A<T>&);
+template <class T> class A
+{
+public:
+ // "friend int f<>(A<T>&)" would conform
+ friend int f(A<T>&);
+private:
+ int x;
+};
+
+template <class T> int f(A<T>& a) { return a.x = 0; }
+template int f(A<int>&);
+
+int main()
+{
+ A<int> a;
+ return f(a);
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
+template <class U>
+class A
+{
+public:
+ U u;
+ A(): u(0) {}
+ template <class V> V m(V* p) { return *p = u; }
+};
+
+int main()
+{
+ A<short> a;
+ int s = 1;
+ return a.m(&s);
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
+template <class T> struct A {};
+template <> struct A<int*>
+{
+ static int f() { return 0; }
+};
+int main() { return A<int*>::f(); }
+#endif
+
+#ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
+namespace N
+{
+ class A {};
+ int f(A*) { return 0; }
+}
+void f(void*);
+int main()
+{
+ N::A* a = 0;
+ return f(a);
+}
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
+#include <iterator>
+#include <list>
+void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
+#include <iterator>
+#include <list>
+void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
+#include <iterator>
+#include <list>
+void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
+#include <memory>
+template <class Alloc>
+void f(const Alloc&)
+{
+ typedef typename Alloc::size_type alloc_size_type;
+}
+int main()
+{
+ f(kwsys_stl::allocator<char>());
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
+#include <memory>
+void f(kwsys_stl::allocator::size_type const&) {}
+int main() { return 0; }
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
+#include <memory>
+template <class T, class Alloc>
+void f(const T&, const Alloc&)
+{
+ typedef typename Alloc::template rebind<T>::other alloc_type;
+}
+int main()
+{
+ f(0, kwsys_stl::allocator<char>());
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
+#include <memory>
+void f(kwsys_stl::allocator<char> const& a)
+{
+ a.max_size(sizeof(int));
+}
+int main()
+{
+ f(kwsys_stl::allocator<char>());
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
+#include <vector>
+void f(kwsys_stl::vector<int> const& v1)
+{
+ kwsys_stl::vector<int>(1, 1, v1.get_allocator());
+}
+int main()
+{
+ f(kwsys_stl::vector<int>());
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+int main()
+{
+ struct stat stat1;
+ (void)stat1.st_mtim.tv_sec;
+ (void)stat1.st_mtim.tv_nsec;
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_SAME_LONG_AND___INT64
+void function(long**) {}
+int main()
+{
+ __int64** p = 0;
+ function(p);
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_SAME_LONG_LONG_AND___INT64
+void function(long long**) {}
+int main()
+{
+ __int64** p = 0;
+ function(p);
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE
+void function(double& l, unsigned __int64 const& r)
+{
+ l = static_cast<double>(r);
+}
+
+int main()
+{
+ double tTo = 0.0;
+ unsigned __int64 tFrom = 0;
+ function(tTo, tFrom);
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
+int test_istream(kwsys_ios::istream& is, long long& x)
+{
+ return (is >> x)? 1:0;
+}
+int main()
+{
+ long long x = 0;
+ return test_istream(kwsys_ios::cin, x);
+}
+#endif
+
+#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
+int test_ostream(kwsys_ios::ostream& os, long long x)
+{
+ return (os << x)? 1:0;
+}
+int main()
+{
+ long long x = 0;
+ return test_ostream(kwsys_ios::cout, x);
+}
+#endif
+
+#ifdef TEST_KWSYS_CHAR_IS_SIGNED
+/* Return 0 for char signed and 1 for char unsigned. */
+int main()
+{
+ unsigned char uc = 255;
+ return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
+}
+#endif
+
+#ifdef TEST_KWSYS_LFS_WORKS
+/* Return 0 when LFS is available and 1 otherwise. */
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#define _LARGE_FILES
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdio.h>
+
+int main(int, char **argv)
+{
+ /* check that off_t can hold 2^63 - 1 and perform basic operations... */
+#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ if (OFF_T_64 % 2147483647 != 1)
+ return 1;
+
+ // stat breaks on SCO OpenServer
+ struct stat buf;
+ stat( argv[0], &buf );
+ if (!S_ISREG(buf.st_mode))
+ return 2;
+
+ FILE *file = fopen( argv[0], "r" );
+ off_t offset = ftello( file );
+ fseek( file, offset, SEEK_CUR );
+ fclose( file );
+ return 0;
+}
+#endif
+
+#ifdef TEST_KWSYS_CXX_TYPE_INFO
+/* Collect fundamental type information and save it to a CMake script. */
+
+/* Include limits.h to get macros indicating long long and __int64.
+ Note that certain compilers need special macros to define these
+ macros in limits.h. */
+#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
+# define _MSC_EXTENSIONS
+#endif
+#if defined(__GNUC__) && __GNUC__ < 3
+# define _GNU_SOURCE
+#endif
+#include <limits.h>
+
+#include <stdio.h>
+#include <string.h>
+
+/* Due to shell differences and limitations of ADD_DEFINITIONS the
+ KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
+ and sometimes not. This macro will make sure the value is treated
+ as a double-quoted string. */
+#define TO_STRING(x) TO_STRING0(x)
+#define TO_STRING0(x) TO_STRING1(x)
+#define TO_STRING1(x) #x
+
+void f() {}
+
+int main()
+{
+ /* Construct the output file name. Some preprocessors will add an
+ extra level of double quotes, so strip them. */
+ char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
+ char* fname = fbuf;
+ if(fname[0] == '"')
+ {
+ ++fname;
+ int len = static_cast<int>(strlen(fname));
+ if(len > 0 && fname[len-1] == '"')
+ {
+ fname[len-1] = 0;
+ }
+ }
+
+ /* Try to open the output file. */
+ if(FILE* fout = fopen(fname, "w"))
+ {
+ /* Set the size of standard types. */
+ fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
+ fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
+ fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
+ fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
+
+ /* Set the size of some non-standard but common types. */
+ /* Check for a limits.h macro for long long to see if the type exists. */
+#if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
+ fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
+#else
+ fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
+#endif
+ /* Check for a limits.h macro for __int64 to see if the type exists. */
+#if defined(_I64_MIN)
+ fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
+#else
+ fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
+#endif
+
+ /* Set the size of some pointer types. */
+ fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
+ fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
+
+ /* Set whether the native type "char" is signed or unsigned. */
+ unsigned char uc = 255;
+ fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
+ (*reinterpret_cast<char*>(&uc) < 0)?1:0);
+
+ fclose(fout);
+ return 0;
+ }
+ else
+ {
+ fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
+ fname);
+ return 1;
+ }
+}
+#endif
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index 03d63a8403..8a2a3ade04 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -23,6 +23,9 @@
# include "kwsys_ios_iostream.h.in"
#endif
+#include <stddef.h> /* size_t */
+#include <string.h> /* strcmp */
+
void* random_ptr = reinterpret_cast<void*>(0x123);
int argument(const char* arg, const char* value, void* call_data)
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index dedfe3101e..26ec5f56a4 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -23,6 +23,8 @@
# include "kwsys_ios_iostream.h.in"
#endif
+#include <string.h> /* strcmp */
+
int main(int argc, char* argv[])
{
kwsys::CommandLineArguments arg;
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index 57802b2ad7..e9fc224d06 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -30,6 +30,10 @@
# include <unistd.h>
#endif
+#if defined(__BORLANDC__)
+# pragma warn -8060 /* possibly incorrect assignment */
+#endif
+
int runChild(const char* cmd[], int state, int exception, int value,
int share, int output, int delay, double timeout, int poll,
int repeat, int disown);
@@ -196,7 +200,6 @@ int test8_grandchild(int argc, const char* argv[])
return 0;
}
-
int runChild2(kwsysProcess* kp,
const char* cmd[], int state, int exception, int value,
int share, int output, int delay, double timeout,
@@ -273,14 +276,14 @@ int runChild2(kwsysProcess* kp,
}
}
}
-
+
if(disown)
{
kwsysProcess_Disown(kp);
}
else
{
- kwsysProcess_WaitForExit(kp, 0);
+ kwsysProcess_WaitForExit(kp, 0);
}
switch (kwsysProcess_GetState(kp))
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index c4da9e142e..d633b3d83b 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -29,6 +29,8 @@
#include "testSystemTools.h"
+#include <string.h> /* strcmp */
+
//----------------------------------------------------------------------------
const char* toUnixPaths[][2] =
{
@@ -93,7 +95,7 @@ bool CheckEscapeChars(kwsys_stl::string input,
}
//----------------------------------------------------------------------------
-bool CheckDetectFileType()
+bool CheckFileOperations()
{
bool res = true;
@@ -114,6 +116,14 @@ bool CheckDetectFileType()
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
+
+ if (kwsys::SystemTools::FileLength(TEST_SYSTEMTOOLS_BIN_FILE) != 766)
+ {
+ kwsys_ios::cerr
+ << "Problem with FileLength - incorrect length for: "
+ << TEST_SYSTEMTOOLS_BIN_FILE << kwsys_ios::endl;
+ res = false;
+ }
return res;
}
@@ -156,7 +166,6 @@ bool CheckStringOperations()
kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
- delete [] cres;
kwsys_ios::cerr
<< "Problem with AppendStrings "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
@@ -168,7 +177,6 @@ bool CheckStringOperations()
kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
- delete [] cres;
kwsys_ios::cerr
<< "Problem with AppendStrings "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
@@ -188,7 +196,6 @@ bool CheckStringOperations()
kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou");
if (strcmp(cres,"Mry Hd A Lttl Lmb."))
{
- delete [] cres;
kwsys_ios::cerr
<< "Problem with RemoveChars "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
@@ -200,7 +207,6 @@ bool CheckStringOperations()
kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
if (strcmp(cres,"A"))
{
- delete [] cres;
kwsys_ios::cerr
<< "Problem with RemoveCharsButUpperHex "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
@@ -213,7 +219,6 @@ bool CheckStringOperations()
kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X');
if (strcmp(cres2,"MXry HXd A LXttlX LXmb."))
{
- delete [] cres2;
kwsys_ios::cerr
<< "Problem with ReplaceChars "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
@@ -242,7 +247,6 @@ bool CheckStringOperations()
cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb."))
{
- delete [] cres;
kwsys_ios::cerr
<< "Problem with DuplicateString "
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
@@ -259,7 +263,67 @@ bool CheckStringOperations()
<< TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
res = false;
}
+
+ kwsys_stl::vector<kwsys_stl::string> lines;
+ kwsys::SystemTools::Split("Mary Had A Little Lamb.",lines,' ');
+ if (lines[0] != "Mary" || lines[1] != "Had" ||
+ lines[2] != "A" || lines[3] != "Little" || lines[4] != "Lamb.")
+ {
+ kwsys_ios::cerr
+ << "Problem with Split "
+ << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
+ res = false;
+ }
+
+ if (kwsys::SystemTools::ConvertToWindowsOutputPath
+ ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") !=
+ "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
+ {
+ kwsys_ios::cerr
+ << "Problem with ConvertToWindowsOutputPath "
+ << kwsys_ios::endl;
+ res = false;
+ }
+ if (kwsys::SystemTools::ConvertToWindowsOutputPath
+ ("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
+ "\"\\\\grayson\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
+ {
+ kwsys_ios::cerr
+ << "Problem with ConvertToWindowsOutputPath "
+ << kwsys_ios::endl;
+ res = false;
+ }
+
+ if (kwsys::SystemTools::ConvertToUnixOutputPath
+ ("//Local Mojo/Hex Power Pack/Iffy Voodoo") !=
+ "/Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
+ {
+ kwsys_ios::cerr
+ << "Problem with ConvertToUnixOutputPath "
+ << kwsys_ios::endl;
+ res = false;
+ }
+
+ int targc;
+ char **targv;
+ kwsys::SystemTools::ConvertWindowsCommandLineToUnixArguments
+ ("\"Local Mojo\\Voodoo.asp\" -CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"", &targc, &targv);
+ if (targc != 4 || strcmp(targv[1],"Local Mojo\\Voodoo.asp") ||
+ strcmp(targv[2],"-CastHex") ||
+ strcmp(targv[3],"D:\\My Secret Mojo\\Voodoo.mp3"))
+ {
+ kwsys_ios::cerr
+ << "Problem with ConvertWindowsCommandLineToUnixArguments"
+ << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl;
+ res = false;
+ }
+ for (;targc >=0; --targc)
+ {
+ delete [] targv[targc];
+ }
+ delete [] targv;
+
return res;
}
@@ -288,7 +352,7 @@ int main(/*int argc, char* argv*/)
*checkEscapeChars[cc][2], checkEscapeChars[cc][3]);
}
- res &= CheckDetectFileType();
+ res &= CheckFileOperations();
res &= CheckStringOperations();
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 81ade768c4..fa3ee417d0 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -100,8 +100,9 @@ INCLUDE_DIRECTORIES(
INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
+INCLUDE_DIRECTORIES(SYSTEM Library/SystemDir)
-INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" "^cmMissing")
+INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile|test).*$" "^cmMissing")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library
@@ -271,6 +272,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
+
+# test elseif functionality, the mess below tries to catch problem
+# of clauses being executed early or late etc
+set (RESULT 3)
+if (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+elseif (RESULT EQUAL 3)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ if (NOT ELSEIF_RESULT EQUAL 1)
+ set (ELSEIF_RESULT 2)
+ endif (NOT ELSEIF_RESULT EQUAL 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 4)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+else (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+endif (RESULT EQUAL 1)
+
+if (NOT ELSEIF_RESULT EQUAL 2)
+ set (ELSEIF_RESULT 0)
+endif (NOT ELSEIF_RESULT EQUAL 2)
+
#
# Configure file
# (plug vars to #define so that they can be tested)
@@ -303,6 +342,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
+
#
# Create the libs and the main exe
#
diff --git a/Tests/Complex/Executable/A.cxx b/Tests/Complex/Executable/A.cxx
index 7f98319781..0cc995af0d 100644
--- a/Tests/Complex/Executable/A.cxx
+++ b/Tests/Complex/Executable/A.cxx
@@ -1,4 +1,7 @@
+// Include code from a header that should not be compiled separately.
+#include "A.hh"
+
int main()
{
- return 10;
+ return A();
}
diff --git a/Tests/Complex/Executable/A.h b/Tests/Complex/Executable/A.h
new file mode 100644
index 0000000000..25c45fcbf8
--- /dev/null
+++ b/Tests/Complex/Executable/A.h
@@ -0,0 +1,4 @@
+// This header should not be compiled directly but through inclusion
+// in A.cxx through A.hh.
+extern int A();
+int A() { return 10; }
diff --git a/Tests/Complex/Executable/A.hh b/Tests/Complex/Executable/A.hh
new file mode 100644
index 0000000000..e6bab022e7
--- /dev/null
+++ b/Tests/Complex/Executable/A.hh
@@ -0,0 +1,2 @@
+// This header should not be compiled directly but through inclusion in A.cxx
+#include "A.h"
diff --git a/Tests/Complex/Executable/A.txt b/Tests/Complex/Executable/A.txt
new file mode 100644
index 0000000000..8ee9462be0
--- /dev/null
+++ b/Tests/Complex/Executable/A.txt
@@ -0,0 +1 @@
+This file should not be compiled!
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index dae57753e2..28db54ea5c 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -19,7 +19,7 @@ ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-ADD_EXECUTABLE(A A.cxx)
+ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
ADD_EXECUTABLE(complex complex testcflags.c )
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
ADD_EXECUTABLE(complex.file complex.file.cxx)
@@ -37,6 +37,12 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
+# Test linking to static lib when a shared lib has the same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC)
+ TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
@@ -95,6 +101,14 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${CMAKE_COMMAND}
)
+# Test creating an executable that is not built by default.
+ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
+TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+
+# Test creating a custom target that builds not-in-all targets.
+ADD_CUSTOM_TARGET(notInAllCustom)
+ADD_DEPENDENCIES(notInAllCustom notInAllExe)
+
#
# Output the files required by 'complex' to a file.
#
@@ -104,6 +118,11 @@ ADD_CUSTOM_COMMAND(
#
ADD_SUBDIRECTORY(Temp)
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ ADD_EXECUTABLE(testSystemDir testSystemDir.cxx)
+ SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+
#
# Extra coverage.Not used.
#
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 816414c7cc..273e8a267a 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -23,6 +23,12 @@ extern "C" {
#include <string.h>
#endif
+#ifdef COMPLEX_TEST_LINK_STATIC
+extern "C"
+{
+ int TestLinkGetType();
+}
+#endif
int cm_passed = 0;
int cm_failed = 0;
@@ -102,7 +108,7 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a");
- orderLibs.SetLinkPrefix("lib");
+ orderLibs.AddLinkPrefix("lib");
cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, "");
@@ -438,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
+#ifdef ELSEIF_RESULT
+ cmPassed("ELSEIF did work");
+#else
+ cmFailed("ELSEIF did not work");
+#endif
+
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
@@ -1270,7 +1282,18 @@ int main()
// Test the generated file stream.
TestCMGeneratedFileSTream();
#endif
-
+
+#ifdef COMPLEX_TEST_LINK_STATIC
+ if(TestLinkGetType())
+ {
+ cmPassed("Link to static over shared worked.");
+ }
+ else
+ {
+ cmFailed("Link to static over shared failed.");
+ }
+#endif
+
// ----------------------------------------------------------------------
// Summary
diff --git a/Tests/Complex/Executable/notInAllExe.cxx b/Tests/Complex/Executable/notInAllExe.cxx
new file mode 100644
index 0000000000..70275cd513
--- /dev/null
+++ b/Tests/Complex/Executable/notInAllExe.cxx
@@ -0,0 +1,10 @@
+extern int notInAllLibFunc();
+
+int main()
+{
+ return notInAllLibFunc();
+}
+
+#if 1
+# error "This target should not be compiled by ALL."
+#endif
diff --git a/Tests/Complex/Executable/testSystemDir.cxx b/Tests/Complex/Executable/testSystemDir.cxx
new file mode 100644
index 0000000000..e4815c679a
--- /dev/null
+++ b/Tests/Complex/Executable/testSystemDir.cxx
@@ -0,0 +1,3 @@
+#include <testSystemDir.h>
+
+int main() { return foo(); }
diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt
index 3eeb1ea0fd..b0ea7a3a15 100644
--- a/Tests/Complex/Library/CMakeLists.txt
+++ b/Tests/Complex/Library/CMakeLists.txt
@@ -53,6 +53,13 @@ ELSE(${FOO_BAR_VAR} MATCHES "BAR")
MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}")
ENDIF(${FOO_BAR_VAR} MATCHES "BAR")
+# Create static and shared lib of same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_LIBRARY(CMakeTestLinkStatic STATIC TestLink.c)
+ ADD_LIBRARY(CMakeTestLinkShared SHARED TestLink.c)
+ SET_TARGET_PROPERTIES(CMakeTestLinkStatic CMakeTestLinkShared
+ PROPERTIES OUTPUT_NAME CMakeTestLink CLEAN_DIRECT_OUTPUT 1)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
#
# Attach pre-build/pre-link/post-build custom-commands to the lib.
@@ -96,3 +103,27 @@ SET_SOURCE_FILES_PROPERTIES(file2 PROPERTIES ABSTRACT 1)
INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
+# Test creating a library that is not built by default.
+ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx)
+
+# Test generation of preprocessed sources.
+IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
+ IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)
+ # Skip running this part of the test on certain platforms
+ # until they are fixed.
+ SET(MAYBE_ALL ALL)
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT)
+ IF(ARCH_COUNT GREATER 1)
+ # OSX does not support preprocessing more than one architecture.
+ SET(MAYBE_ALL)
+ ENDIF(ARCH_COUNT GREATER 1)
+
+ # Custom target to try preprocessing invocation.
+ ADD_CUSTOM_TARGET(test_preprocess ${MAYBE_ALL}
+ COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i
+ COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ ENDIF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)
+ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
diff --git a/Tests/Complex/Library/SystemDir/testSystemDir.h b/Tests/Complex/Library/SystemDir/testSystemDir.h
new file mode 100644
index 0000000000..73be3538ef
--- /dev/null
+++ b/Tests/Complex/Library/SystemDir/testSystemDir.h
@@ -0,0 +1,2 @@
+// Purposely leave off the return type to create a warning.
+foo() { return 0; }
diff --git a/Tests/Complex/Library/TestLink.c b/Tests/Complex/Library/TestLink.c
new file mode 100644
index 0000000000..25dee082f4
--- /dev/null
+++ b/Tests/Complex/Library/TestLink.c
@@ -0,0 +1,8 @@
+int TestLinkGetType()
+{
+#ifdef CMakeTestLinkShared_EXPORTS
+ return 0;
+#else
+ return 1;
+#endif
+}
diff --git a/Tests/Complex/Library/notInAllLib.cxx b/Tests/Complex/Library/notInAllLib.cxx
new file mode 100644
index 0000000000..5d928f44a6
--- /dev/null
+++ b/Tests/Complex/Library/notInAllLib.cxx
@@ -0,0 +1,5 @@
+int notInAllLibFunc() { return 0; }
+
+#if 1
+# error "This target should not be compiled by ALL."
+#endif
diff --git a/Tests/Complex/Library/test_preprocess.cmake b/Tests/Complex/Library/test_preprocess.cmake
new file mode 100644
index 0000000000..d2d9fc652a
--- /dev/null
+++ b/Tests/Complex/Library/test_preprocess.cmake
@@ -0,0 +1,7 @@
+SET(TEST_FILE CMakeFiles/create_file.dir/create_file.i)
+FILE(READ ${TEST_FILE} CONTENTS)
+IF("${CONTENTS}" MATCHES "Unable to close")
+ MESSAGE(STATUS "${TEST_FILE} created successfully!")
+ELSE("${CONTENTS}" MATCHES "Unable to close")
+ MESSAGE(FATAL_ERROR "${TEST_FILE} creation failed!")
+ENDIF("${CONTENTS}" MATCHES "Unable to close")
diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in
index c8600cb203..0b1e181a30 100644
--- a/Tests/Complex/cmTestConfigure.h.in
+++ b/Tests/Complex/cmTestConfigure.h.in
@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
+
+// test elseif
+#cmakedefine ELSEIF_RESULT
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index 81ade768c4..fa3ee417d0 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -100,8 +100,9 @@ INCLUDE_DIRECTORIES(
INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
+INCLUDE_DIRECTORIES(SYSTEM Library/SystemDir)
-INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" "^cmMissing")
+INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile|test).*$" "^cmMissing")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library
@@ -271,6 +272,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
+
+# test elseif functionality, the mess below tries to catch problem
+# of clauses being executed early or late etc
+set (RESULT 3)
+if (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+elseif (RESULT EQUAL 3)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ if (NOT ELSEIF_RESULT EQUAL 1)
+ set (ELSEIF_RESULT 2)
+ endif (NOT ELSEIF_RESULT EQUAL 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 4)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+else (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+endif (RESULT EQUAL 1)
+
+if (NOT ELSEIF_RESULT EQUAL 2)
+ set (ELSEIF_RESULT 0)
+endif (NOT ELSEIF_RESULT EQUAL 2)
+
#
# Configure file
# (plug vars to #define so that they can be tested)
@@ -303,6 +342,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
+
#
# Create the libs and the main exe
#
diff --git a/Tests/ComplexOneConfig/Executable/A.cxx b/Tests/ComplexOneConfig/Executable/A.cxx
index 7f98319781..0cc995af0d 100644
--- a/Tests/ComplexOneConfig/Executable/A.cxx
+++ b/Tests/ComplexOneConfig/Executable/A.cxx
@@ -1,4 +1,7 @@
+// Include code from a header that should not be compiled separately.
+#include "A.hh"
+
int main()
{
- return 10;
+ return A();
}
diff --git a/Tests/ComplexOneConfig/Executable/A.h b/Tests/ComplexOneConfig/Executable/A.h
new file mode 100644
index 0000000000..25c45fcbf8
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/A.h
@@ -0,0 +1,4 @@
+// This header should not be compiled directly but through inclusion
+// in A.cxx through A.hh.
+extern int A();
+int A() { return 10; }
diff --git a/Tests/ComplexOneConfig/Executable/A.hh b/Tests/ComplexOneConfig/Executable/A.hh
new file mode 100644
index 0000000000..e6bab022e7
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/A.hh
@@ -0,0 +1,2 @@
+// This header should not be compiled directly but through inclusion in A.cxx
+#include "A.h"
diff --git a/Tests/ComplexOneConfig/Executable/A.txt b/Tests/ComplexOneConfig/Executable/A.txt
new file mode 100644
index 0000000000..8ee9462be0
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/A.txt
@@ -0,0 +1 @@
+This file should not be compiled!
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index dae57753e2..28db54ea5c 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -19,7 +19,7 @@ ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-ADD_EXECUTABLE(A A.cxx)
+ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
ADD_EXECUTABLE(complex complex testcflags.c )
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
ADD_EXECUTABLE(complex.file complex.file.cxx)
@@ -37,6 +37,12 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
+# Test linking to static lib when a shared lib has the same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC)
+ TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
@@ -95,6 +101,14 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${CMAKE_COMMAND}
)
+# Test creating an executable that is not built by default.
+ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
+TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+
+# Test creating a custom target that builds not-in-all targets.
+ADD_CUSTOM_TARGET(notInAllCustom)
+ADD_DEPENDENCIES(notInAllCustom notInAllExe)
+
#
# Output the files required by 'complex' to a file.
#
@@ -104,6 +118,11 @@ ADD_CUSTOM_COMMAND(
#
ADD_SUBDIRECTORY(Temp)
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ ADD_EXECUTABLE(testSystemDir testSystemDir.cxx)
+ SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+
#
# Extra coverage.Not used.
#
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 816414c7cc..273e8a267a 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -23,6 +23,12 @@ extern "C" {
#include <string.h>
#endif
+#ifdef COMPLEX_TEST_LINK_STATIC
+extern "C"
+{
+ int TestLinkGetType();
+}
+#endif
int cm_passed = 0;
int cm_failed = 0;
@@ -102,7 +108,7 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a");
- orderLibs.SetLinkPrefix("lib");
+ orderLibs.AddLinkPrefix("lib");
cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, "");
@@ -438,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
+#ifdef ELSEIF_RESULT
+ cmPassed("ELSEIF did work");
+#else
+ cmFailed("ELSEIF did not work");
+#endif
+
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
@@ -1270,7 +1282,18 @@ int main()
// Test the generated file stream.
TestCMGeneratedFileSTream();
#endif
-
+
+#ifdef COMPLEX_TEST_LINK_STATIC
+ if(TestLinkGetType())
+ {
+ cmPassed("Link to static over shared worked.");
+ }
+ else
+ {
+ cmFailed("Link to static over shared failed.");
+ }
+#endif
+
// ----------------------------------------------------------------------
// Summary
diff --git a/Tests/ComplexOneConfig/Executable/notInAllExe.cxx b/Tests/ComplexOneConfig/Executable/notInAllExe.cxx
new file mode 100644
index 0000000000..70275cd513
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/notInAllExe.cxx
@@ -0,0 +1,10 @@
+extern int notInAllLibFunc();
+
+int main()
+{
+ return notInAllLibFunc();
+}
+
+#if 1
+# error "This target should not be compiled by ALL."
+#endif
diff --git a/Tests/ComplexOneConfig/Executable/testSystemDir.cxx b/Tests/ComplexOneConfig/Executable/testSystemDir.cxx
new file mode 100644
index 0000000000..e4815c679a
--- /dev/null
+++ b/Tests/ComplexOneConfig/Executable/testSystemDir.cxx
@@ -0,0 +1,3 @@
+#include <testSystemDir.h>
+
+int main() { return foo(); }
diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt
index 3eeb1ea0fd..b0ea7a3a15 100644
--- a/Tests/ComplexOneConfig/Library/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt
@@ -53,6 +53,13 @@ ELSE(${FOO_BAR_VAR} MATCHES "BAR")
MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}")
ENDIF(${FOO_BAR_VAR} MATCHES "BAR")
+# Create static and shared lib of same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_LIBRARY(CMakeTestLinkStatic STATIC TestLink.c)
+ ADD_LIBRARY(CMakeTestLinkShared SHARED TestLink.c)
+ SET_TARGET_PROPERTIES(CMakeTestLinkStatic CMakeTestLinkShared
+ PROPERTIES OUTPUT_NAME CMakeTestLink CLEAN_DIRECT_OUTPUT 1)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
#
# Attach pre-build/pre-link/post-build custom-commands to the lib.
@@ -96,3 +103,27 @@ SET_SOURCE_FILES_PROPERTIES(file2 PROPERTIES ABSTRACT 1)
INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
+# Test creating a library that is not built by default.
+ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx)
+
+# Test generation of preprocessed sources.
+IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
+ IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)
+ # Skip running this part of the test on certain platforms
+ # until they are fixed.
+ SET(MAYBE_ALL ALL)
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT)
+ IF(ARCH_COUNT GREATER 1)
+ # OSX does not support preprocessing more than one architecture.
+ SET(MAYBE_ALL)
+ ENDIF(ARCH_COUNT GREATER 1)
+
+ # Custom target to try preprocessing invocation.
+ ADD_CUSTOM_TARGET(test_preprocess ${MAYBE_ALL}
+ COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i
+ COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ ENDIF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)
+ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
diff --git a/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h b/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h
new file mode 100644
index 0000000000..73be3538ef
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/SystemDir/testSystemDir.h
@@ -0,0 +1,2 @@
+// Purposely leave off the return type to create a warning.
+foo() { return 0; }
diff --git a/Tests/ComplexOneConfig/Library/TestLink.c b/Tests/ComplexOneConfig/Library/TestLink.c
new file mode 100644
index 0000000000..25dee082f4
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/TestLink.c
@@ -0,0 +1,8 @@
+int TestLinkGetType()
+{
+#ifdef CMakeTestLinkShared_EXPORTS
+ return 0;
+#else
+ return 1;
+#endif
+}
diff --git a/Tests/ComplexOneConfig/Library/notInAllLib.cxx b/Tests/ComplexOneConfig/Library/notInAllLib.cxx
new file mode 100644
index 0000000000..5d928f44a6
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/notInAllLib.cxx
@@ -0,0 +1,5 @@
+int notInAllLibFunc() { return 0; }
+
+#if 1
+# error "This target should not be compiled by ALL."
+#endif
diff --git a/Tests/ComplexOneConfig/Library/test_preprocess.cmake b/Tests/ComplexOneConfig/Library/test_preprocess.cmake
new file mode 100644
index 0000000000..d2d9fc652a
--- /dev/null
+++ b/Tests/ComplexOneConfig/Library/test_preprocess.cmake
@@ -0,0 +1,7 @@
+SET(TEST_FILE CMakeFiles/create_file.dir/create_file.i)
+FILE(READ ${TEST_FILE} CONTENTS)
+IF("${CONTENTS}" MATCHES "Unable to close")
+ MESSAGE(STATUS "${TEST_FILE} created successfully!")
+ELSE("${CONTENTS}" MATCHES "Unable to close")
+ MESSAGE(FATAL_ERROR "${TEST_FILE} creation failed!")
+ENDIF("${CONTENTS}" MATCHES "Unable to close")
diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in
index c8600cb203..0b1e181a30 100644
--- a/Tests/ComplexOneConfig/cmTestConfigure.h.in
+++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in
@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
+
+// test elseif
+#cmakedefine ELSEIF_RESULT
diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt
index 81ade768c4..fa3ee417d0 100644
--- a/Tests/ComplexRelativePaths/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/CMakeLists.txt
@@ -100,8 +100,9 @@ INCLUDE_DIRECTORIES(
INCLUDE_DIRECTORIES(BEFORE
${Complex_BINARY_DIR}
)
+INCLUDE_DIRECTORIES(SYSTEM Library/SystemDir)
-INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" "^cmMissing")
+INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile|test).*$" "^cmMissing")
LINK_DIRECTORIES(
${Complex_BINARY_DIR}/Library
@@ -271,6 +272,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
+
+# test elseif functionality, the mess below tries to catch problem
+# of clauses being executed early or late etc
+set (RESULT 3)
+if (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+elseif (RESULT EQUAL 3)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ if (NOT ELSEIF_RESULT EQUAL 1)
+ set (ELSEIF_RESULT 2)
+ endif (NOT ELSEIF_RESULT EQUAL 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 4)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+else (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+endif (RESULT EQUAL 1)
+
+if (NOT ELSEIF_RESULT EQUAL 2)
+ set (ELSEIF_RESULT 0)
+endif (NOT ELSEIF_RESULT EQUAL 2)
+
#
# Configure file
# (plug vars to #define so that they can be tested)
@@ -303,6 +342,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
+
#
# Create the libs and the main exe
#
diff --git a/Tests/ComplexRelativePaths/Executable/A.cxx b/Tests/ComplexRelativePaths/Executable/A.cxx
index 7f98319781..0cc995af0d 100644
--- a/Tests/ComplexRelativePaths/Executable/A.cxx
+++ b/Tests/ComplexRelativePaths/Executable/A.cxx
@@ -1,4 +1,7 @@
+// Include code from a header that should not be compiled separately.
+#include "A.hh"
+
int main()
{
- return 10;
+ return A();
}
diff --git a/Tests/ComplexRelativePaths/Executable/A.h b/Tests/ComplexRelativePaths/Executable/A.h
new file mode 100644
index 0000000000..25c45fcbf8
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/A.h
@@ -0,0 +1,4 @@
+// This header should not be compiled directly but through inclusion
+// in A.cxx through A.hh.
+extern int A();
+int A() { return 10; }
diff --git a/Tests/ComplexRelativePaths/Executable/A.hh b/Tests/ComplexRelativePaths/Executable/A.hh
new file mode 100644
index 0000000000..e6bab022e7
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/A.hh
@@ -0,0 +1,2 @@
+// This header should not be compiled directly but through inclusion in A.cxx
+#include "A.h"
diff --git a/Tests/ComplexRelativePaths/Executable/A.txt b/Tests/ComplexRelativePaths/Executable/A.txt
new file mode 100644
index 0000000000..8ee9462be0
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/A.txt
@@ -0,0 +1 @@
+This file should not be compiled!
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
index dae57753e2..28db54ea5c 100644
--- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
@@ -19,7 +19,7 @@ ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-ADD_EXECUTABLE(A A.cxx)
+ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
ADD_EXECUTABLE(complex complex testcflags.c )
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
ADD_EXECUTABLE(complex.file complex.file.cxx)
@@ -37,6 +37,12 @@ ELSE(UNIX)
ENDIF(NOT BORLAND)
ENDIF (UNIX)
+# Test linking to static lib when a shared lib has the same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC)
+ TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
@@ -95,6 +101,14 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${CMAKE_COMMAND}
)
+# Test creating an executable that is not built by default.
+ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
+TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+
+# Test creating a custom target that builds not-in-all targets.
+ADD_CUSTOM_TARGET(notInAllCustom)
+ADD_DEPENDENCIES(notInAllCustom notInAllExe)
+
#
# Output the files required by 'complex' to a file.
#
@@ -104,6 +118,11 @@ ADD_CUSTOM_COMMAND(
#
ADD_SUBDIRECTORY(Temp)
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ ADD_EXECUTABLE(testSystemDir testSystemDir.cxx)
+ SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+
#
# Extra coverage.Not used.
#
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index 816414c7cc..273e8a267a 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -23,6 +23,12 @@ extern "C" {
#include <string.h>
#endif
+#ifdef COMPLEX_TEST_LINK_STATIC
+extern "C"
+{
+ int TestLinkGetType();
+}
+#endif
int cm_passed = 0;
int cm_failed = 0;
@@ -102,7 +108,7 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a");
- orderLibs.SetLinkPrefix("lib");
+ orderLibs.AddLinkPrefix("lib");
cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, "");
@@ -438,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
+#ifdef ELSEIF_RESULT
+ cmPassed("ELSEIF did work");
+#else
+ cmFailed("ELSEIF did not work");
+#endif
+
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
@@ -1270,7 +1282,18 @@ int main()
// Test the generated file stream.
TestCMGeneratedFileSTream();
#endif
-
+
+#ifdef COMPLEX_TEST_LINK_STATIC
+ if(TestLinkGetType())
+ {
+ cmPassed("Link to static over shared worked.");
+ }
+ else
+ {
+ cmFailed("Link to static over shared failed.");
+ }
+#endif
+
// ----------------------------------------------------------------------
// Summary
diff --git a/Tests/ComplexRelativePaths/Executable/notInAllExe.cxx b/Tests/ComplexRelativePaths/Executable/notInAllExe.cxx
new file mode 100644
index 0000000000..70275cd513
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/notInAllExe.cxx
@@ -0,0 +1,10 @@
+extern int notInAllLibFunc();
+
+int main()
+{
+ return notInAllLibFunc();
+}
+
+#if 1
+# error "This target should not be compiled by ALL."
+#endif
diff --git a/Tests/ComplexRelativePaths/Executable/testSystemDir.cxx b/Tests/ComplexRelativePaths/Executable/testSystemDir.cxx
new file mode 100644
index 0000000000..e4815c679a
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Executable/testSystemDir.cxx
@@ -0,0 +1,3 @@
+#include <testSystemDir.h>
+
+int main() { return foo(); }
diff --git a/Tests/ComplexRelativePaths/Library/CMakeLists.txt b/Tests/ComplexRelativePaths/Library/CMakeLists.txt
index 3eeb1ea0fd..b0ea7a3a15 100644
--- a/Tests/ComplexRelativePaths/Library/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/Library/CMakeLists.txt
@@ -53,6 +53,13 @@ ELSE(${FOO_BAR_VAR} MATCHES "BAR")
MESSAGE(SEND_ERROR "SET_TARGET_PROPERTIES or GET_TARGET_PROPERTY failed, FOO_BAR_VAR should be BAR, but is ${FOO_BAR_VAR}")
ENDIF(${FOO_BAR_VAR} MATCHES "BAR")
+# Create static and shared lib of same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_LIBRARY(CMakeTestLinkStatic STATIC TestLink.c)
+ ADD_LIBRARY(CMakeTestLinkShared SHARED TestLink.c)
+ SET_TARGET_PROPERTIES(CMakeTestLinkStatic CMakeTestLinkShared
+ PROPERTIES OUTPUT_NAME CMakeTestLink CLEAN_DIRECT_OUTPUT 1)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
#
# Attach pre-build/pre-link/post-build custom-commands to the lib.
@@ -96,3 +103,27 @@ SET_SOURCE_FILES_PROPERTIES(file2 PROPERTIES ABSTRACT 1)
INSTALL_FILES(/tmp .h ${Complex_BINARY_DIR}/cmTestConfigure.h)
INSTALL_FILES(/tmp .cxx ${Complex_BINARY_DIR}/cmTestConfigure.h)
+# Test creating a library that is not built by default.
+ADD_LIBRARY(notInAllLib EXCLUDE_FROM_ALL notInAllLib.cxx)
+
+# Test generation of preprocessed sources.
+IF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
+ IF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)
+ # Skip running this part of the test on certain platforms
+ # until they are fixed.
+ SET(MAYBE_ALL ALL)
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_COUNT)
+ IF(ARCH_COUNT GREATER 1)
+ # OSX does not support preprocessing more than one architecture.
+ SET(MAYBE_ALL)
+ ENDIF(ARCH_COUNT GREATER 1)
+
+ # Custom target to try preprocessing invocation.
+ ADD_CUSTOM_TARGET(test_preprocess ${MAYBE_ALL}
+ COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i
+ COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ ENDIF(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE)
+ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM)
diff --git a/Tests/ComplexRelativePaths/Library/SystemDir/testSystemDir.h b/Tests/ComplexRelativePaths/Library/SystemDir/testSystemDir.h
new file mode 100644
index 0000000000..73be3538ef
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/SystemDir/testSystemDir.h
@@ -0,0 +1,2 @@
+// Purposely leave off the return type to create a warning.
+foo() { return 0; }
diff --git a/Tests/ComplexRelativePaths/Library/TestLink.c b/Tests/ComplexRelativePaths/Library/TestLink.c
new file mode 100644
index 0000000000..25dee082f4
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/TestLink.c
@@ -0,0 +1,8 @@
+int TestLinkGetType()
+{
+#ifdef CMakeTestLinkShared_EXPORTS
+ return 0;
+#else
+ return 1;
+#endif
+}
diff --git a/Tests/ComplexRelativePaths/Library/notInAllLib.cxx b/Tests/ComplexRelativePaths/Library/notInAllLib.cxx
new file mode 100644
index 0000000000..5d928f44a6
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/notInAllLib.cxx
@@ -0,0 +1,5 @@
+int notInAllLibFunc() { return 0; }
+
+#if 1
+# error "This target should not be compiled by ALL."
+#endif
diff --git a/Tests/ComplexRelativePaths/Library/test_preprocess.cmake b/Tests/ComplexRelativePaths/Library/test_preprocess.cmake
new file mode 100644
index 0000000000..d2d9fc652a
--- /dev/null
+++ b/Tests/ComplexRelativePaths/Library/test_preprocess.cmake
@@ -0,0 +1,7 @@
+SET(TEST_FILE CMakeFiles/create_file.dir/create_file.i)
+FILE(READ ${TEST_FILE} CONTENTS)
+IF("${CONTENTS}" MATCHES "Unable to close")
+ MESSAGE(STATUS "${TEST_FILE} created successfully!")
+ELSE("${CONTENTS}" MATCHES "Unable to close")
+ MESSAGE(FATAL_ERROR "${TEST_FILE} creation failed!")
+ENDIF("${CONTENTS}" MATCHES "Unable to close")
diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in
index c8600cb203..0b1e181a30 100644
--- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in
+++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in
@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
+
+// test elseif
+#cmakedefine ELSEIF_RESULT
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 2fb4725dae..7685031514 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -68,10 +68,12 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.dvi
)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h
- DEPENDS ${PROJECT_BINARY_DIR}/doc1.dvi
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.dvi to doc1temp.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.dvi
${PROJECT_BINARY_DIR}/doc1temp.h
+ )
+ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND
+ DEPENDS ${PROJECT_BINARY_DIR}/doc1.dvi
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1temp.h to doc1.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1temp.h
${PROJECT_BINARY_DIR}/doc1.h
@@ -96,6 +98,7 @@ ADD_CUSTOM_TARGET(TDocument ALL
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.h
${PROJECT_BINARY_DIR}/doc2.h
DEPENDS ${PROJECT_BINARY_DIR}/doc1.h
+ COMMENT "Running top-level TDocument commands"
)
# Setup a pre- and post-build pair that will fail if not run in the
@@ -164,3 +167,78 @@ TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
# the CustomCommand executable really needs doc1.h
ADD_DEPENDENCIES(CustomCommand TDocument)
+##############################################################################
+# Test non-trivial command line arguments in custom commands.
+SET(EXPECTED_ARGUMENTS)
+SET(CHECK_ARGS
+ c:/posix/path
+ c:\\windows\\path
+ 'single-quotes'
+ single'quote
+ \"double-quotes\"
+ double\"quote
+ "\\;semi-colons\\;"
+ "semi\\;colon"
+ `back-ticks`
+ back`tick
+ "(parens)"
+ "(lparen"
+ "rparen)"
+ $dollar-signs$
+ dollar$sign
+ &ampersands&
+ amper&sand
+ @two-ats@
+ one@at
+ "c:/posix/path/with space"
+ "c:\\windows\\path\\with space"
+ "'single quotes with space'"
+ "single'quote with space"
+ "\"double-quotes with space\""
+ "double\"quote with space"
+ "\\;semi-colons with space\\;"
+ "semi\\;colon with space"
+ "`back-ticks` with space"
+ "back`tick with space"
+ "(parens) with space"
+ "(lparen with space"
+ "rparen) with space"
+ "$dollar-signs$ with space"
+ "dollar$sign with space"
+ "&ampersands& with space"
+ "amper&sand with space"
+ "@two-ats@ with space"
+ "one@at with space"
+ )
+FOREACH(arg ${CHECK_ARGS})
+ SET(ARG "${arg}")
+ STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}")
+ STRING(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}")
+ SET(EXPECTED_ARGUMENTS
+ "${EXPECTED_ARGUMENTS} \"${ARG}\",
+")
+ENDFOREACH(arg)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in
+ ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c
+ @ONLY IMMEDIATE)
+ADD_EXECUTABLE(check_command_line
+ ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/command_line_check
+ COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line
+ ${CHECK_ARGS}
+ VERBATIM
+ COMMENT "Checking custom command line escapes (single'quote)"
+ )
+SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/command_line_check
+ PROPERTIES SYMBOLIC 1)
+ADD_CUSTOM_TARGET(do_check_command_line ALL
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/command_line_check
+ COMMAND ${CMAKE_COMMAND} -E echo "Checking custom target command escapes"
+ COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line
+ ${CHECK_ARGS}
+ VERBATIM
+ COMMENT "Checking custom target command line escapes ($dollar-signs$)"
+ )
+ADD_DEPENDENCIES(do_check_command_line check_command_line)
diff --git a/Tests/CustomCommand/check_command_line.c.in b/Tests/CustomCommand/check_command_line.c.in
new file mode 100644
index 0000000000..72b34c7f03
--- /dev/null
+++ b/Tests/CustomCommand/check_command_line.c.in
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <string.h>
+
+const char* expected_arguments[] =
+{
+@EXPECTED_ARGUMENTS@ 0
+};
+
+int main(int argc, const char* argv[])
+{
+ const char** a = argv+1;
+ const char** e = expected_arguments;
+ (void)argc;
+ for(;*a && *e; ++a, ++e)
+ {
+ if(strcmp(*a, *e) != 0)
+ {
+ fprintf(stderr, "Argument [%s] does not match expected [%s].\n",
+ *a, *e);
+ return 1;
+ }
+ else
+ {
+ /*printf("[%s]\n", *a);*/
+ }
+ }
+ if(*a || *e)
+ {
+ fprintf(stderr, "Number of arguments does not match expected.\n");
+ return 1;
+ }
+ printf("Command line escapes work!\n");
+ return 0;
+}
diff --git a/Tests/OutOfBinary/CMakeLists.txt b/Tests/OutOfBinary/CMakeLists.txt
new file mode 100644
index 0000000000..fcf90bd0d0
--- /dev/null
+++ b/Tests/OutOfBinary/CMakeLists.txt
@@ -0,0 +1,2 @@
+ADD_LIBRARY(outlib outlib.c)
+
diff --git a/Tests/OutOfBinary/outlib.c b/Tests/OutOfBinary/outlib.c
new file mode 100644
index 0000000000..9ea579b7ae
--- /dev/null
+++ b/Tests/OutOfBinary/outlib.c
@@ -0,0 +1,2 @@
+int outlib() { return 456; }
+
diff --git a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
index 02ab4f6ea2..bbdaa557e9 100644
--- a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
+++ b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
@@ -4,7 +4,7 @@ IF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
SET(BUILD_SHARED_LIBS 1)
ADD_LIBRARY(testlib testlib.cxx)
ADD_EXECUTABLE (simple simple.cxx ../simple.cxx)
- TARGET_LINK_LIBRARIES(simple testlib)
+ TARGET_LINK_LIBRARIES(simple testlib outlib)
ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
# test getting a definition from a subdir
diff --git a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx
index c883ddcb5d..124b7f98e1 100644
--- a/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx
+++ b/Tests/OutOfSource/OutOfSourceSubdir/simple.cxx
@@ -5,9 +5,10 @@
#include "testdp.h"
extern int simple();
+extern "C" int outlib();
int main ()
-{
+{
if(simple() != 123)
{
return -3;
@@ -21,5 +22,9 @@ int main ()
{
return -1;
}
+ if(outlib() != 456)
+ {
+ return -4;
+ }
return 0;
}
diff --git a/Tests/OutOfSource/SubDir/CMakeLists.txt b/Tests/OutOfSource/SubDir/CMakeLists.txt
index 47fa54b6dc..4fc48e13d2 100644
--- a/Tests/OutOfSource/SubDir/CMakeLists.txt
+++ b/Tests/OutOfSource/SubDir/CMakeLists.txt
@@ -1,3 +1,8 @@
PROJECT(ANOTHER_PROJ)
+
+# subdir to an out of source and out of binary directory
+ADD_SUBDIRECTORY(${OutOfSource_SOURCE_DIR}/../OutOfBinary
+ ${OutOfSource_BINARY_DIR}/../OutOfBinary)
+
# subdir to a sibling dir
ADD_SUBDIRECTORY(${OutOfSource_SOURCE_DIR}/${KEN}OutOfSourceSubdir OutOfSourceSubdir )
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index c2de5b1c6c..3d8cdb8e18 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -80,6 +80,42 @@ IF(STAGE2)
MESSAGE(FATAL_ERROR "Release-configuration file installed for Debug!")
ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
+ # Check for failure of directory installation.
+ IF(WIN32 AND NOT CYGWIN)
+ SET(BAT .bat)
+ ELSE(WIN32 AND NOT CYGWIN)
+ SET(BAT)
+ ENDIF(WIN32 AND NOT CYGWIN)
+ IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
+ MESSAGE(FATAL_ERROR "Directory installation did not install TSD.h")
+ ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
+ IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
+ MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.")
+ ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
+ IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
+ MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.")
+ ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
+ EXECUTE_PROCESS(
+ COMMAND "${CMAKE_INSTALL_PREFIX}/MyTest/share/sample_script${BAT}"
+ RESULT_VARIABLE SAMPLE_SCRIPT_RESULT
+ OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT
+ )
+ IF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$")
+ MESSAGE(FATAL_ERROR "Sample script failed: [${SAMPLE_SCRIPT_RESULT}]")
+ ENDIF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$")
+ IF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
+ MESSAGE(FATAL_ERROR "Bad sample script output: [${SAMPLE_SCRIPT_OUTPUT}]")
+ ENDIF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
+
+ # Check for failure of empty directory installation.
+ IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
+ MESSAGE(FATAL_ERROR "Empty directory installation did not install.")
+ ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
+ FILE(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*")
+ IF(EMPTY_FILES)
+ MESSAGE(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].")
+ ENDIF(EMPTY_FILES)
+
# Make sure the test executable can run from the install tree.
SET_TARGET_PROPERTIES(SimpleInstallS2 PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
@@ -130,6 +166,9 @@ ELSE(STAGE2)
)
INSTALL_FILES(/MyTest/include FILES lib3.h)
+ # Test optional installation.
+ INSTALL(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL)
+
# Test configuration-specific installation.
INSTALL(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
DESTINATION MyTest/include/Release
@@ -138,6 +177,18 @@ ELSE(STAGE2)
DESTINATION MyTest/include/Debug
)
+ # Test directory installation.
+ FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
+ FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
+ INSTALL(
+ DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share
+ PATTERN "CVS" EXCLUDE
+ PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ )
+
+ # Test empty directory installation.
+ INSTALL(DIRECTORY DESTINATION MyTest/share/empty)
+
# Test user-specified install scripts.
INSTALL(
SCRIPT InstallScript1.cmake
@@ -154,7 +205,8 @@ ELSE(STAGE2)
${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake)
- SET_TARGET_PROPERTIES(test4 PROPERTIES VERSION 1.2 SOVERSION 3)
+ SET_TARGET_PROPERTIES(test4 PROPERTIES VERSION 1.2 SOVERSION 3
+ INSTALL_NAME_DIR @executable_path/../lib)
ENDIF(STAGE2)
IF(CMAKE_CONFIGURATION_TYPES)
@@ -176,6 +228,39 @@ IF(WIN32 AND NOT UNIX)
SET(CPACK_GENERATOR TGZ)
ENDIF(NOT NSIS_MAKENSIS)
ENDIF(WIN32 AND NOT UNIX)
+IF(UNIX AND NOT APPLE)
+ # SET(CPACK_GENERATOR "TGZ;STGZ")
+ # FIND_PROGRAM(found_compress
+ # NAMES compress)
+ # IF(found_compress)
+ # FIND_PROGRAM(file_command NAMES file)
+ # IF(NOT file_command)
+ # set(file_command file)
+ # ENDIF(NOT file_command)
+ # EXECUTE_PROCESS(COMMAND ${file_command} ${found_compress}
+ # OUTPUT_VARIABLE output)
+ # set(SKIP_TZ FALSE)
+ # if("${output}" MATCHES "script")
+ # set(SKIP_TZ TRUE)
+ # endif("${output}" MATCHES "script")
+ # if("${output}" MATCHES "dummy.sh")
+ # set(SKIP_TZ TRUE)
+ # endif("${output}" MATCHES "dummy.sh")
+ # if(NOT SKIP_TZ)
+ # message("compress found and it was not a script")
+ # message("output from file command: [${output}]")
+ # SET(CPACK_GENERATOR "${CPACK_GENERATOR};TZ")
+ # else(NOT SKIP_TZ)
+ # message("compress found, but it was a script so dont use it")
+ # message("output from file command: [${output}]")
+ # endif(NOT SKIP_TZ)
+ # ENDIF(found_compress)
+ FIND_PROGRAM(found_bz2
+ NAMES bzip2)
+ IF(found_bz2)
+ SET(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2")
+ ENDIF(found_bz2)
+ENDIF(UNIX AND NOT APPLE)
SET(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
diff --git a/Tests/SimpleInstall/PackageScript.cmake b/Tests/SimpleInstall/PackageScript.cmake
new file mode 100644
index 0000000000..3567a2f43b
--- /dev/null
+++ b/Tests/SimpleInstall/PackageScript.cmake
@@ -0,0 +1,10 @@
+MESSAGE("This is packaging script")
+MESSAGE("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt")
+
+FILE(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "")
+GET_CMAKE_PROPERTY(res VARIABLES)
+FOREACH(var ${res})
+ FILE(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt
+ "${var} \"${${var}}\"\n")
+ENDFOREACH(var ${res})
+
diff --git a/Tests/SimpleInstall/scripts/.gitattributes b/Tests/SimpleInstall/scripts/.gitattributes
new file mode 100644
index 0000000000..5e3db2fb3a
--- /dev/null
+++ b/Tests/SimpleInstall/scripts/.gitattributes
@@ -0,0 +1 @@
+sample_script crlf=input
diff --git a/Tests/SimpleInstall/scripts/sample_script b/Tests/SimpleInstall/scripts/sample_script
new file mode 100755
index 0000000000..81f9f53153
--- /dev/null
+++ b/Tests/SimpleInstall/scripts/sample_script
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "Sample Script Output"
diff --git a/Tests/SimpleInstall/scripts/sample_script.bat b/Tests/SimpleInstall/scripts/sample_script.bat
new file mode 100755
index 0000000000..64a77b5b0f
--- /dev/null
+++ b/Tests/SimpleInstall/scripts/sample_script.bat
@@ -0,0 +1 @@
+@echo Sample Script Output
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index c2de5b1c6c..3d8cdb8e18 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -80,6 +80,42 @@ IF(STAGE2)
MESSAGE(FATAL_ERROR "Release-configuration file installed for Debug!")
ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
+ # Check for failure of directory installation.
+ IF(WIN32 AND NOT CYGWIN)
+ SET(BAT .bat)
+ ELSE(WIN32 AND NOT CYGWIN)
+ SET(BAT)
+ ENDIF(WIN32 AND NOT CYGWIN)
+ IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
+ MESSAGE(FATAL_ERROR "Directory installation did not install TSD.h")
+ ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
+ IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
+ MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.")
+ ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
+ IF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
+ MESSAGE(FATAL_ERROR "Directory installation installed CVS directory.")
+ ENDIF(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
+ EXECUTE_PROCESS(
+ COMMAND "${CMAKE_INSTALL_PREFIX}/MyTest/share/sample_script${BAT}"
+ RESULT_VARIABLE SAMPLE_SCRIPT_RESULT
+ OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT
+ )
+ IF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$")
+ MESSAGE(FATAL_ERROR "Sample script failed: [${SAMPLE_SCRIPT_RESULT}]")
+ ENDIF(NOT "${SAMPLE_SCRIPT_RESULT}" MATCHES "^0$")
+ IF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
+ MESSAGE(FATAL_ERROR "Bad sample script output: [${SAMPLE_SCRIPT_OUTPUT}]")
+ ENDIF(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
+
+ # Check for failure of empty directory installation.
+ IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
+ MESSAGE(FATAL_ERROR "Empty directory installation did not install.")
+ ENDIF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
+ FILE(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*")
+ IF(EMPTY_FILES)
+ MESSAGE(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].")
+ ENDIF(EMPTY_FILES)
+
# Make sure the test executable can run from the install tree.
SET_TARGET_PROPERTIES(SimpleInstallS2 PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
@@ -130,6 +166,9 @@ ELSE(STAGE2)
)
INSTALL_FILES(/MyTest/include FILES lib3.h)
+ # Test optional installation.
+ INSTALL(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL)
+
# Test configuration-specific installation.
INSTALL(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
DESTINATION MyTest/include/Release
@@ -138,6 +177,18 @@ ELSE(STAGE2)
DESTINATION MyTest/include/Debug
)
+ # Test directory installation.
+ FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
+ FILE(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
+ INSTALL(
+ DIRECTORY TestSubDir scripts/ DESTINATION MyTest/share
+ PATTERN "CVS" EXCLUDE
+ PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ )
+
+ # Test empty directory installation.
+ INSTALL(DIRECTORY DESTINATION MyTest/share/empty)
+
# Test user-specified install scripts.
INSTALL(
SCRIPT InstallScript1.cmake
@@ -154,7 +205,8 @@ ELSE(STAGE2)
${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake)
- SET_TARGET_PROPERTIES(test4 PROPERTIES VERSION 1.2 SOVERSION 3)
+ SET_TARGET_PROPERTIES(test4 PROPERTIES VERSION 1.2 SOVERSION 3
+ INSTALL_NAME_DIR @executable_path/../lib)
ENDIF(STAGE2)
IF(CMAKE_CONFIGURATION_TYPES)
@@ -176,6 +228,39 @@ IF(WIN32 AND NOT UNIX)
SET(CPACK_GENERATOR TGZ)
ENDIF(NOT NSIS_MAKENSIS)
ENDIF(WIN32 AND NOT UNIX)
+IF(UNIX AND NOT APPLE)
+ # SET(CPACK_GENERATOR "TGZ;STGZ")
+ # FIND_PROGRAM(found_compress
+ # NAMES compress)
+ # IF(found_compress)
+ # FIND_PROGRAM(file_command NAMES file)
+ # IF(NOT file_command)
+ # set(file_command file)
+ # ENDIF(NOT file_command)
+ # EXECUTE_PROCESS(COMMAND ${file_command} ${found_compress}
+ # OUTPUT_VARIABLE output)
+ # set(SKIP_TZ FALSE)
+ # if("${output}" MATCHES "script")
+ # set(SKIP_TZ TRUE)
+ # endif("${output}" MATCHES "script")
+ # if("${output}" MATCHES "dummy.sh")
+ # set(SKIP_TZ TRUE)
+ # endif("${output}" MATCHES "dummy.sh")
+ # if(NOT SKIP_TZ)
+ # message("compress found and it was not a script")
+ # message("output from file command: [${output}]")
+ # SET(CPACK_GENERATOR "${CPACK_GENERATOR};TZ")
+ # else(NOT SKIP_TZ)
+ # message("compress found, but it was a script so dont use it")
+ # message("output from file command: [${output}]")
+ # endif(NOT SKIP_TZ)
+ # ENDIF(found_compress)
+ FIND_PROGRAM(found_bz2
+ NAMES bzip2)
+ IF(found_bz2)
+ SET(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2")
+ ENDIF(found_bz2)
+ENDIF(UNIX AND NOT APPLE)
SET(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
diff --git a/Tests/SimpleInstallS2/PackageScript.cmake b/Tests/SimpleInstallS2/PackageScript.cmake
new file mode 100644
index 0000000000..3567a2f43b
--- /dev/null
+++ b/Tests/SimpleInstallS2/PackageScript.cmake
@@ -0,0 +1,10 @@
+MESSAGE("This is packaging script")
+MESSAGE("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt")
+
+FILE(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "")
+GET_CMAKE_PROPERTY(res VARIABLES)
+FOREACH(var ${res})
+ FILE(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt
+ "${var} \"${${var}}\"\n")
+ENDFOREACH(var ${res})
+
diff --git a/Tests/SimpleInstallS2/scripts/.gitattributes b/Tests/SimpleInstallS2/scripts/.gitattributes
new file mode 100644
index 0000000000..5e3db2fb3a
--- /dev/null
+++ b/Tests/SimpleInstallS2/scripts/.gitattributes
@@ -0,0 +1 @@
+sample_script crlf=input
diff --git a/Tests/SimpleInstallS2/scripts/sample_script b/Tests/SimpleInstallS2/scripts/sample_script
new file mode 100755
index 0000000000..81f9f53153
--- /dev/null
+++ b/Tests/SimpleInstallS2/scripts/sample_script
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "Sample Script Output"
diff --git a/Tests/SimpleInstallS2/scripts/sample_script.bat b/Tests/SimpleInstallS2/scripts/sample_script.bat
new file mode 100755
index 0000000000..64a77b5b0f
--- /dev/null
+++ b/Tests/SimpleInstallS2/scripts/sample_script.bat
@@ -0,0 +1 @@
+@echo Sample Script Output
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index 044f2716aa..3376a38663 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -75,10 +75,16 @@ FOREACH(var
FILE(APPEND "${file}" "#define ${var} \"${${var}}\"\n")
ENDFOREACH(var)
+# Verify that the file was created recently.
+IF(NOT FILE_IS_NEWER "${file}" "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in")
+ MESSAGE(FATAL_ERROR "IF(FILE_IS_NEWER) does not seem to work.")
+ENDIF(NOT FILE_IS_NEWER "${file}" "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in")
+
# Test configuration of the string
SET(TEST_DEFINED 123)
SET(TEST_NOT_DEFINED)
-STRING(CONFIGURE "${infile}" infile @ONLY)
+STRING(CONFIGURE "${infile}" infile+-/out @ONLY)
+SET(infile "${infile+-/out}")
# Write include file to a file
STRING(REGEX REPLACE "includefile" "${file}" outfile "${infile}")
diff --git a/Tests/SystemInformation/SystemInformation.in b/Tests/SystemInformation/SystemInformation.in
index 5734b807ce..c6018a87e4 100644
--- a/Tests/SystemInformation/SystemInformation.in
+++ b/Tests/SystemInformation/SystemInformation.in
@@ -24,13 +24,20 @@ CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS == "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}"
CMAKE_SHARED_LIBRARY_LINK_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_FLAGS}"
CMAKE_SHARED_LIBRARY_RUNTIME_FLAG == "${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG}"
CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP == "${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP}"
+CMAKE_SHARED_LIBRARY_LINK_STATIC_C_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_STATIC_C_FLAGS}"
+CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_C_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_C_FLAGS}"
// C shared module flags
CMAKE_SHARED_MODULE_C_FLAGS == "${CMAKE_SHARED_MODULE_C_FLAGS}"
CMAKE_SHARED_MODULE_CREATE_C_FLAGS == "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}"
-CMAKE_SHARED_MODULE_LINK_FLAGS == "${CMAKE_SHARED_MODULE_LINK_FLAGS}"
CMAKE_SHARED_MODULE_RUNTIME_FLAG == "${CMAKE_SHARED_MODULE_RUNTIME_FLAG}"
CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP == "${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP}"
+CMAKE_SHARED_MODULE_LINK_STATIC_C_FLAGS == "${CMAKE_SHARED_MODULE_LINK_STATIC_C_FLAGS}"
+CMAKE_SHARED_MODULE_LINK_DYNAMIC_C_FLAGS == "${CMAKE_SHARED_MODULE_LINK_DYNAMIC_C_FLAGS}"
+
+// C exe flags
+CMAKE_EXE_LINK_STATIC_C_FLAGS == "${CMAKE_EXE_LINK_STATIC_C_FLAGS}"
+CMAKE_EXE_LINK_DYNAMIC_C_FLAGS == "${CMAKE_EXE_LINK_DYNAMIC_C_FLAGS}"
// CXX shared library flags
CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}"
@@ -38,13 +45,20 @@ CMAKE_SHARED_LIBRARY_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}"
CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG == "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}"
CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP == "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}"
+CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS}"
+CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS}"
// CXX shared module flags
CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS == "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS}"
CMAKE_SHARED_MODULE_CXX_FLAGS == "${CMAKE_SHARED_MODULE_CXX_FLAGS}"
-CMAKE_SHARED_MODULE_LINK_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS}"
CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG == "${CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG}"
CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP == "${CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP}"
+CMAKE_SHARED_MODULE_LINK_STATIC_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_STATIC_CXX_FLAGS}"
+CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS}"
+
+// CXX exe flags
+CMAKE_EXE_LINK_STATIC_CXX_FLAGS == "${CMAKE_EXE_LINK_STATIC_CXX_FLAGS}"
+CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS}"
CMAKE_USER_MAKE_RULES_OVERRIDE == "${CMAKE_USER_MAKE_RULES_OVERRIDE}"
CMAKE_VERBOSE_MAKEFILE == "${CMAKE_VERBOSE_MAKEFILE}"
diff --git a/Utilities/Release/README b/Utilities/Release/README
index 84d8fb7df1..4ef7d9217a 100644
--- a/Utilities/Release/README
+++ b/Utilities/Release/README
@@ -1,29 +1,21 @@
1. Update Version information
- change version in CMakeLists.txt
- - build release on windows, and do a make; make install; make release // this step tags
- - this changes cmake_release.sh
- -winzip command line, nullsoft installer
-
* for major release edit Source/cmCPluginAPI.h
+ cvs tag CMake-2-4-3 in a check out of the release branch
-2. UNIX builds:
- Log into hythloth as kingb.
- cd ~kingb/Programs/releases/CMake/Utilities/Release
-# build the binaries
- ./release_dispatch.sh clean
- ./release_dispatch.sh binary
- ./release_dispatch.sh logs
-# build a second sgi for 64 bit
- ./cmake_release.sh remote_binary dashsgi1
-# now build source tar ball
- ./cmake_release.sh remote_source localhost
-# not upload the whole thing to public
- ./cmake_release.sh upload
-
+2. Log into hythloth as hoffman
+ - cvs checkout CMake and build it.
+ - cd CMake/Utilities/Release
+ - mkdir 2-4-3
+ - cd 2-4-3
+ - ~/CMake-build/bin/cmake -DCMAKE_VERSION=CMake-2-4-3 -P ../create-cmake-release.cmake
+ - ./create-CMake-2-4-3.sh
+ - ~/CMake-build/bin/cmake -P ../upload_release.cmake
3. Cygwin build:
Checkout release branch.
cd Utilities/Release
+ update the version in cmake_release.sh, and move the tag cvs tag -F CMake-2-4-3
./cmake_release.sh cygwin_package
./cmake_release.sh cygwin_upload
(now you have to send email to cygwin-apps to get it uploaded to cygwin site.)
diff --git a/Utilities/cmcompress/CMakeLists.txt b/Utilities/cmcompress/CMakeLists.txt
new file mode 100644
index 0000000000..f7aacfe005
--- /dev/null
+++ b/Utilities/cmcompress/CMakeLists.txt
@@ -0,0 +1,3 @@
+PROJECT(CMCompress)
+
+ADD_LIBRARY(cmcompress cmcompress.c)
diff --git a/Utilities/cmcompress/cmcompress.c b/Utilities/cmcompress/cmcompress.c
new file mode 100644
index 0000000000..59978f679e
--- /dev/null
+++ b/Utilities/cmcompress/cmcompress.c
@@ -0,0 +1,551 @@
+/*
+ * Copyright (c) 1985, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods, derived from original work by Spencer Thomas
+ * and Joseph Orost.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ */
+
+#include "cmcompress.h"
+
+#include <errno.h>
+#include <string.h>
+
+static const char_type magic_header[] = { "\037\235" }; /* 1F 9D */
+
+/* Defines for third byte of header */
+#define BIT_MASK 0x1f
+#define BLOCK_MASK 0x80
+#define CHECK_GAP 10000 /* ratio check interval */
+/* Masks 0x40 and 0x20 are free. I think 0x20 should mean that there is
+ a fourth header byte (for expansion).
+ */
+#define INIT_BITS 9 /* initial number of bits/code */
+
+#ifdef COMPATIBLE /* But wrong! */
+# define MAXCODE(n_bits) (1 << (n_bits) - 1)
+#else
+# define MAXCODE(n_bits) ((1 << (n_bits)) - 1)
+#endif /* COMPATIBLE */
+
+#define htabof(i) cdata->htab[i]
+#define codetabof(i) cdata->codetab[i]
+
+/*
+ * the next two codes should not be changed lightly, as they must not
+ * lie within the contiguous general code space.
+ */
+#define FIRST 257 /* first free entry */
+#define CLEAR 256 /* table clear output code */
+
+#ifdef DEBUG
+static void prratio( FILE *stream, long int num, long int den);
+#endif
+
+int cmcompress_compress_initialize(struct cmcompress_stream* cdata)
+{
+ cdata->maxbits = BITS; /* user settable max # bits/code */
+ cdata->maxmaxcode = 1 << BITS; /* should NEVER generate this code */
+ cdata->hsize = HSIZE; /* for dynamic table sizing */
+ cdata->free_ent = 0; /* first unused entry */
+ cdata->nomagic = 0; /* Use a 3-byte magic number header, unless old file */
+ cdata->block_compress = BLOCK_MASK;
+ cdata->clear_flg = 0;
+ cdata->ratio = 0;
+ cdata->checkpoint = CHECK_GAP;
+
+ cdata->input_stream = 0;
+ cdata->output_stream = 0;
+ cdata->client_data = 0;
+ return 1;
+}
+
+static void cl_hash(struct cmcompress_stream* cdata, count_int hsize) /* reset code table */
+{
+ register count_int *htab_p = cdata->htab+hsize;
+ register long i;
+ register long m1 = -1;
+
+ i = hsize - 16;
+ do
+ { /* might use Sys V memset(3) here */
+ *(htab_p-16) = m1;
+ *(htab_p-15) = m1;
+ *(htab_p-14) = m1;
+ *(htab_p-13) = m1;
+ *(htab_p-12) = m1;
+ *(htab_p-11) = m1;
+ *(htab_p-10) = m1;
+ *(htab_p-9) = m1;
+ *(htab_p-8) = m1;
+ *(htab_p-7) = m1;
+ *(htab_p-6) = m1;
+ *(htab_p-5) = m1;
+ *(htab_p-4) = m1;
+ *(htab_p-3) = m1;
+ *(htab_p-2) = m1;
+ *(htab_p-1) = m1;
+ htab_p -= 16;
+ }
+ while ((i -= 16) >= 0);
+ for ( i += 16; i > 0; i-- )
+ {
+ *--htab_p = m1;
+ }
+}
+
+/*-
+ * Output the given code.
+ * Inputs:
+ * code: A n_bits-bit integer. If == -1, then EOF. This assumes
+ * that n_bits =< (long)wordsize - 1.
+ * Outputs:
+ * Outputs code to the file.
+ * Assumptions:
+ * Chars are 8 bits long.
+ * Algorithm:
+ * Maintain a BITS character long buffer (so that 8 codes will
+ * fit in it exactly). Use the VAX insv instruction to insert each
+ * code in turn. When the buffer fills up empty it and start over.
+ */
+
+static char buf[BITS];
+
+#ifndef vax
+char_type lmask[9] = {0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00};
+char_type rmask[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
+#endif /* vax */
+
+static int output(struct cmcompress_stream* cdata, code_int code)
+{
+#ifdef DEBUG
+ static int col = 0;
+#endif /* DEBUG */
+
+ /*
+ * On the VAX, it is important to have the register declarations
+ * in exactly the order given, or the asm will break.
+ */
+ register int r_off = cdata->offset, bits= cdata->n_bits;
+ register char * bp = buf;
+
+#ifdef DEBUG
+ if ( verbose )
+ {
+ fprintf( stderr, "%5d%c", code,
+ (col+=6) >= 74 ? (col = 0, '\n') : ' ' );
+ }
+#endif /* DEBUG */
+ if ( code >= 0 )
+ {
+#if defined(vax) && !defined(__GNUC__)
+ /*
+ * VAX and PCC DEPENDENT!! Implementation on other machines is
+ * below.
+ *
+ * Translation: Insert BITS bits from the argument starting at
+ * cdata->offset bits from the beginning of buf.
+ */
+ 0; /* Work around for pcc -O bug with asm and if stmt */
+ asm( "insv 4(ap),r11,r10,(r9)" );
+#else
+ /*
+ * byte/bit numbering on the VAX is simulated by the following code
+ */
+ /*
+ * Get to the first byte.
+ */
+ bp += (r_off >> 3);
+ r_off &= 7;
+ /*
+ * Since code is always >= 8 bits, only need to mask the first
+ * hunk on the left.
+ */
+ *bp = (char)((*bp & rmask[r_off]) | ((code << r_off) & lmask[r_off]));
+ bp++;
+ bits -= (8 - r_off);
+ code >>= 8 - r_off;
+ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
+ if ( bits >= 8 )
+ {
+ *bp++ = (char)(code);
+ code >>= 8;
+ bits -= 8;
+ }
+ /* Last bits. */
+ if(bits)
+ {
+ *bp = (char)(code);
+ }
+#endif /* vax */
+ cdata->offset += cdata->n_bits;
+ if ( cdata->offset == (cdata->n_bits << 3) )
+ {
+ bp = buf;
+ bits = cdata->n_bits;
+ cdata->bytes_out += bits;
+ do
+ {
+ if ( cdata->output_stream(cdata, bp, 1) != 1 )
+ {
+ return 0;
+ }
+ bp++;
+ }
+ while(--bits);
+ cdata->offset = 0;
+ }
+
+ /*
+ * If the next entry is going to be too big for the code size,
+ * then increase it, if possible.
+ */
+ if ( cdata->free_ent > cdata->maxcode || (cdata->clear_flg > 0))
+ {
+ /*
+ * Write the whole buffer, because the input side won't
+ * discover the size increase until after it has read it.
+ */
+ if ( cdata->offset > 0 )
+ {
+ if ( cdata->output_stream(cdata, buf, cdata->n_bits) != cdata->n_bits )
+ {
+ return 0;
+ }
+ cdata->bytes_out += cdata->n_bits;
+ }
+ cdata->offset = 0;
+
+ if ( cdata->clear_flg )
+ {
+ cdata->maxcode = MAXCODE (cdata->n_bits = INIT_BITS);
+ cdata->clear_flg = 0;
+ }
+ else
+ {
+ cdata->n_bits++;
+ if ( cdata->n_bits == cdata->maxbits )
+ {
+ cdata->maxcode = cdata->maxmaxcode;
+ }
+ else
+ {
+ cdata->maxcode = MAXCODE(cdata->n_bits);
+ }
+ }
+#ifdef DEBUG
+ if ( debug )
+ {
+ fprintf( stderr, "\nChange to %d bits\n", cdata->n_bits );
+ col = 0;
+ }
+#endif /* DEBUG */
+ }
+ }
+ else
+ {
+ /*
+ * At EOF, write the rest of the buffer.
+ */
+ if ( cdata->offset > 0 )
+ {
+ cdata->offset = (cdata->offset + 7) / 8;
+ if ( cdata->output_stream(cdata, buf, cdata->offset ) != cdata->offset )
+ {
+ return 0;
+ }
+ cdata->bytes_out += cdata->offset;
+ }
+ cdata->offset = 0;
+ (void)fflush( stdout );
+ if( ferror( stdout ) )
+ {
+ return 0;
+ }
+#ifdef DEBUG
+ if ( verbose )
+ {
+ fprintf( stderr, "\n" );
+ }
+#endif
+ }
+ return 1;
+}
+
+/*
+ * compress stdin to stdout
+ *
+ * Algorithm: use open addressing double hashing (no chaining) on the
+ * prefix code / next character combination. We do a variant of Knuth's
+ * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
+ * secondary probe. Here, the modular division first probe is gives way
+ * to a faster exclusive-or manipulation. Also do block compression with
+ * an adaptive reset, whereby the code table is cleared when the compression
+ * ratio decreases, but after the table fills. The variable-length output
+ * codes are re-sized at this point, and a special CLEAR code is generated
+ * for the decompressor. Late addition: construct the table according to
+ * file size for noticeable speed improvement on small files. Please direct
+ * questions about this implementation to ames!jaw.
+ */
+
+int cmcompress_compress_start(struct cmcompress_stream* cdata)
+{
+#ifndef COMPATIBLE
+ if (cdata->nomagic == 0)
+ {
+ char headLast = (char)(cdata->maxbits | cdata->block_compress);
+ cdata->output_stream(cdata, (const char*)magic_header, 2);
+ cdata->output_stream(cdata, &headLast, 1);
+ if(ferror(stdout))
+ {
+ printf("Error...\n");
+ }
+ }
+#endif /* COMPATIBLE */
+
+ cdata->offset = 0;
+ cdata->bytes_out = 3; /* includes 3-byte header mojo */
+ cdata->out_count = 0;
+ cdata->clear_flg = 0;
+ cdata->ratio = 0;
+ cdata->in_count = 1;
+ cdata->checkpoint = CHECK_GAP;
+ cdata->maxcode = MAXCODE(cdata->n_bits = INIT_BITS);
+ cdata->free_ent = ((cdata->block_compress) ? FIRST : 256 );
+
+ cdata->first_pass = 1;
+
+ cdata->hshift = 0;
+ for ( cdata->fcode = (long) cdata->hsize; cdata->fcode < 65536L; cdata->fcode *= 2L )
+ {
+ cdata->hshift++;
+ }
+ cdata->hshift = 8 - cdata->hshift; /* set hash code range bound */
+
+ cdata->hsize_reg = cdata->hsize;
+ cl_hash(cdata, (count_int) cdata->hsize_reg); /* clear hash table */
+
+ return 1;
+}
+
+static int cl_block (struct cmcompress_stream* cdata) /* table clear for block compress */
+{
+ register long int rat;
+
+ cdata->checkpoint = cdata->in_count + CHECK_GAP;
+#ifdef DEBUG
+ if ( cdata->debug )
+ {
+ fprintf ( stderr, "count: %ld, ratio: ", cdata->in_count );
+ prratio ( stderr, cdata->in_count, cdata->bytes_out );
+ fprintf ( stderr, "\n");
+ }
+#endif /* DEBUG */
+
+ if(cdata->in_count > 0x007fffff)
+ { /* shift will overflow */
+ rat = cdata->bytes_out >> 8;
+ if(rat == 0)
+ { /* Don't divide by zero */
+ rat = 0x7fffffff;
+ }
+ else
+ {
+ rat = cdata->in_count / rat;
+ }
+ }
+ else
+ {
+ rat = (cdata->in_count << 8) / cdata->bytes_out; /* 8 fractional bits */
+ }
+ if ( rat > cdata->ratio )
+ {
+ cdata->ratio = rat;
+ }
+ else
+ {
+ cdata->ratio = 0;
+#ifdef DEBUG
+ if(cdata->verbose)
+ {
+ dump_tab(); /* dump string table */
+ }
+#endif
+ cl_hash (cdata, (count_int) cdata->hsize );
+ cdata->free_ent = FIRST;
+ cdata->clear_flg = 1;
+ if ( !output (cdata, (code_int) CLEAR ) )
+ {
+ return 0;
+ }
+#ifdef DEBUG
+ if(cdata->debug)
+ {
+ fprintf ( stderr, "clear\n" );
+ }
+#endif /* DEBUG */
+ }
+ return 1;
+}
+
+
+int cmcompress_compress(struct cmcompress_stream* cdata, void* buff, size_t n)
+{
+ register code_int i;
+ register int c;
+ register int disp;
+
+ unsigned char* input_buffer = (unsigned char*)buff;
+
+ size_t cc;
+
+ /*printf("cmcompress_compress(%p, %p, %d)\n", cdata, buff, n);*/
+
+ if ( cdata->first_pass )
+ {
+ cdata->ent = input_buffer[0];
+ ++ input_buffer;
+ -- n;
+ cdata->first_pass = 0;
+ }
+
+ for ( cc = 0; cc < n; ++ cc )
+ {
+ c = input_buffer[cc];
+ cdata->in_count++;
+ cdata->fcode = (long) (((long) c << cdata->maxbits) + cdata->ent);
+ i = ((c << cdata->hshift) ^ cdata->ent); /* xor hashing */
+
+ if ( htabof (i) == cdata->fcode )
+ {
+ cdata->ent = codetabof (i);
+ continue;
+ }
+ else if ( (long)htabof (i) < 0 ) /* empty slot */
+ {
+ goto nomatch;
+ }
+ disp = cdata->hsize_reg - i; /* secondary hash (after G. Knott) */
+ if ( i == 0 )
+ {
+ disp = 1;
+ }
+probe:
+ if ( (i -= disp) < 0 )
+ {
+ i += cdata->hsize_reg;
+ }
+
+ if ( htabof (i) == cdata->fcode )
+ {
+ cdata->ent = codetabof (i);
+ continue;
+ }
+ if ( (long)htabof (i) > 0 )
+ {
+ goto probe;
+ }
+nomatch:
+ if ( !output(cdata, (code_int) cdata->ent ) )
+ {
+ return 0;
+ }
+ cdata->out_count++;
+ cdata->ent = c;
+ if (
+#ifdef SIGNED_COMPARE_SLOW
+ (unsigned) cdata->free_ent < (unsigned) cdata->maxmaxcode
+#else
+ cdata->free_ent < cdata->maxmaxcode
+#endif
+ )
+ {
+ codetabof (i) = (unsigned short)(cdata->free_ent++); /* code -> hashtable */
+ htabof (i) = cdata->fcode;
+ }
+ else if ( (count_int)cdata->in_count >= cdata->checkpoint && cdata->block_compress )
+ {
+ if ( !cl_block (cdata) )
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+int cmcompress_compress_finalize(struct cmcompress_stream* cdata)
+{
+ /*
+ * Put out the final code.
+ */
+ if ( !output(cdata, (code_int)cdata->ent ) )
+ {
+ return 0;
+ }
+ cdata->out_count++;
+ if ( !output(cdata, (code_int)-1 ) )
+ {
+ return 0;
+ }
+
+ if(cdata->bytes_out > cdata->in_count) /* exit(2) if no savings */
+ {
+ return 0;
+ }
+ return 1;
+}
+
+
+#if defined(DEBUG)
+static void prratio(FILE *stream, long int num, long int den)
+{
+ register int q; /* Doesn't need to be long */
+
+ if(num > 214748L)
+ { /* 2147483647/10000 */
+ q = num / (den / 10000L);
+ }
+ else
+ {
+ q = 10000L * num / den; /* Long calculations, though */
+ }
+ if (q < 0)
+ {
+ putc('-', stream);
+ q = -q;
+ }
+ fprintf(stream, "%d.%02d%%", q / 100, q % 100);
+}
+#endif
+
diff --git a/Utilities/cmcompress/cmcompress.h b/Utilities/cmcompress/cmcompress.h
new file mode 100644
index 0000000000..fdb0d90b77
--- /dev/null
+++ b/Utilities/cmcompress/cmcompress.h
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 1985, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * James A. Woods, derived from original work by Spencer Thomas
+ * and Joseph Orost.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 __cmcompress__h_
+#define __cmcompress__h_
+
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /*
+ * Set USERMEM to the maximum amount of physical user memory available
+ * in bytes. USERMEM is used to determine the maximum BITS that can be used
+ * for compression.
+ *
+ * SACREDMEM is the amount of physical memory saved for others; compress
+ * will hog the rest.
+ */
+#ifndef SACREDMEM
+#define SACREDMEM 0
+#endif
+
+#ifndef USERMEM
+# define USERMEM 450000 /* default user memory */
+#endif
+
+#ifdef pdp11
+# define BITS 12 /* max bits/code for 16-bit machine */
+# define NO_UCHAR /* also if "unsigned char" functions as signed char */
+# undef USERMEM
+#endif /* pdp11 */ /* don't forget to compile with -i */
+
+#ifdef USERMEM
+# if USERMEM >= (433484+SACREDMEM)
+# define PBITS 16
+# else
+# if USERMEM >= (229600+SACREDMEM)
+# define PBITS 15
+# else
+# if USERMEM >= (127536+SACREDMEM)
+# define PBITS 14
+# else
+# if USERMEM >= (73464+SACREDMEM)
+# define PBITS 13
+# else
+# define PBITS 12
+# endif
+# endif
+# endif
+# endif
+# undef USERMEM
+#endif /* USERMEM */
+
+#ifdef PBITS /* Preferred BITS for this memory size */
+# ifndef BITS
+# define BITS PBITS
+# endif /* BITS */
+#endif /* PBITS */
+
+#if BITS == 16
+# define HSIZE 69001 /* 95% occupancy */
+#endif
+#if BITS == 15
+# define HSIZE 35023 /* 94% occupancy */
+#endif
+#if BITS == 14
+# define HSIZE 18013 /* 91% occupancy */
+#endif
+#if BITS == 13
+# define HSIZE 9001 /* 91% occupancy */
+#endif
+#if BITS <= 12
+# define HSIZE 5003 /* 80% occupancy */
+#endif
+
+ /*
+ * a code_int must be able to hold 2**BITS values of type int, and also -1
+ */
+#if BITS > 15
+ typedef long int code_int;
+#else
+ typedef int code_int;
+#endif
+
+#ifdef SIGNED_COMPARE_SLOW
+ typedef unsigned long int count_int;
+ typedef unsigned short int count_short;
+#else
+ typedef long int count_int;
+#endif
+
+#ifdef NO_UCHAR
+ typedef char char_type;
+#else
+ typedef unsigned char char_type;
+#endif /* UCHAR */
+
+
+
+ struct cmcompress_stream
+ {
+ int n_bits; /* number of bits/code */
+ int maxbits; /* user settable max # bits/code */
+ code_int maxcode; /* maximum code, given n_bits */
+ code_int maxmaxcode; /* should NEVER generate this code */
+
+ count_int htab [HSIZE];
+ unsigned short codetab [HSIZE];
+
+ code_int hsize; /* for dynamic table sizing */
+ code_int free_ent; /* first unused entry */
+ int nomagic; /* Use a 3-byte magic number header, unless old file */
+
+ /*
+ * block compression parameters -- after all codes are used up,
+ * and compression rate changes, start over.
+ */
+ int block_compress;
+ int clear_flg;
+ long int ratio;
+ count_int checkpoint;
+
+#ifdef DEBUG
+ int debug;
+ int verbose;
+#endif
+
+ /* compress internals */
+ int offset;
+ long int in_count; /* length of input */
+ long int bytes_out; /* length of compressed output */
+ long int out_count; /* # of codes output (for debugging) */
+
+ /* internals */
+ code_int ent;
+ code_int hsize_reg;
+ int hshift;
+
+ long fcode;
+ int first_pass;
+
+ /* For input and output */
+ int (*input_stream)(void*);
+ int (*output_stream)(void*, const char*,int);
+ void* client_data;
+ };
+
+ int cmcompress_compress_initialize(struct cmcompress_stream* cdata);
+ int cmcompress_compress_start(struct cmcompress_stream* cdata);
+ int cmcompress_compress(struct cmcompress_stream* cdata, void* buff, size_t n);
+ int cmcompress_compress_finalize(struct cmcompress_stream* cdata);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __cmcompress__h_ */
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 72c157d4f4..c32504f97f 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -18,6 +18,11 @@ SET(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS})
+# Disable warnings on Borland to avoid changing 3rd party code.
+IF(BORLAND)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+ENDIF(BORLAND)
+
# If we are on AIX, do the _ALL_SOURCE magic
IF(${CMAKE_SYSTEM_NAME} MATCHES AIX)
SET(_ALL_SOURCE 1)
diff --git a/Utilities/cmtar/CMakeLists.txt b/Utilities/cmtar/CMakeLists.txt
index 1c3b470502..a54e629cf7 100644
--- a/Utilities/cmtar/CMakeLists.txt
+++ b/Utilities/cmtar/CMakeLists.txt
@@ -6,6 +6,11 @@ INCLUDE_REGULAR_EXPRESSION("^.*$")
SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS})
+# Disable warnings on Borland to avoid changing 3rd party code.
+IF(BORLAND)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+ENDIF(BORLAND)
+
# If we are on AIX, do the _ALL_SOURCE magic
IF(${CMAKE_SYSTEM_NAME} MATCHES AIX)
SET(_ALL_SOURCE 1)
@@ -231,7 +236,13 @@ SET (HAVE_LIBZ 1)
#SET (HAVE_UNISTD_H 1)
SET (MAJOR_IN_MKDEV 0)
SET (MAJOR_IN_SYSMACROS 0)
+
+# for most systems makedev is two args on qnx it is three
+# try run is nothing but trouble so just hard code it
SET (MAKEDEV_THREE_ARGS 0)
+IF(QNXNTO)
+ SET(MAKEDEV_THREE_ARGS 1)
+ENDIF(QNXNTO)
#SET (NEED_BASENAME 0)
#SET (NEED_DIRNAME 0)
#SET (NEED_FNMATCH 1)
diff --git a/Utilities/cmxmlrpc/CMakeLists.txt b/Utilities/cmxmlrpc/CMakeLists.txt
index 2d96d50bb7..a29e0bd587 100644
--- a/Utilities/cmxmlrpc/CMakeLists.txt
+++ b/Utilities/cmxmlrpc/CMakeLists.txt
@@ -2,6 +2,11 @@ PROJECT(XMLRPC)
INCLUDE_REGULAR_EXPRESSION("^.*$")
+# Disable warnings on Borland to avoid changing 3rd party code.
+IF(BORLAND)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+ENDIF(BORLAND)
+
# Include all the necessary files for macros
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
diff --git a/Utilities/cmxmlrpc/xmlrpc_curl_transport.c b/Utilities/cmxmlrpc/xmlrpc_curl_transport.c
index 1190908fe8..15477cefbc 100644
--- a/Utilities/cmxmlrpc/xmlrpc_curl_transport.c
+++ b/Utilities/cmxmlrpc/xmlrpc_curl_transport.c
@@ -589,7 +589,10 @@ rpcCreate(xmlrpc_env * const envP,
destroyCurlTransaction(rpcP->curlTransactionP);
}
if (envP->fault_occurred)
- free(rpcP);
+ {
+ free(rpcP);
+ rpcP = 0; /* set this to null as it is used later on */
+ }
}
*rpcPP = rpcP;
}
diff --git a/Utilities/cmzlib/CMakeLists.txt b/Utilities/cmzlib/CMakeLists.txt
index 3dedcd42aa..f359082ccd 100644
--- a/Utilities/cmzlib/CMakeLists.txt
+++ b/Utilities/cmzlib/CMakeLists.txt
@@ -14,6 +14,11 @@ ADD_DEFINITIONS(-DCMZLIB_IN_C)
# Match all headers for dependencies but complain about none.
INCLUDE_REGULAR_EXPRESSION("^.*$")
+# Disable warnings on Borland to avoid changing 3rd party code.
+IF(BORLAND)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+ENDIF(BORLAND)
+
# source files for zlib
SET(ZLIB_SRCS
adler32.c gzio.c inftrees.c uncompr.c
diff --git a/bootstrap b/bootstrap
index d6331df284..739149daa0 100755
--- a/bootstrap
+++ b/bootstrap
@@ -17,14 +17,23 @@
#
#=========================================================================
+# Version number extraction function.
+cmake_version_component()
+{
+ cat "${cmake_source_dir}/CMakeLists.txt" | sed -n "
+/^SET(CMake_VERSION_${1}/ {s/SET(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;}
+"
+}
+
# Detect system and directory information.
cmake_system=`uname`
cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
cmake_binary_dir=`pwd`
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
-cmake_data_dir="/share/CMake"
-cmake_doc_dir="/doc/CMake"
+cmake_version="`cmake_version_component MAJOR`.`cmake_version_component MINOR`"
+cmake_data_dir="/share/cmake-${cmake_version}"
+cmake_doc_dir="/doc/cmake-${cmake_version}"
cmake_man_dir="/man"
cmake_init_file=""
@@ -147,7 +156,8 @@ CMAKE_C_SOURCES="\
if ${cmake_system_mingw}; then
KWSYS_C_SOURCES="\
- ProcessWin32"
+ ProcessWin32 \
+ System"
KWSYS_C_MINGW_SOURCES="\
ProcessFwd9x \
EncodeExecutable"
@@ -155,7 +165,8 @@ if ${cmake_system_mingw}; then
cmsysProcessFwd9xEnc"
else
KWSYS_C_SOURCES="\
- ProcessUNIX"
+ ProcessUNIX \
+ System"
KWSYS_C_MINGW_SOURCES=""
KWSYS_C_GENERATED_SOURCES=""
fi
@@ -172,6 +183,7 @@ KWSYS_FILES="\
Process.h \
RegularExpression.hxx \
String.hxx \
+ System.h \
SystemTools.hxx"
KWSYS_IOS_FILES="
@@ -279,6 +291,8 @@ cmake_kwsys_config_replace_string ()
cat "${INFILE}" |
sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
+ s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
+ s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
@@ -821,6 +835,8 @@ fi
# Test for kwsys features
KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0
+KWSYS_LFS_AVAILABLE=0
+KWSYS_LFS_REQUESTED=0
KWSYS_IOS_USE_STRSTREAM_H=0
KWSYS_IOS_USE_STRSTREA_H=0
KWSYS_IOS_HAVE_STD=0
@@ -849,7 +865,7 @@ KWSYS_STL_STRING_HAVE_OSTREAM=1
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAVE_STD" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAVE_STD=1
echo "${cmake_cxx_compiler} has STL in std:: namespace"
else
@@ -858,7 +874,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_ANSI" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_IOS_USE_ANSI=1
echo "${cmake_cxx_compiler} has ANSI streams"
else
@@ -868,7 +884,7 @@ fi
if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_IOS_HAVE_STD" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_IOS_HAVE_STD=1
echo "${cmake_cxx_compiler} has streams in std:: namespace"
else
@@ -876,7 +892,7 @@ if [ "x$KWSYS_IOS_USE_ANSI" = "x1" ]; then
fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_SSTREAM" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_IOS_USE_SSTREAM=1
echo "${cmake_cxx_compiler} has sstream"
else
@@ -887,7 +903,7 @@ fi
if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREAM_H" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_IOS_USE_STRSTREAM_H=1
echo "${cmake_cxx_compiler} has strstream.h"
else
@@ -896,7 +912,7 @@ if [ "x$KWSYS_IOS_USE_SSTREAM" = "x0" ]; then
if [ "x$KWSYS_IOS_USE_STRSTREAM_H" = "x0" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_IOS_USE_STRSTREA_H" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_IOS_USE_STRSTREA_H=1
echo "${cmake_cxx_compiler} has strstrea.h"
else
@@ -907,7 +923,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_STRING_HAVE_NEQ_CHAR=1
echo "${cmake_cxx_compiler} has operator!=(string, char*)"
else
@@ -916,7 +932,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_TRAITS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ITERATOR_TRAITS=1
echo "${cmake_cxx_compiler} has stl iterator_traits"
else
@@ -926,7 +942,7 @@ fi
if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ITERATOR_CATEGORY=1
echo "${cmake_cxx_compiler} has old iterator_category"
else
@@ -935,7 +951,7 @@ if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then
if [ "x${KWSYS_STL_HAS_ITERATOR_CATEGORY}" = "x0" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS___ITERATOR_CATEGORY=1
echo "${cmake_cxx_compiler} has old __iterator_category"
else
@@ -946,7 +962,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ALLOCATOR_TEMPLATE=1
echo "${cmake_cxx_compiler} has standard template allocator"
else
@@ -956,7 +972,7 @@ fi
if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ALLOCATOR_REBIND=1
echo "${cmake_cxx_compiler} has allocator<>::rebind<>"
else
@@ -965,7 +981,7 @@ if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT=1
echo "${cmake_cxx_compiler} has non-standard allocator<>::max_size argument"
else
@@ -974,7 +990,7 @@ if [ "x${KWSYS_STL_HAS_ALLOCATOR_TEMPLATE}" = "x1" ]; then
else
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE=1
echo "${cmake_cxx_compiler} has old non-template allocator"
else
@@ -984,7 +1000,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STL_HAS_ALLOCATOR_OBJECTS=1
echo "${cmake_cxx_compiler} has stl containers supporting allocator objects"
else
@@ -993,7 +1009,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_CSTDDEF" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_CSTDDEF=1
echo "${cmake_cxx_compiler} has header cstddef"
else
@@ -1002,7 +1018,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
echo "${cmake_cxx_compiler} does not require template friends to use <>"
else
KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS=1
@@ -1011,7 +1027,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_MEMBER_TEMPLATES=1
echo "${cmake_cxx_compiler} supports member templates"
else
@@ -1020,7 +1036,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_FULL_SPECIALIZATION=1
echo "${cmake_cxx_compiler} has standard template specialization syntax"
else
@@ -1029,7 +1045,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP=1
echo "${cmake_cxx_compiler} has argument dependent lookup"
else
@@ -1038,7 +1054,7 @@ fi
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} -DTEST_KWSYS_STAT_HAS_ST_MTIM" \
- "${cmake_source_dir}/Source/kwsys/kwsysPlatformCxxTests.cxx" >> cmake_bootstrap.log 2>&1; then
+ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then
KWSYS_STAT_HAS_ST_MTIM=1
echo "${cmake_cxx_compiler} has struct stat with st_mtim member"
else