summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/cmake-mode.el16
-rw-r--r--CMakeLists.txt11
-rw-r--r--CTestCustom.cmake.in1
-rw-r--r--Copyright.txt2
-rw-r--r--Help/command/add_library.rst17
-rw-r--r--Help/command/export.rst30
-rw-r--r--Help/command/if.rst378
-rw-r--r--Help/index.rst17
-rw-r--r--Help/manual/cmake-buildsystem.7.rst796
-rw-r--r--Help/manual/cmake-developer.7.rst159
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst4
-rw-r--r--Help/manual/cmake-modules.7.rst1
-rw-r--r--Help/manual/cmake-packages.7.rst460
-rw-r--r--Help/manual/cmake-policies.7.rst19
-rw-r--r--Help/manual/cmake-toolchains.7.rst30
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/module/CMakeFindDependencyMacro.rst1
-rw-r--r--Help/policy/CMP0022.rst4
-rw-r--r--Help/policy/CMP0024.rst2
-rw-r--r--Help/policy/CMP0037.rst2
-rw-r--r--Help/policy/CMP0042.rst19
-rw-r--r--Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst7
-rw-r--r--Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst9
-rw-r--r--Help/prop_sf/AUTORCC_OPTIONS.rst9
-rw-r--r--Help/prop_sf/AUTOUIC_OPTIONS.rst10
-rw-r--r--Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst10
-rw-r--r--Help/prop_tgt/AUTOMOC.rst32
-rw-r--r--Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst10
-rw-r--r--Help/prop_tgt/AUTORCC.rst14
-rw-r--r--Help/prop_tgt/AUTORCC_OPTIONS.rst10
-rw-r--r--Help/prop_tgt/AUTOUIC.rst20
-rw-r--r--Help/prop_tgt/AUTOUIC_OPTIONS.rst10
-rw-r--r--Help/prop_tgt/MACOSX_RPATH.rst16
-rw-r--r--Help/variable/CMAKE_AUTOMOC.rst4
-rw-r--r--Help/variable/CMAKE_AUTOMOC_MOC_OPTIONS.rst7
-rw-r--r--Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst8
-rw-r--r--Help/variable/CMAKE_AUTORCC.rst2
-rw-r--r--Help/variable/CMAKE_AUTORCC_OPTIONS.rst2
-rw-r--r--Help/variable/CMAKE_AUTOUIC.rst2
-rw-r--r--Help/variable/CMAKE_AUTOUIC_OPTIONS.rst2
-rw-r--r--Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst8
-rw-r--r--Help/variable/CMAKE_MACOSX_RPATH.rst7
-rw-r--r--Help/variable/CMAKE_VERBOSE_MAKEFILE.rst9
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake2
-rw-r--r--Modules/CMakeExpandImportedTargets.cmake9
-rw-r--r--Modules/CMakeFindDependencyMacro.cmake58
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake40
-rw-r--r--Modules/CMakePrintHelpers.cmake9
-rw-r--r--Modules/CPackWIX.cmake63
-rw-r--r--Modules/CheckStructHasMember.cmake7
-rw-r--r--Modules/FindBacktrace.cmake17
-rw-r--r--Modules/FindDevIL.cmake2
-rw-r--r--Modules/FindFreetype.cmake16
-rw-r--r--Modules/FindQt4.cmake4
-rw-r--r--Modules/FindSDL.cmake4
-rw-r--r--Modules/FindSubversion.cmake2
-rw-r--r--Modules/GenerateExportHeader.cmake115
-rw-r--r--Modules/Platform/MirBSD.cmake1
-rw-r--r--Modules/Qt4Macros.cmake1
-rw-r--r--Modules/TestCXXAcceptsFlag.cmake16
-rw-r--r--Modules/UseJava.cmake31
-rw-r--r--Modules/UseSWIG.cmake6
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx4
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx175
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h24
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.cxx145
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h75
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx119
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h10
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.cxx70
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h10
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx5
-rw-r--r--Source/CPack/cpack.cxx8
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx7
-rw-r--r--Source/CTest/cmCTestBuildHandler.h4
-rw-r--r--Source/CTest/cmCTestCVS.cxx3
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx19
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h2
-rw-r--r--Source/CTest/cmCTestGIT.cxx3
-rw-r--r--Source/CTest/cmCTestLaunch.cxx15
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx5
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx94
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h6
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx8
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx17
-rw-r--r--Source/CTest/cmCTestTestHandler.h10
-rw-r--r--Source/CTest/cmParseCacheCoverage.cxx3
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx5
-rw-r--r--Source/CTest/cmParseMumpsCoverage.cxx5
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx13
-rw-r--r--Source/CTest/cmParsePHPCoverage.h10
-rw-r--r--Source/CTest/cmParsePythonCoverage.cxx4
-rw-r--r--Source/CursesDialog/ccmake.cxx8
-rw-r--r--Source/CursesDialog/cmCursesForm.cxx2
-rw-r--r--Source/CursesDialog/cmCursesForm.h3
-rw-r--r--Source/QtDialog/CMakeSetup.cxx16
-rw-r--r--Source/cmAddDependenciesCommand.cxx9
-rw-r--r--Source/cmAddLibraryCommand.cxx88
-rw-r--r--Source/cmArchiveWrite.cxx3
-rw-r--r--Source/cmCTest.cxx15
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmCacheManager.cxx6
-rw-r--r--Source/cmComputeLinkDepends.cxx11
-rw-r--r--Source/cmComputeLinkDepends.h8
-rw-r--r--Source/cmComputeLinkInformation.cxx19
-rw-r--r--Source/cmComputeLinkInformation.h17
-rw-r--r--Source/cmComputeTargetDepends.cxx67
-rw-r--r--Source/cmComputeTargetDepends.h14
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmCryptoHash.cxx3
-rw-r--r--Source/cmDepends.cxx3
-rw-r--r--Source/cmDependsC.cxx7
-rw-r--r--Source/cmDependsFortran.cxx20
-rw-r--r--Source/cmDependsJavaParserHelper.cxx3
-rw-r--r--Source/cmDocumentation.cxx7
-rw-r--r--Source/cmELF.cxx9
-rw-r--r--Source/cmExportBuildFileGenerator.cxx36
-rw-r--r--Source/cmExportBuildFileGenerator.h7
-rw-r--r--Source/cmExportCommand.cxx170
-rw-r--r--Source/cmExportCommand.h4
-rw-r--r--Source/cmExportFileGenerator.cxx27
-rw-r--r--Source/cmExportFileGenerator.h2
-rw-r--r--Source/cmExportInstallFileGenerator.cxx39
-rw-r--r--Source/cmExportLibraryDependencies.cxx6
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx6
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h1
-rw-r--r--Source/cmExtraKateGenerator.cxx100
-rw-r--r--Source/cmExtraKateGenerator.h6
-rw-r--r--Source/cmFileCommand.cxx17
-rw-r--r--Source/cmFindPackageCommand.cxx6
-rw-r--r--Source/cmGeneratedFileStream.cxx2
-rw-r--r--Source/cmGeneratedFileStream.h5
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx65
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h36
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx5
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx207
-rw-r--r--Source/cmGeneratorTarget.cxx113
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGetPropertyCommand.cxx2
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h2
-rw-r--r--Source/cmGlobalGenerator.cxx91
-rw-r--r--Source/cmGlobalGenerator.h24
-rw-r--r--Source/cmGlobalKdevelopGenerator.cxx5
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.h4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx107
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h12
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx9
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h6
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx51
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h12
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx24
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h17
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmHexFileConverter.cxx6
-rw-r--r--Source/cmIncludeDirectoryCommand.cxx2
-rw-r--r--Source/cmInstallTargetGenerator.cxx14
-rw-r--r--Source/cmInstallTargetGenerator.h3
-rw-r--r--Source/cmListFileLexer.c71
-rw-r--r--Source/cmListFileLexer.in.l9
-rw-r--r--Source/cmLoadCacheCommand.cxx3
-rw-r--r--Source/cmLocalGenerator.cxx31
-rw-r--r--Source/cmLocalGenerator.h5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx14
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx13
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmLocalXCodeGenerator.cxx29
-rw-r--r--Source/cmLocalXCodeGenerator.h2
-rw-r--r--Source/cmMakeDepend.cxx3
-rw-r--r--Source/cmMakefile.cxx8
-rw-r--r--Source/cmMakefile.h1
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx12
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx15
-rw-r--r--Source/cmMakefileTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx5
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h1
-rw-r--r--Source/cmQtAutoGenerators.cxx98
-rw-r--r--Source/cmQtAutoGenerators.h9
-rw-r--r--Source/cmRST.cxx4
-rw-r--r--Source/cmStandardIncludes.h31
-rw-r--r--Source/cmSystemTools.cxx26
-rw-r--r--Source/cmTarget.cxx358
-rw-r--r--Source/cmTarget.h12
-rw-r--r--Source/cmTargetDepend.h10
-rw-r--r--Source/cmTryRunCommand.cxx3
-rw-r--r--Source/cmUseMangledMesaCommand.cxx5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx4
-rw-r--r--Source/cmVisualStudioSlnParser.cxx3
-rw-r--r--Source/cmWriteFileCommand.cxx3
-rw-r--r--Source/cmXMLParser.cxx3
-rw-r--r--Source/cmake.cxx13
-rw-r--r--Source/cmakemain.cxx18
-rw-r--r--Source/cmcldeps.cxx2
-rw-r--r--Source/cmcmd.cxx17
-rw-r--r--Source/ctest.cxx8
-rw-r--r--Source/kwsys/CMakeLists.txt5
-rw-r--r--Source/kwsys/Encoding.hxx.in31
-rw-r--r--Source/kwsys/EncodingC.c2
-rw-r--r--Source/kwsys/EncodingCXX.cxx93
-rw-r--r--Source/kwsys/FStream.hxx.in7
-rw-r--r--Source/kwsys/ProcessUNIX.c2
-rw-r--r--Source/kwsys/SystemInformation.cxx32
-rw-r--r--Source/kwsys/SystemTools.cxx4
-rw-r--r--Source/kwsys/Terminal.c1
-rw-r--r--Source/kwsys/testEncoding.cxx42
-rw-r--r--Source/kwsys/testFStream.cxx48
-rw-r--r--Tests/AliasTarget/CMakeLists.txt22
-rw-r--r--Tests/CMakeCommands/add_compile_options/CMakeLists.txt7
-rw-r--r--Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt7
-rw-r--r--Tests/CMakeCommands/target_include_directories/CMakeLists.txt7
-rw-r--r--Tests/CMakeLists.txt28
-rw-r--r--Tests/CPackWiXGenerator/CMakeLists.txt4
-rw-r--r--Tests/CPackWiXGenerator/license.txt9
-rw-r--r--Tests/CPackWiXGenerator/patch.xml7
-rw-r--r--Tests/CTestTest/test.cmake.in2
-rw-r--r--Tests/CTestTestMemcheck/CMakeLists.txt10
-rw-r--r--Tests/CTestTestMissingDependsExe/CMakeLists.txt10
-rw-r--r--Tests/CTestTestSerialOrder/CMakeLists.txt40
-rw-r--r--Tests/CTestTestSerialOrder/test.cmake31
-rw-r--r--Tests/CompatibleInterface/CMakeLists.txt10
-rw-r--r--Tests/CompatibleInterface/main.cpp4
-rw-r--r--Tests/Contracts/VTK/Dashboard.cmake.in9
-rw-r--r--Tests/ExportImport/Export/Interface/CMakeLists.txt13
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt30
-rw-r--r--Tests/GeneratorExpression/check-part1.cmake1
-rw-r--r--Tests/GeneratorExpression/check-part3.cmake29
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt4
-rw-r--r--Tests/InterfaceBuildTargets/CMakeLists.txt13
-rw-r--r--Tests/InterfaceBuildTargets/main.cxx5
-rw-r--r--Tests/InterfaceBuildTargets/testlib.cxx5
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt20
-rw-r--r--Tests/InterfaceLibrary/broken.cpp2
-rw-r--r--Tests/InterfaceLibrary/definetestexe.cpp12
-rw-r--r--Tests/InterfaceLibrary/dummy.cpp5
-rw-r--r--Tests/InterfaceLibrary/headerdir/CMakeLists.txt8
-rw-r--r--Tests/InterfaceLibrary/headerdir/iface_header.h1
-rw-r--r--Tests/InterfaceLibrary/libsdir/CMakeLists.txt2
-rw-r--r--Tests/LinkDirectory/CMakeLists.txt2
-rw-r--r--Tests/MacRuntimePath/A/CMakeLists.txt6
-rw-r--r--Tests/Module/GenerateExportHeader/CMakeLists.txt113
-rw-r--r--Tests/Module/GenerateExportHeader/exportheader_test.cpp54
-rw-r--r--Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt16
-rw-r--r--Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h26
-rw-r--r--Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt33
-rw-r--r--Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt45
-rw-r--r--Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt18
-rw-r--r--Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt11
-rw-r--r--Tests/Module/GenerateExportHeader/override_symbol/main.cpp9
-rw-r--r--Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp7
-rw-r--r--Tests/Module/GenerateExportHeader/override_symbol/someclass.h8
-rw-r--r--Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt15
-rw-r--r--Tests/Module/GenerateExportHeader/prefix/main.cpp8
-rw-r--r--Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp7
-rw-r--r--Tests/Module/GenerateExportHeader/prefix/useprefixclass.h13
-rw-r--r--Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h41
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt17
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/main.cpp9
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp7
-rw-r--r--Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h13
-rw-r--r--Tests/QtAutogen/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake2
-rw-r--r--Tests/RunCMake/CMP0022/CMP0022-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt2
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-NEW.cmake4
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0042/CMP0042-WARN.cmake9
-rw-r--r--Tests/RunCMake/CMP0042/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0042/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0042/empty.cpp7
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CompatibleInterface/AutoUic.cmake5
-rw-r--r--Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt28
-rw-r--r--Tests/RunCMake/CompatibleInterface/DebugProperties.cmake20
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt1
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt4
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake9
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt3
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake3
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt1
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt7
-rw-r--r--Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake9
-rw-r--r--Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake1
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt5
-rw-r--r--Tests/RunCMake/export/AppendExport-result.txt1
-rw-r--r--Tests/RunCMake/export/AppendExport-stderr.txt4
-rw-r--r--Tests/RunCMake/export/AppendExport.cmake8
-rw-r--r--Tests/RunCMake/export/NoExportSet-result.txt1
-rw-r--r--Tests/RunCMake/export/NoExportSet-stderr.txt4
-rw-r--r--Tests/RunCMake/export/NoExportSet.cmake2
-rw-r--r--Tests/RunCMake/export/OldIface-result.txt1
-rw-r--r--Tests/RunCMake/export/OldIface-stderr.txt5
-rw-r--r--Tests/RunCMake/export/OldIface.cmake10
-rw-r--r--Tests/RunCMake/export/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/include/ExportExportInclude-result.txt1
-rw-r--r--Tests/RunCMake/include/ExportExportInclude-stderr.txt6
-rw-r--r--Tests/RunCMake/include/ExportExportInclude.cmake6
-rw-r--r--Tests/RunCMake/include/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/interface_library/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/interface_library/add_dependencies-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/add_dependencies-stderr.txt6
-rw-r--r--Tests/RunCMake/interface_library/add_dependencies.cmake4
-rw-r--r--Tests/RunCMake/interface_library/genex_link-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/genex_link-stderr.txt1
-rw-r--r--Tests/RunCMake/interface_library/genex_link.cmake22
-rw-r--r--Tests/RunCMake/interface_library/invalid_signature-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/invalid_signature-stderr.txt89
-rw-r--r--Tests/RunCMake/interface_library/invalid_signature.cmake20
-rw-r--r--Utilities/Sphinx/CMakeLists.txt3
-rw-r--r--Utilities/Sphinx/cmake.py17
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c68
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_options.32
347 files changed, 5900 insertions, 2086 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 79d2319..9c73647 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -1,3 +1,5 @@
+;;; cmake-mode.el --- major-mode for editing CMake sources
+
;=============================================================================
; CMake - Cross Platform Makefile Generator
; Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
@@ -9,7 +11,6 @@
; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
; See the License for more information.
;=============================================================================
-;;; cmake-mode.el --- major-mode for editing CMake sources
;------------------------------------------------------------------------------
@@ -22,10 +23,6 @@
;;
;; (setq load-path (cons (expand-file-name "/dir/with/cmake-mode") load-path))
;; (require 'cmake-mode)
-;; (setq auto-mode-alist
-;; (append '(("CMakeLists\\.txt\\'" . cmake-mode)
-;; ("\\.cmake\\'" . cmake-mode))
-;; auto-mode-alist))
;------------------------------------------------------------------------------
@@ -235,6 +232,7 @@ the indentation. Otherwise it retains the same position on the line"
;;
;; CMake mode startup function.
;;
+;;;###autoload
(defun cmake-mode ()
"Major mode for editing CMake listfiles."
(interactive)
@@ -269,6 +267,7 @@ the indentation. Otherwise it retains the same position on the line"
; Help mode starts here
+;;;###autoload
(defun cmake-command-run (type &optional topic)
"Runs the command cmake with the arguments specified. The
optional argument topic will be appended to the argument list."
@@ -302,6 +301,7 @@ optional argument topic will be appended to the argument list."
)
)
+;;;###autoload
(defun cmake-help-list-commands ()
"Prints out a list of the cmake commands."
(interactive)
@@ -311,6 +311,7 @@ optional argument topic will be appended to the argument list."
(defvar cmake-help-command-history nil "Topic read history.")
(require 'thingatpt)
+;;;###autoload
(defun cmake-get-topic (type)
"Gets the topic from the minibuffer input. The default is the word the cursor is on."
(interactive)
@@ -327,6 +328,7 @@ optional argument topic will be appended to the argument list."
)
+;;;###autoload
(defun cmake-help-command ()
"Prints out the help message corresponding to the command the cursor is on."
(interactive)
@@ -334,6 +336,10 @@ optional argument topic will be appended to the argument list."
(cmake-command-run "--help-command" (downcase command))
)
+;;;###autoload
+(progn
+ (add-to-list 'auto-mode-alist '("CMakeLists\\.txt\\'" . cmake-mode))
+ (add-to-list 'auto-mode-alist '("\\.cmake\\'" . cmake-mode)))
; This file provides cmake-mode.
(provide 'cmake-mode)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a13afa1..761ad20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -589,14 +589,3 @@ install(
# Install auxiliary files integrating with other tools.
add_subdirectory(Auxiliary)
-
-#-----------------------------------------------------------------------
-# End of the main section of the CMakeLists file
-#-----------------------------------------------------------------------
-
-# As a special case when building CMake itself, CMake 2.8.0 and below
-# look up EXECUTABLE_OUTPUT_PATH in the top-level CMakeLists.txt file
-# to compute the location of the "cmake" executable. We set it here
-# so that those CMake versions can find it. We wait until after all
-# the add_subdirectory() calls to avoid affecting the subdirectories.
-set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 495d156..eb0b2f6 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -32,6 +32,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"warning .980: wrong number of actual arguments to intrinsic function .std::basic_"
"LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF"
+ "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF"
"Warning: library was too large for page size.*"
"Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*"
diff --git a/Copyright.txt b/Copyright.txt
index 9342249..214d7de 100644
--- a/Copyright.txt
+++ b/Copyright.txt
@@ -1,5 +1,5 @@
CMake - Cross Platform Makefile Generator
-Copyright 2000-2013 Kitware, Inc.
+Copyright 2000-2014 Kitware, Inc.
Copyright 2000-2011 Insight Software Consortium
All rights reserved.
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index 45f1102..2d69c89 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -109,12 +109,21 @@ The signature
::
- add_library(<name> INTERFACE)
+ add_library(<name> INTERFACE [IMPORTED [GLOBAL]])
creates an interface target. An interface target does not directly
create build output, though it may have properties set on it and it
may be installed, exported and imported. Typically the INTERFACE_*
properties are populated on the interface target using the
-set_property(), target_link_libraries(), target_include_directories()
-and target_compile_defintions() commands, and then it is used as an
-argument to target_link_libraries() like any other target.
+:command:`set_property`, :command:`target_link_libraries`,
+:command:`target_include_directories`
+and :command:`target_compile_defintions` commands, and then it is used as an
+argument to :command:`target_link_libraries` like any other target.
+
+An ``INTERFACE`` :prop_tgt:`IMPORTED` target may also be created with this
+signature. An :prop_tgt:`IMPORTED` library target references a library defined
+outside the project. The target name has scope in the directory in which it is
+created and below, but the ``GLOBAL`` option extends visibility. It may be
+referenced like any target built within the project. :prop_tgt:`IMPORTED`
+libraries are useful for convenient reference from commands like
+:command:`target_link_libraries`.
diff --git a/Help/command/export.rst b/Help/command/export.rst
index c293340..6b83587 100644
--- a/Help/command/export.rst
+++ b/Help/command/export.rst
@@ -5,8 +5,7 @@ Export targets from the build tree for use by outside projects.
::
- export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
- [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
+ export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])
Create a file <filename> that may be included by outside projects to
import targets from the current project's build tree. This is useful
@@ -14,14 +13,10 @@ during cross-compiling to build utility executables that can run on
the host platform in one project and then import them into another
project being compiled for the target platform. If the NAMESPACE
option is given the <namespace> string will be prepended to all target
-names written to the file. If the APPEND option is given the
-generated code will be appended to the file instead of overwriting it.
-The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the
-contents of the properties matching
-``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
-policy CMP0022 is NEW. If a library target is included in the export
-but a target to which it links is not included the behavior is
-unspecified.
+names written to the file.
+
+Target installations are associated with the export <export-name>
+using the ``EXPORT`` option of the :command:`install(TARGETS)` command.
The file created by this command is specific to the build tree and
should never be installed. See the install(EXPORT) command to export
@@ -32,6 +27,21 @@ same values as the final values of the input TARGETS.
::
+ export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
+ [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
+
+This signature is similar to the ``EXPORT`` signature, but targets are listed
+explicitly rather than specified as an export-name. If the APPEND option is
+given the generated code will be appended to the file instead of overwriting it.
+The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the
+contents of the properties matching
+``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
+policy CMP0022 is NEW. If a library target is included in the export
+but a target to which it links is not included the behavior is
+unspecified.
+
+::
+
export(PACKAGE <name>)
Store the current build directory in the CMake user package registry
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 0279be7..49c356e 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -3,24 +3,24 @@ if
Conditionally execute a group of commands.
-::
-
- if(expression)
- # then section.
- COMMAND1(ARGS ...)
- COMMAND2(ARGS ...)
- ...
- elseif(expression2)
- # elseif section.
- COMMAND1(ARGS ...)
- COMMAND2(ARGS ...)
- ...
- else(expression)
- # else section.
- COMMAND1(ARGS ...)
- COMMAND2(ARGS ...)
- ...
- endif(expression)
+.. code-block:: cmake
+
+ if(expression)
+ # then section.
+ COMMAND1(ARGS ...)
+ COMMAND2(ARGS ...)
+ ...
+ elseif(expression2)
+ # elseif section.
+ COMMAND1(ARGS ...)
+ COMMAND2(ARGS ...)
+ ...
+ else(expression)
+ # else section.
+ COMMAND1(ARGS ...)
+ COMMAND2(ARGS ...)
+ ...
+ endif(expression)
Evaluates the given expression. If the result is true, the commands
in the THEN section are invoked. Otherwise, the commands in the else
@@ -28,212 +28,174 @@ section are invoked. The elseif and else sections are optional. You
may have multiple elseif clauses. Note that the expression in the
else and endif clause is optional. Long expressions can be used and
there is a traditional order of precedence. Parenthetical expressions
-are evaluated first followed by unary operators such as EXISTS,
-COMMAND, and DEFINED. Then any EQUAL, LESS, GREATER, STRLESS,
-STRGREATER, STREQUAL, MATCHES will be evaluated. Then NOT operators
-and finally AND, OR operators will be evaluated. Possible expressions
-are:
-
-::
-
- if(<constant>)
-
-True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number.
-False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, '',
-or ends in the suffix '-NOTFOUND'. Named boolean constants are
-case-insensitive. If the argument is not one of these constants, it
-is treated as a variable:
-
-::
-
- if(<variable>)
-
-True if the variable is defined to a value that is not a false
-constant. False otherwise. (Note macro arguments are not variables.)
-
-::
-
- if(NOT <expression>)
-
-True if the expression is not true.
-
-::
-
- if(<expr1> AND <expr2>)
-
-True if both expressions would be considered true individually.
-
-::
-
- if(<expr1> OR <expr2>)
-
-True if either expression would be considered true individually.
-
-::
-
- if(COMMAND command-name)
-
-True if the given name is a command, macro or function that can be
-invoked.
-
-::
-
- if(POLICY policy-id)
-
-True if the given name is an existing policy (of the form CMP<NNNN>).
-
-::
-
- if(TARGET target-name)
-
-True if the given name is an existing target, built or imported.
-
-::
-
- if(EXISTS file-name)
- if(EXISTS directory-name)
-
-True if the named file or directory exists. Behavior is well-defined
-only for full paths.
-
-::
-
- if(file1 IS_NEWER_THAN file2)
-
-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. If the file
-time stamps are exactly the same, an IS_NEWER_THAN comparison returns
-true, so that any dependent build operations will occur in the event
-of a tie. This includes the case of passing the same file name for
-both file1 and file2.
-
-::
-
- if(IS_DIRECTORY directory-name)
-
-True if the given name is a directory. Behavior is well-defined only
-for full paths.
-
-::
-
- if(IS_SYMLINK file-name)
-
-True if the given name is a symbolic link. Behavior is well-defined
-only for full paths.
-
-::
-
- if(IS_ABSOLUTE path)
-
-True if the given path is an absolute path.
-
-::
-
- if(<variable|string> MATCHES regex)
-
-True if the given string or variable's value matches the given regular
-expression.
-
-::
-
- if(<variable|string> LESS <variable|string>)
- if(<variable|string> GREATER <variable|string>)
- if(<variable|string> EQUAL <variable|string>)
-
-True if the given string or variable's value is a valid number and the
-inequality or equality is true.
-
-::
-
- if(<variable|string> STRLESS <variable|string>)
- if(<variable|string> STRGREATER <variable|string>)
- if(<variable|string> STREQUAL <variable|string>)
-
-True if the given string or variable's value is lexicographically less
-(or greater, or equal) than the string or variable on the right.
-
-::
-
- if(<variable|string> VERSION_LESS <variable|string>)
- if(<variable|string> VERSION_EQUAL <variable|string>)
- if(<variable|string> VERSION_GREATER <variable|string>)
-
-Component-wise integer version number comparison (version format is
-major[.minor[.patch[.tweak]]]).
-
-::
-
- if(DEFINED <variable>)
-
-True if the given variable is defined. It does not matter if the
-variable is true or false just if it has been set. (Note macro
-arguments are not variables.)
-
-::
-
- if((expression) AND (expression OR (expression)))
-
-The expressions inside the parenthesis are evaluated first and then
-the remaining expression is evaluated as in the previous examples.
-Where there are nested parenthesis the innermost are evaluated as part
-of evaluating the expression that contains them.
+are evaluated first followed by unary tests such as ``EXISTS``,
+``COMMAND``, and ``DEFINED``. Then any binary tests such as
+``EQUAL``, ``LESS``, ``GREATER``, ``STRLESS``, ``STRGREATER``,
+``STREQUAL``, and ``MATCHES`` will be evaluated. Then boolean ``NOT``
+operators and finally boolean ``AND`` and then ``OR`` operators will
+be evaluated.
+
+Possible expressions are:
+
+``if(<constant>)``
+ True if the constant is ``1``, ``ON``, ``YES``, ``TRUE``, ``Y``,
+ or a non-zero number. False if the constant is ``0``, ``OFF``,
+ ``NO``, ``FALSE``, ``N``, ``IGNORE``, ``NOTFOUND``, the empty string,
+ or ends in the suffix ``-NOTFOUND``. Named boolean constants are
+ case-insensitive. If the argument is not one of these constants, it
+ is treated as a variable.
+
+``if(<variable>)``
+ True if the variable is defined to a value that is not a false
+ constant. False otherwise. (Note macro arguments are not variables.)
+
+``if(NOT <expression>)``
+ True if the expression is not true.
+
+``if(<expr1> AND <expr2>)``
+ True if both expressions would be considered true individually.
+
+``if(<expr1> OR <expr2>)``
+ True if either expression would be considered true individually.
+
+``if(COMMAND command-name)``
+ True if the given name is a command, macro or function that can be
+ invoked.
+
+``if(POLICY policy-id)``
+ True if the given name is an existing policy (of the form ``CMP<NNNN>``).
+
+``if(TARGET target-name)``
+ True if the given name is an existing logical target name such as those
+ created by the :command:`add_executable`, :command:`add_library`, or
+ :command:`add_custom_target` commands.
+
+``if(EXISTS path-to-file-or-directory)``
+ True if the named file or directory exists. Behavior is well-defined
+ only for full paths.
+
+``if(file1 IS_NEWER_THAN file2)``
+ 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. If the file
+ time stamps are exactly the same, an ``IS_NEWER_THAN`` comparison returns
+ true, so that any dependent build operations will occur in the event
+ of a tie. This includes the case of passing the same file name for
+ both file1 and file2.
+
+``if(IS_DIRECTORY path-to-directory)``
+ True if the given name is a directory. Behavior is well-defined only
+ for full paths.
+
+``if(IS_SYMLINK file-name)``
+ True if the given name is a symbolic link. Behavior is well-defined
+ only for full paths.
+
+``if(IS_ABSOLUTE path)``
+ True if the given path is an absolute path.
+
+``if(<variable|string> MATCHES regex)``
+ True if the given string or variable's value matches the given regular
+ expression.
+
+``if(<variable|string> LESS <variable|string>)``
+ True if the given string or variable's value is a valid number and less
+ than that on the right.
+
+``if(<variable|string> GREATER <variable|string>)``
+ True if the given string or variable's value is a valid number and greater
+ than that on the right.
+
+``if(<variable|string> EQUAL <variable|string>)``
+ True if the given string or variable's value is a valid number and equal
+ to that on the right.
+
+``if(<variable|string> STRLESS <variable|string>)``
+ True if the given string or variable's value is lexicographically less
+ than the string or variable on the right.
+
+``if(<variable|string> STRGREATER <variable|string>)``
+ True if the given string or variable's value is lexicographically greater
+ than the string or variable on the right.
+
+``if(<variable|string> STREQUAL <variable|string>)``
+ True if the given string or variable's value is lexicographically equal
+ to the string or variable on the right.
+
+``if(<variable|string> VERSION_LESS <variable|string>)``
+ Component-wise integer version number comparison (version format is
+ ``major[.minor[.patch[.tweak]]]``).
+
+``if(<variable|string> VERSION_EQUAL <variable|string>)``
+ Component-wise integer version number comparison (version format is
+ ``major[.minor[.patch[.tweak]]]``).
+
+``if(<variable|string> VERSION_GREATER <variable|string>)``
+ Component-wise integer version number comparison (version format is
+ ``major[.minor[.patch[.tweak]]]``).
+
+``if(DEFINED <variable>)``
+ True if the given variable is defined. It does not matter if the
+ variable is true or false just if it has been set. (Note macro
+ arguments are not variables.)
+
+``if((expression) AND (expression OR (expression)))``
+ The expressions inside the parenthesis are evaluated first and then
+ the remaining expression is evaluated as in the previous examples.
+ Where there are nested parenthesis the innermost are evaluated as part
+ of evaluating the expression that contains them.
The if command was written very early in CMake's history, predating
-the ${} variable evaluation syntax, and for convenience evaluates
+the ``${}`` variable evaluation syntax, and for convenience evaluates
variables named by its arguments as shown in the above signatures.
-Note that normal variable evaluation with ${} applies before the if
-command even receives the arguments. Therefore code like
-
-::
-
- set(var1 OFF)
- set(var2 "var1")
- if(${var2})
-
-appears to the if command as
+Note that normal variable evaluation with ``${}`` applies before the if
+command even receives the arguments. Therefore code like::
-::
+ set(var1 OFF)
+ set(var2 "var1")
+ if(${var2})
- if(var1)
+appears to the if command as::
-and is evaluated according to the if(<variable>) case documented
-above. The result is OFF which is false. However, if we remove the
-${} from the example then the command sees
+ if(var1)
-::
+and is evaluated according to the ``if(<variable>)`` case documented
+above. The result is ``OFF`` which is false. However, if we remove the
+``${}`` from the example then the command sees::
- if(var2)
+ if(var2)
-which is true because var2 is defined to "var1" which is not a false
+which is true because ``var2`` is defined to "var1" which is not a false
constant.
Automatic evaluation applies in the other cases whenever the
-above-documented signature accepts <variable|string>:
+above-documented signature accepts ``<variable|string>``:
-1) The left hand argument to MATCHES is first checked to see if it is
-a defined variable, if so the variable's value is used, otherwise the
-original value is used.
+* The left hand argument to ``MATCHES`` is first checked to see if it is
+ a defined variable, if so the variable's value is used, otherwise the
+ original value is used.
-2) If the left hand argument to MATCHES is missing it returns false
-without error
+* If the left hand argument to ``MATCHES`` is missing it returns false
+ without error
-3) Both left and right hand arguments to LESS GREATER EQUAL are
-independently tested to see if they are defined variables, if so their
-defined values are used otherwise the original value is used.
+* Both left and right hand arguments to ``LESS``, ``GREATER``, and
+ ``EQUAL`` are independently tested to see if they are defined
+ variables, if so their defined values are used otherwise the original
+ value is used.
-4) Both left and right hand arguments to STRLESS STREQUAL STRGREATER
-are independently tested to see if they are defined variables, if so
-their defined values are used otherwise the original value is used.
+* Both left and right hand arguments to ``STRLESS``, ``STREQUAL``, and
+ ``STRGREATER`` are independently tested to see if they are defined
+ variables, if so their defined values are used otherwise the original
+ value is used.
-5) Both left and right hand argumemnts to VERSION_LESS VERSION_EQUAL
-VERSION_GREATER are independently tested to see if they are defined
-variables, if so their defined values are used otherwise the original
-value is used.
+* Both left and right hand argumemnts to ``VERSION_LESS``,
+ ``VERSION_EQUAL``, and ``VERSION_GREATER`` are independently tested
+ to see if they are defined variables, if so their defined values are
+ used otherwise the original value is used.
-6) The right hand argument to NOT is tested to see if it is a boolean
-constant, if so the value is used, otherwise it is assumed to be a
-variable and it is dereferenced.
+* The right hand argument to ``NOT`` is tested to see if it is a boolean
+ constant, if so the value is used, otherwise it is assumed to be a
+ variable and it is dereferenced.
-7) The left and right hand arguments to AND OR are independently
-tested to see if they are boolean constants, if so they are used as
-such, otherwise they are assumed to be variables and are dereferenced.
+* The left and right hand arguments to ``AND`` and ``OR`` are independently
+ tested to see if they are boolean constants, if so they are used as
+ such, otherwise they are assumed to be variables and are dereferenced.
diff --git a/Help/index.rst b/Help/index.rst
index 4ef5c3f..551db75 100644
--- a/Help/index.rst
+++ b/Help/index.rst
@@ -25,24 +25,19 @@ Reference Manuals
.. toctree::
:maxdepth: 1
+ /manual/cmake-buildsystem.7
/manual/cmake-commands.7
+ /manual/cmake-developer.7
+ /manual/cmake-generator-expressions.7
/manual/cmake-generators.7
- /manual/cmake-toolchains.7
+ /manual/cmake-language.7
/manual/cmake-modules.7
+ /manual/cmake-packages.7
/manual/cmake-policies.7
/manual/cmake-properties.7
+ /manual/cmake-toolchains.7
/manual/cmake-variables.7
-Other Manuals
-#############
-
-.. toctree::
- :maxdepth: 1
-
- /manual/cmake-developer.7
- /manual/cmake-generator-expressions.7
- /manual/cmake-language.7
-
.. only:: html
Index and Search
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
new file mode 100644
index 0000000..03f9115
--- /dev/null
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -0,0 +1,796 @@
+.. cmake-manual-description: CMake Buildsystem Reference
+
+cmake-buildsystem(7)
+********************
+
+.. only:: html or latex
+
+ .. contents::
+
+Introduction
+============
+
+A CMake-based buildsystem is organized as a set of high-level logical
+targets. Each target corresponds to an executable or library, or
+is a custom target containing custom commands. Dependencies between the
+targets are expressed in the buildsystem to determine the build order
+and the rules for regeneration in response to change.
+
+Binary Targets
+==============
+
+Executables and libraries are defined using the :command:`add_library`
+and :command:`add_executable` commands. The resulting binary files have
+appropriate prefixes, suffixes and extensions for the platform targeted.
+Dependencies between binary targets are expressed using the
+:command:`target_link_libraries` command:
+
+.. code-block:: cmake
+
+ add_library(archive archive.cpp zip.cpp lzma.cpp)
+ add_executable(zipapp zipapp.cpp)
+ target_link_libraries(zipapp archive)
+
+``archive`` is defined as a static library -- an archive containing objects
+compiled from ``archive.cpp``, ``zip.cpp``, and ``lzma.cpp``. ``zipapp``
+is defined as an executable formed by compiling and linking ``zipapp.cpp``.
+When linking the ``zipapp`` executable, the ``archive`` static library is
+linked in.
+
+Binary Library Types
+--------------------
+
+By default, the :command:`add_library` command defines a static library,
+unless a type is specified. A type may be specified when using the command:
+
+.. code-block:: cmake
+
+ add_library(archive SHARED archive.cpp zip.cpp lzma.cpp)
+
+.. code-block:: cmake
+
+ add_library(archive STATIC archive.cpp zip.cpp lzma.cpp)
+
+The :variable:`BUILD_SHARED_LIBS` variable may be enabled to change the
+behavior of :command:`add_library` to build shared libraries by default.
+
+In the context of the buildsystem definition as a whole, it is largely
+irrelevant whether particular libraries are ``SHARED`` or ``STATIC`` --
+the commands, dependency specifications and other APIs work similarly
+regardless of the library type. The ``MODULE`` library type is
+dissimilar in that it is generally not linked to -- it is not used in
+the right-hand-side of the :command:`target_link_libraries` command.
+It is a type which is loaded as a plugin using runtime techniques.
+
+.. code-block:: cmake
+
+ add_library(archive MODULE 7z.cpp)
+
+The ``OBJECT`` library type is also not linked to. It defines a non-archival
+collection of object files resulting from compiling the given source files.
+The object files collection can be used as source inputs to other targets:
+
+.. code-block:: cmake
+
+ add_library(archive OBJECT archive.cpp zip.cpp lzma.cpp)
+
+ add_library(archiveExtras STATIC $<TARGET_OBJECTS:archive> extras.cpp)
+
+ add_executable(test_exe $<TARGET_OBJECTS:archive> test.cpp)
+
+``OBJECT`` libraries may only be used locally as sources in a buildsystem --
+they may not be installed, exported, or used in the right hand side of
+:command:`target_link_libraries`. They also may not be used as the ``TARGET``
+in a use of the :command:`add_custom_command(TARGET)` command signature.
+
+Commands such as :command:`add_custom_command`, which generates rules to be
+run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
+target as a ``COMMAND`` executable. The buildsystem rules will ensure that
+the executable is built before attempting to run the command.
+
+Build Specification and Usage Requirements
+==========================================
+
+The :command:`target_include_directories`, :command:`target_compile_definitions`
+and :command:`target_compile_options` commands specify the build specifications
+and the usage requirements of binary targets. The commands populate the
+:prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_DEFINITIONS` and
+:prop_tgt:`COMPILE_OPTIONS` target properties respectively, and/or the
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`, :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`
+and :prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties.
+
+Each of the commands has a ``PRIVATE``, ``PUBLIC`` and ``INTERFACE`` mode. The
+``PRIVATE`` mode populates only the non-``INTERFACE_`` variant of the target
+property and the ``INTERFACE`` mode populates only the ``INTERFACE_`` variants.
+The ``PUBLIC`` mode populates both variants of the repective target property.
+Each command may be invoked with multiple uses of each keyword:
+
+.. code-block:: cmake
+
+ target_compile_definitions(archive
+ PRIVATE BUILDING_WITH_LZMA
+ INTERFACE USING_ARCHIVE_LIB
+ )
+
+Target Properties
+-----------------
+
+The contents of the :prop_tgt:`INCLUDE_DIRECTORIES`,
+:prop_tgt:`COMPILE_DEFINITIONS` and :prop_tgt:`COMPILE_OPTIONS` target
+properties are used appropriately when compiling the source files of a
+binary target.
+
+Entries in the :prop_tgt:`INCLUDE_DIRECTORIES` are added to the compile line
+with ``-I`` or ``-isystem`` prefixes and in the order of appearance in the
+property value.
+
+Entries in the :prop_tgt:`COMPILE_DEFINITIONS` are prefixed with ``-D`` or
+``/D`` and added to the compile line in an unspecified order. The
+:prop_tgt:`DEFINE_SYMBOL` target property is also added as a compile
+definition as a special convenience case for ``SHARED`` and ``MODULE``
+library targets.
+
+Entries in the :prop_tgt:`COMPILE_OPTIONS` are escaped for the shell and added
+in the order of appearance in the property value. Several compile options have
+special separate handling, such as :prop_tgt:`POSITION_INDEPENDENT_CODE`.
+
+The contents of the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
+:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` and
+:prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties are
+*Usage Requirements* -- they specify content which consumers
+must use to correctly compile and link with the target they appear on.
+For any binary target, the contents of each ``INTERFACE_`` property on
+each target specified in a :command:`target_link_libraries` command is
+consumed:
+
+.. code-block:: cmake
+
+ set(srcs archive.cpp zip.cpp)
+ if (LZMA_FOUND)
+ list(APPEND srcs lzma.cpp)
+ endif()
+ add_library(archive SHARED ${srcs})
+ if (LZMA_FOUND)
+ # The archive library sources are compiled with -DBUILDING_WITH_LZMA
+ target_compile_definitions(archive PRIVATE BUILDING_WITH_LZMA)
+ endif()
+ target_compile_definitions(archive INTERFACE USING_ARCHIVE_LIB)
+
+ add_executable(consumer)
+ # Link consumer to archive and consume its usage requirements. The consumer
+ # executable sources are compiled with -DUSING_ARCHIVE_LIB.
+ target_link_libraries(consumer archive)
+
+Because it is common to require that the source directory and corresponding
+build directory are added to the :prop_tgt:`INCLUDE_DIRECTORIES`, the
+:variable:`CMAKE_INCLUDE_CURRENT_DIR` variable can be enabled to conveniently
+add the corresponding directories to the :prop_tgt:`INCLUDE_DIRECTORIES` of
+all targets. The variable :variable:`CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE`
+can be enabled to add the corresponding directories to the
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of all targets. This makes use of
+targets in multiple different directories convenient through use of the
+:command:`target_link_libraries` command.
+
+Transitive Usage Requirements
+-----------------------------
+
+The usage requirements of a target can transitively propagate to dependents.
+The :command:`target_link_libraries` command also has ``PRIVATE``,
+``INTERFACE`` and ``PUBLIC`` keywords to control the propagation.
+
+.. code-block:: cmake
+
+ add_library(archive archive.cpp)
+ target_compile_definitions(archive INTERFACE USING_ARCHIVE_LIB)
+
+ add_library(serialization serialization.cpp)
+ target_compile_definitions(serialization INTERFACE USING_SERIALIZATION_LIB)
+
+ add_library(archiveExtras extras.cpp)
+ target_link_libraries(archiveExtras PUBLIC archive)
+ target_link_libraries(archiveExtras PRIVATE serialization)
+ # archiveExtras is compiled with -DUSING_ARCHIVE_LIB
+ # and -DUSING_SERIALIZATION_LIB
+
+ add_executable(consumer consumer.cpp)
+ # consumer is compiled with -DUSING_ARCHIVE_LIB
+ target_link_libraries(consumer archiveExtras)
+
+Because ``archive`` is a ``PUBLIC`` dependency of ``archiveExtras``, the
+usage requirements of it are propagated to ``consumer`` too. Because
+``serialization`` is a ``PRIVATE`` dependency of ``archive``, the usage
+requirements of it are not propagated to ``consumer``.
+
+Generally, a dependency should be specified in a use of
+:command:`target_link_libraries` with the ``PRIVATE`` keyword if it is used by
+only the implementation of a library, and not in the header files. If a
+dependency is additionally used in the header files of a library (e.g. for
+class inheritance), then it should be specified as a ``PUBLIC`` dependency.
+A dependency which is not used by the implementation of a library, but only by
+its headers should be specified as an ``INTERFACE`` dependency. The
+:command:`target_link_libraries` command may be invoked with multiple uses of
+each keyword:
+
+.. code-block:: cmake
+
+ target_link_libraries(archiveExtras
+ PUBLIC archive
+ PRIVATE serialization
+ )
+
+.. _`Compatible Interface Properties`:
+
+Compatible Interface Properties
+-------------------------------
+
+Some target properties are required to be compatible between a target and
+the interface of each dependency. For example, the
+:prop_tgt:`POSITION_INDEPENDENT_CODE` target property may specify a
+boolean value of whether a target should be compiled as
+position-independent-code, which has platform-specific consequences.
+A target may also specify the usage requirement
+:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE` to communicate that
+consumers must be compiled as position-independent-code.
+
+.. code-block:: cmake
+
+ add_executable(exe1 exe1.cpp)
+ set_property(TARGET exe1 PROPERTY POSITION_INDEPENDENT_CODE ON)
+
+ add_library(lib1 SHARED lib1.cpp)
+ set_property(TARGET lib1 PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+ add_executable(exe2 exe2.cpp)
+ target_link_libraries(exe2 lib1)
+
+Here, both ``exe1`` and ``exe2`` will be compiled as position-independent-code.
+``lib1`` will also be compiled as position-independent-code because that is the
+default setting for ``SHARED`` libraries. If dependencies have conflicting,
+non-compatible requirements :manual:`cmake(1)` issues a diagnostic:
+
+.. code-block:: cmake
+
+ add_library(lib1 SHARED lib1.cpp)
+ set_property(TARGET lib1 PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+ add_library(lib2 SHARED lib2.cpp)
+ set_property(TARGET lib2 PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE OFF)
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 lib1)
+ set_property(TARGET exe1 PROPERTY POSITION_INDEPENDENT_CODE OFF)
+
+ add_executable(exe2 exe2.cpp)
+ target_link_libraries(exe2 lib1 lib2)
+
+The ``lib1`` requirement ``INTERFACE_POSITION_INDEPENDENT_CODE`` is not
+"compatible" with the ``POSITION_INDEPENDENT_CODE`` property of the ``exe1``
+target. The library requires that consumers are built as
+position-independent-code, while the executable specifies to not built as
+position-independent-code, so a diagnostic is issued.
+
+The ``lib1`` and ``lib2`` requirements are not "compatible". One of them
+requires that consumers are built as position-independent-code, while
+the other requires that consumers are not built as position-independent-code.
+Because ``exe2`` links to both and they are in conflict, a diagnostic is
+issued.
+
+To be "compatible", the :prop_tgt:`POSITION_INDEPENDENT_CODE` property,
+if set must be either the same, in a boolean sense, as the
+:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE` property of all transitively
+specified dependencies on which that property is set.
+
+This property of "compatible interface requirement" may be extended to other
+properties by specifying the property in the content of the
+:prop_tgt:`COMPATIBLE_INTERFACE_BOOL` target property. Each specified property
+must be compatible between the consuming target and the corresponding property
+with an ``INTERFACE_`` prefix from each dependency:
+
+.. code-block:: cmake
+
+ add_library(lib1Version2 SHARED lib1_v2.cpp)
+ set_property(TARGET lib1Version2 PROPERTY INTERFACE_CUSTOM_PROP ON)
+ set_property(TARGET lib1Version2 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_BOOL CUSTOM_PROP
+ )
+
+ add_library(lib1Version3 SHARED lib1_v3.cpp)
+ set_property(TARGET lib1Version3 PROPERTY INTERFACE_CUSTOM_PROP OFF)
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 lib1Version2) # CUSTOM_PROP will be ON
+
+ add_executable(exe2 exe2.cpp)
+ target_link_libraries(exe2 lib1Version2 lib1Version3) # Diagnostic
+
+Non-boolean properties may also participate in "compatible interface"
+computations. Properties specified in the
+:prop_tgt:`COMPATIBLE_INTERFACE_STRING`
+property must be either unspecified or compare to the same string among
+all transitively specified dependencies. This can be useful to ensure
+that multiple incompatible versions of a library are not linked together
+through transitive requirements of a target:
+
+.. code-block:: cmake
+
+ add_library(lib1Version2 SHARED lib1_v2.cpp)
+ set_property(TARGET lib1Version2 PROPERTY INTERFACE_LIB_VERSION 2)
+ set_property(TARGET lib1Version2 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_STRING LIB_VERSION
+ )
+
+ add_library(lib1Version3 SHARED lib1_v3.cpp)
+ set_property(TARGET lib1Version3 PROPERTY INTERFACE_LIB_VERSION 3)
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 lib1Version2) # LIB_VERSION will be "2"
+
+ add_executable(exe2 exe2.cpp)
+ target_link_libraries(exe2 lib1Version2 lib1Version3) # Diagnostic
+
+The :prop_tgt:`COMPATIBLE_INTERFACE_NUMBER_MAX` target property specifies
+that content will be evaluated numerically and the maximum number among all
+specified will be calculated:
+
+.. code-block:: cmake
+
+ add_library(lib1Version2 SHARED lib1_v2.cpp)
+ set_property(TARGET lib1Version2 PROPERTY INTERFACE_CONTAINER_SIZE_REQUIRED 200)
+ set_property(TARGET lib1Version2 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_NUMBER_MAX CONTAINER_SIZE_REQUIRED
+ )
+
+ add_library(lib1Version3 SHARED lib1_v3.cpp)
+ set_property(TARGET lib1Version2 PROPERTY INTERFACE_CONTAINER_SIZE_REQUIRED 1000)
+
+ add_executable(exe1 exe1.cpp)
+ # CONTAINER_SIZE_REQUIRED will be "200"
+ target_link_libraries(exe1 lib1Version2)
+
+ add_executable(exe2 exe2.cpp)
+ # CONTAINER_SIZE_REQUIRED will be "1000"
+ target_link_libraries(exe2 lib1Version2 lib1Version3)
+
+Similarly, the :prop_tgt:`COMPATIBLE_INTERFACE_NUMBER_MIN` may be used to
+calculate the numeric minimum value for a property from dependencies.
+
+Each calculated "compatible" property value may be read in the consumer at
+generate-time using generator expressions.
+
+Property Origin Debugging
+-------------------------
+
+Because build specifications can be determined by dependencies, the lack of
+locality of code which creates a target and code which is responsible for
+setting build specifications may make the code more difficult to reason about.
+:manual:`cmake(1)` provides a debugging facility to print the origin of the
+contents of properties which may be determined by dependencies. The properties
+which can be debugged are :prop_tgt:`INCLUDE_DIRECTORIES`,
+:prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`,
+:prop_tgt:`AUTOUIC_OPTIONS`, and all properties listed in a
+``COMPATIBLE_INTERFACE_*`` target property:
+
+.. code-block:: cmake
+
+ set(CMAKE_DEBUG_TARGET_PROPERTIES
+ INCLUDE_DIRECTORIES
+ COMPILE_DEFINITIONS
+ POSITION_INDEPENDENT_CODE
+ CONTAINER_SIZE_REQUIRED
+ LIB_VERSION
+ )
+ add_executable(exe1 exe1.cpp)
+
+In the case of properties listed in :prop_tgt:`COMPATIBLE_INTERFACE_BOOL` or
+:prop_tgt:`COMPATIBLE_INTERFACE_STRING`, the debug output shows which target
+was responsible for setting the property, and which other dependencies also
+defined the property. In the case of
+:prop_tgt:`COMPATIBLE_INTERFACE_NUMBER_MAX` and
+:prop_tgt:`COMPATIBLE_INTERFACE_NUMBER_MIN`, the debug output shows the
+value of the property from each dependency, and whether the value determines
+the new extreme.
+
+Build Specification with Generator Expressions
+----------------------------------------------
+
+Build specifications may use
+:manual:`generator expressions <cmake-generator-expressions(7)>` containing
+content which may be conditional or known only at generate-time. For example,
+the calculated "compatible" value of a property may be read with the
+``TARGET_PROPERTY`` expression:
+
+.. code-block:: cmake
+
+ add_library(lib1Version2 SHARED lib1_v2.cpp)
+ set_property(TARGET lib1Version2 PROPERTY
+ INTERFACE_CONTAINER_SIZE_REQUIRED 200)
+ set_property(TARGET lib1Version2 APPEND PROPERTY
+ COMPATIBLE_INTERFACE_NUMBER_MAX CONTAINER_SIZE_REQUIRED
+ )
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 lib1Version2)
+ target_compile_definitions(exe1 PRIVATE
+ CONTAINER_SIZE=$<TARGET_PROPERTY:CONTAINER_SIZE_REQUIRED>
+ )
+
+In this case, the ``exe1`` source files will be compiled with
+``-DCONTAINER_SIZE=200``.
+
+Configuration determined build specifications may be conveniently set using
+the ``CONFIG`` generator expression.
+
+.. code-block:: cmake
+
+ target_compile_definitions(exe1 PRIVATE
+ $<$<CONFIG:Debug>:DEBUG_BUILD>
+ )
+
+The ``CONFIG`` parameter is compared case-insensitively with the configuration
+being built. In the presence of :prop_tgt:`IMPORTED` targets, the content of
+:prop_tgt:`MAP_IMPORTED_CONFIG_DEBUG <MAP_IMPORTED_CONFIG_CONFIG>` is also
+accounted for by this expression.
+
+Some buildsystems generated by :manual:`cmake(1)` have a predetermined
+build-configuration set in the :variable:`CMAKE_BUILD_TYPE` variable. The
+buildsystem for the IDEs such as Visual Studio and Xcode are generated
+independent of the build-configuration, and the actual build configuration
+is not known until build-time. Therefore, code such as
+
+.. code-block:: cmake
+
+ string(TOLOWER ${CMAKE_BUILD_TYPE} _type)
+ if (_type STREQUAL debug)
+ target_compile_definitions(exe1 PRIVATE DEBUG_BUILD)
+ endif()
+
+may appear to work for ``Makefile`` based and ``Ninja`` generators, but is not
+portable to IDE generators. Additionally, the :prop_tgt:`IMPORTED`
+configuration-mappings are not accounted for with code like this, so it should
+be avoided.
+
+The unary ``TARGET_PROPERTY`` generator expression and the ``TARGET_POLICY``
+generator expression are evaluated with the consuming target context. This
+means that a usage requirement specification may be evaluated differently based
+on the consumer:
+
+.. code-block:: cmake
+
+ add_library(lib1 lib1.cpp)
+ target_compile_definitions(lib1 INTERFACE
+ $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:LIB1_WITH_EXE>
+ $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:LIB1_WITH_SHARED_LIB>
+ $<$<TARGET_POLICY:CMP0041>:CONSUMER_CMP0041_NEW>
+ )
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 lib1)
+
+ cmake_policy(SET CMP0041 NEW)
+
+ add_library(shared_lib shared_lib.cpp)
+ target_link_libraries(shared_lib lib1)
+
+The ``exe1`` executable will be compiled with ``-DLIB1_WITH_EXE``, while the
+``shared_lib`` shared library will be compiled with ``-DLIB1_WITH_SHARED_LIB``
+and ``-DCONSUMER_CMP0041_NEW``, because policy :policy:`CMP0041` is
+``NEW`` at the point where the ``shared_lib`` target is created.
+
+The ``BUILD_INTERFACE`` expression wraps requirements which are only used when
+consumed from a target in the same buildsystem, or when consumed from a target
+exported to the build directory using the :command:`export` command. The
+``INSTALL_INTERFACE`` expression wraps requirements which are only used when
+consumed from a target which has been installed and exported with the
+:command:`install(EXPORT)` command:
+
+.. code-block:: cmake
+
+ add_library(ClimbingStats climbingstats.cpp)
+ target_compile_definitions(ClimbingStats INTERFACE
+ $<BUILD_INTERFACE:ClimbingStats_FROM_BUILD_LOCATION>
+ $<INSTALL_INTERFACE:ClimbingStats_FROM_INSTALLED_LOCATION>
+ )
+ install(TARGETS ClimbingStats EXPORT libExport ${InstallArgs})
+ install(EXPORT libExport NAMESPACE Upstream::
+ DESTINATION lib/cmake/ClimbingStats)
+ export(EXPORT libExport NAMESPACE Upstream::)
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 ClimbingStats)
+
+In this case, the ``exe1`` executable will be compiled with
+``-DClimbingStats_FROM_BUILD_LOCATION``. The exporting commands generate
+:prop_tgt:`IMPORTED` targets with either the ``INSTALL_INTERFACE`` or the
+``BUILD_INTERFACE`` omitted, and the ``*_INTERFACE`` marker stripped away.
+A separate project consuming the ``ClimbingStats`` package would contain:
+
+.. code-block:: cmake
+
+ find_package(ClimbingStats REQUIRED)
+
+ add_executable(Downstream main.cpp)
+ target_link_libraries(Downstream Upstream::ClimbingStats)
+
+Depending on whether the ``ClimbingStats`` package was used from the build
+location or the install location, the ``Downstream`` target would be compiled
+with either ``-DClimbingStats_FROM_BUILD_LOCATION`` or
+``-DClimbingStats_FROM_INSTALL_LOCATION``. For more about packages and
+exporting see the :manual:`cmake-packages(7)` manual.
+
+Include Directories and Usage Requirements
+''''''''''''''''''''''''''''''''''''''''''
+
+Include directories require some special consideration when specified as usage
+requirements and when used with generator expressions. The
+:command:`target_include_directories` command accepts both relative and
+absolute include directories:
+
+.. code-block:: cmake
+
+ add_library(lib1 lib1.cpp)
+ target_include_directories(lib1 PRIVATE
+ /absolute/path
+ relative/path
+ )
+
+Relative paths are interpreted relative to the source directory where the
+command appears. Relative paths are not allowed in the
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of :prop_tgt:`IMPORTED` targets.
+
+In cases where a non-trivial generator expression is used, the
+``INSTALL_PREFIX`` expression may be used within the argument of an
+``INSTALL_INTERFACE`` expression. It is a replacement marker which
+expands to the installation prefix when imported by a consuming project.
+
+Include directories usage requirements commonly differ between the build-tree
+and the install-tree. The ``BUILD_INTERFACE`` and ``INSTALL_INTERFACE``
+generator expressions can be used to describe separate usage requirements
+based on the usage location. Relative paths are allowed within these
+expressions, and are interpreted relative to the current source directory
+or the installation prefix, as appropriate.
+
+Two convenience APIs are provided relating to include directories usage
+requirements. The :variable:`CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE` variable
+may be enabled, with an equivalent effect to:
+
+.. code-block:: cmake
+
+ set_property(TARGET tgt APPEND PROPERTY
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>
+ )
+
+for each target affected. The convenience for installed targets is
+an ``INCLUDES DESTINATION`` component with the :command:`install(TARGETS)`
+command:
+
+.. code-block:: cmake
+
+ install(TARGETS foo bar bat EXPORT tgts ${dest_args}
+ INCLUDES DESTINATION include
+ )
+ install(EXPORT tgts ${other_args})
+ install(FILES ${headers} DESTINATION include)
+
+This is equivalent to appending ``${CMAKE_INSTALL_PREFIX}/include`` to the
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of each of the installed
+:prop_tgt:`IMPORTED` targets when generated by :command:`install(EXPORT)`.
+
+If a binary target is linked transitively to a Mac OX framework, the
+``Headers`` directory of the framework is also treated as a usage requirement.
+This has the same effect as passing the framework directory as an include
+directory.
+
+Link Libraries and Generator Expressions
+----------------------------------------
+
+Like build specifications, :prop_tgt:`link libraries <LINK_LIBRARIES>` may be
+specified with generator expression conditions. However, as consumption of
+usage requirements is based on collection from linked dependencies, there is
+an additional limitation that the link dependencies must form a "directed
+acyclic graph". That is, if linking to a target is dependent on the value of
+a target property, that target property may not be dependent on the linked
+dependencies:
+
+.. code-block:: cmake
+
+ add_library(lib1 lib1.cpp)
+ add_library(lib2 lib2.cpp)
+ target_link_libraries(lib1 PUBLIC
+ $<$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>:lib2>
+ )
+ add_library(lib3 lib3.cpp)
+ set_property(TARGET lib3 PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 lib1 lib3)
+
+As the value of the :prop_tgt:`POSITION_INDEPENDENT_CODE` property of
+the ``exe1`` target is dependent on the linked libraries (``lib3``), and the
+edge of linking ``exe1`` is determined by the same
+:prop_tgt:`POSITION_INDEPENDENT_CODE` property, the dependency graph above
+contains a cycle. :manual:`cmake(1)` issues a diagnostic in this case.
+
+Output Files
+------------
+
+The buildsystem targets created by the :command:`add_library` and
+:command:`add_executable` commands create rules to create binary outputs.
+The exact output location of the binaries can only be determined at
+generate-time because it can depend on the build-configuration and the
+link-language of linked dependencies etc. ``TARGET_FILE``,
+``TARGET_LINKER_FILE`` and related expressions can be used to access the
+name and location of generated binaries. These expressions do not work
+for ``OBJECT`` libraries however, as there is no single file generated
+by such libraries which is relevant to the expressions.
+
+Directory-Scoped Commands
+-------------------------
+
+The :command:`target_include_directories`,
+:command:`target_compile_definitions` and
+:command:`target_compile_options` commands have an effect on only one
+target at a time. The commands :command:`add_definitions`,
+:command:`add_compile_options` and :command:`include_directories` have
+a similar function, but operate at directory scope instead of target
+scope for convenience.
+
+Psuedo Targets
+==============
+
+Some target types do not represent outputs of the buildsystem, but only inputs
+such as external dependencies, aliases or other non-build artifacts. Pseudo
+targets are not represented in the generated buildsystem.
+
+Imported Targets
+----------------
+
+An :prop_tgt:`IMPORTED` target represents a pre-existing dependency. Usually
+such targets are defined by an upstream package and should be treated as
+immutable. It is not possible to use an :prop_tgt:`IMPORTED` target in the
+left-hand-side of the :command:`target_compile_definitions`,
+:command:`target_include_directories`, :command:`target_compile_options` or
+:command:`target_link_libraries` commands, as that would be an attempt to
+modify it. :prop_tgt:`IMPORTED` targets are designed to be used only in the
+right-hand-side of those commands.
+
+:prop_tgt:`IMPORTED` targets may have the same usage requirement properties
+populated as binary targets, such as
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
+:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`,
+:prop_tgt:`INTERFACE_COMPILE_OPTIONS`,
+:prop_tgt:`INTERFACE_LINK_LIBRARIES`, and
+:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`.
+
+The :prop_tgt:`LOCATION` may also be read from an IMPORTED target, though there
+is rarely reason to do so. Commands such as :command:`add_custom_command` can
+transparently use an :prop_tgt:`IMPORTED` :prop_tgt:`EXECUTABLE <TYPE>` target
+as a ``COMMAND`` executable.
+
+The scope of the definition of an :prop_tgt:`IMPORTED` target is the directory
+where it was defined. It may be accessed and used from subdirectories, but
+not from parent directories or sibling directories. The scope is similar to
+the scope of a cmake variable.
+
+It is also possible to define a ``GLOBAL`` :prop_tgt:`IMPORTED` target which is
+accessible globally in the buildsystem.
+
+See the :manual:`cmake-packages(7)` manual for more on creating packages
+with :prop_tgt:`IMPORTED` targets.
+
+Alias Targets
+-------------
+
+An ``ALIAS`` target is a name which may be used interchangably with
+a binary target name in read-only contexts. A primary use-case for ``ALIAS``
+targets is for example or unit test executables accompanying a library, which
+may be part of the same buildsystem or built separately based on user
+configuration.
+
+.. code-block:: cmake
+
+ add_library(lib1 lib1.cpp)
+ install(TARGETS lib1 EXPORT lib1Export ${dest_args})
+ install(EXPORT lib1Export NAMESPACE Upstream:: ${other_args})
+
+ add_library(Upstream::lib1 ALIAS lib1)
+
+In another directory, we can link unconditionally to the ``Upstream::lib1``
+target, which may be an :prop_tgt:`IMPORTED` target from a package, or an
+``ALIAS`` target if built as part of the same buildsystem.
+
+.. code-block:: cmake
+
+ if (NOT TARGET Upstream::lib1)
+ find_package(lib1 REQUIRED)
+ endif()
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 Upstream::lib1)
+
+``ALIAS`` targets are not mutable, installable or exportable. They are
+entirely local to the buildsystem description. A name can be tested for
+whether it is an ``ALIAS`` name by reading the :prop_tgt:`ALIASED_TARGET`
+property from it:
+
+.. code-block:: cmake
+
+ get_target_property(_aliased Upstream::lib1 ALIASED_TARGET)
+ if(_aliased)
+ message(STATUS "The name Upstream::lib1 is an ALIAS for ${_aliased}.")
+ endif()
+
+Interface Libraries
+-------------------
+
+An ``INTERFACE`` target has no :prop_tgt:`LOCATION` and is mutable, but is
+otherwise similar to an :prop_tgt:`IMPORTED` target.
+
+It may specify usage requirements such as
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
+:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`,
+:prop_tgt:`INTERFACE_COMPILE_OPTIONS`,
+:prop_tgt:`INTERFACE_LINK_LIBRARIES`, and
+:prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`.
+Only the ``INTERFACE`` modes of the :command:`target_include_directories`,
+:command:`target_compile_definitions`, :command:`target_compile_options`,
+and :command:`target_link_libraries` commands may be used with ``INTERFACE``
+libraries.
+
+A primary use-case for ``INTERFACE`` libraries is header-only libraries.
+
+.. code-block:: cmake
+
+ add_library(Eigen INTERFACE)
+ target_include_directories(Eigen INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<INSTALL_INTERFACE:include/Eigen>
+ )
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 Eigen)
+
+Here, the usage requirements from the ``Eigen`` target are consumed and used
+when compiling, but it has no effect on linking.
+
+Another use-case is to employ an entirely target-focussed design for usage
+requirements:
+
+.. code-block:: cmake
+
+ add_library(pic_on INTERFACE)
+ set_property(TARGET pic_on PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+ add_library(pic_off INTERFACE)
+ set_property(TARGET pic_off PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE OFF)
+
+ add_library(enable_rtti INTERFACE)
+ target_compile_options(enable_rtti INTERFACE
+ $<$<OR:$<COMPILER_ID:GNU>,$<COMPILER_ID:Clang>>:-rtti>
+ )
+
+ add_executable(exe1 exe1.cpp)
+ target_link_libraries(exe1 pic_on enable_rtti)
+
+This way, the build specification of ``exe1`` is expressed entirely as linked
+targets, and the complexity of compiler-specific flags is encapsulated in an
+``INTERFACE`` library target.
+
+``INTERFACE`` libraries may be installed and exported. Any content they refer
+to must be installed separately:
+
+.. code-block:: cmake
+
+ add_library(Eigen INTERFACE)
+ target_include_directories(Eigen INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<INSTALL_INTERFACE:include/Eigen>
+ )
+
+ install(TARGETS Eigen EXPORT eigenExport)
+ install(EXPORT eigenExport NAMESPACE Upstream::
+ DESTINATION lib/cmake/Eigen
+ )
+ install(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/eigen.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/vector.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/matrix.h
+ DESTINATION include/Eigen
+ )
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index 5857acf..d5fbc98 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -13,6 +13,165 @@ Introduction
This manual is intended for reference by developers modifying the CMake
source tree itself.
+
+Permitted C++ Subset
+====================
+
+CMake is required to build with ancient C++ compilers and standard library
+implementations. Some common C++ constructs may not be used in CMake in order
+to build with such toolchains.
+
+std::vector::at
+---------------
+
+The ``at()`` member function of ``std::vector`` may not be used. Use
+``operator[]`` instead:
+
+.. code-block:: c++
+
+ std::vector<int> someVec = getVec();
+ int i1 = someVec.at(5); // Wrong
+ int i2 = someVec[5]; // Ok
+
+std::string::append
+-------------------
+
+The ``append()`` member function of ``std::string`` may not be used. Use
+``operator+=`` instead:
+
+.. code-block:: c++
+
+ std::string stringBuilder;
+ stringBuilder.append("chunk"); // Wrong
+ stringBuilder += "chunk"; // Ok
+
+std::set const iterators
+------------------------
+
+The ``find()`` member function of a ``const`` ``std::set`` instance may not be
+used in a comparison with the iterator returned by ``end()``:
+
+.. code-block:: c++
+
+ const std::set<cmStdString>& someSet = getSet();
+ if (someSet.find("needle") == someSet.end()) // Wrong
+ {
+ // ...
+ }
+
+The return value of ``find()`` must be assigned to an intermediate
+``const_iterator`` for comparison:
+
+.. code-block:: c++
+
+ const std::set<cmStdString>& someSet;
+ const std::set<cmStdString>::const_iterator i = someSet.find("needle");
+ if (i != propSet.end()) // Ok
+ {
+ // ...
+ }
+
+Char Array to ``string`` Conversions with Algorithms
+----------------------------------------------------
+
+In some implementations, algorithms operating on iterators to a container of
+``std::string`` can not accept a ``const char*`` value:
+
+.. code-block:: c++
+
+ const char* dir = /*...*/;
+ std::vector<std::string> vec;
+ // ...
+ std::binary_find(vec.begin(), vec.end(), dir); // Wrong
+
+The ``std::string`` may need to be explicitly constructed:
+
+.. code-block:: c++
+
+ const char* dir = /*...*/;
+ std::vector<std::string> vec;
+ // ...
+ std::binary_find(vec.begin(), vec.end(), std::string(dir)); // Ok
+
+std::auto_ptr
+-------------
+
+Some implementations have a ``std::auto_ptr`` which can not be used as a
+return value from a function. ``std::auto_ptr`` may not be used. Use
+``cmsys::auto_ptr`` instead.
+
+std::vector::insert and std::set
+--------------------------------
+
+Use of ``std::vector::insert`` with an iterator whose ``element_type`` requires
+conversion is not allowed:
+
+.. code-block:: c++
+
+ std::set<cmStdString> theSet;
+ std::vector<std::string> theVector;
+ theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong
+
+A loop must be used instead:
+
+.. code-block:: c++
+
+ std::set<cmStdString> theSet;
+ std::vector<std::string> theVector;
+ for(std::set<cmStdString>::iterator li = theSet.begin();
+ li != theSet.end(); ++li)
+ {
+ theVector.push_back(*li);
+ }
+
+Template Parameter Defaults
+---------------------------
+
+On ancient compilers, C++ template must use template parameters in function
+arguments. If no parameter of that type is needed, the common workaround is
+to add a defaulted pointer to the type to the templated function. However,
+this does not work with other ancient compilers:
+
+.. code-block:: c++
+
+ template<typename PropertyType>
+ PropertyType getTypedProperty(cmTarget* tgt, const char* prop,
+ PropertyType* = 0) // Wrong
+ {
+
+ }
+
+.. code-block:: c++
+
+ template<typename PropertyType>
+ PropertyType getTypedProperty(cmTarget* tgt, const char* prop,
+ PropertyType*) // Ok
+ {
+
+ }
+
+and invoke it with the value ``0`` explicitly in all cases.
+
+std::min and std::max
+---------------------
+
+``min`` and ``max`` are defined as macros on some systems. ``std::min`` and
+``std::max`` may not be used. Use ``cmMinimum`` and ``cmMaximum`` instead.
+
+size_t
+------
+
+Various implementations have differing implementation of ``size_t``. When
+assigning the result of ``.size()`` on a container for example, the result
+should not be assigned to an ``unsigned int`` or similar. ``std::size_t`` must
+not be used.
+
+Templates
+---------
+
+Some template code is permitted, but with some limitations. Member templates
+may not be used, and template friends may not be used.
+
Help
====
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index ed28abd..ac8c3f8 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -55,6 +55,8 @@ otherwise expands to nothing.
``0`` if ``?`` is ``1``, else ``1``
``$<STREQUAL:a,b>``
``1`` if ``a`` is STREQUAL ``b``, else ``0``
+``$<EQUAL:a,b>``
+ ``1`` if ``a`` is EQUAL ``b`` in a numeric comparison, else ``0``
``$<CONFIG:cfg>``
``1`` if config is ``cfg``, else ``0``. This is a case-insensitive comparison.
The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by
@@ -102,6 +104,8 @@ expands to ``OLD_COMPILER`` if the
than 4.2.0.
``$<CONFIGURATION>``
+ Configuration name. Deprecated. Use ``CONFIG`` instead.
+``$<CONFIG>``
Configuration name
``$<PLATFORM_ID>``
The CMake-id of the platform
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index f148a51..3f819d6 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -39,6 +39,7 @@ All Modules
/module/CMakeDependentOption
/module/CMakeDetermineVSServicePack
/module/CMakeExpandImportedTargets
+ /module/CMakeFindDependencyMacro
/module/CMakeFindFrameworks
/module/CMakeFindPackageMode
/module/CMakeForceCompiler
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst
new file mode 100644
index 0000000..b572bf7
--- /dev/null
+++ b/Help/manual/cmake-packages.7.rst
@@ -0,0 +1,460 @@
+.. cmake-manual-description: CMake Packages Reference
+
+cmake-packages(7)
+*****************
+
+.. only:: html or latex
+
+ .. contents::
+
+Introduction
+============
+
+Packages provide dependency information to CMake based buildsystems. Packages
+are found with the :command:`find_package` command. The result of
+using ``find_package`` is either a set of :prop_tgt:`IMPORTED` targets, or
+a set of variables corresponding to build-relevant information.
+
+Using Packages
+==============
+
+CMake provides direct support for two forms of packages,
+`Config-file Packages`_ and `Find-module Packages`_.
+Indirect support for ``pkg-config`` packages is also provided via
+the :module:`FindPkgConfig` module. In all cases, the basic form
+of :command:`find_package` calls is the same:
+
+.. code-block:: cmake
+
+ find_package(Qt4 4.7.0 REQUIRED) # CMake provides a Qt4 find-module
+ find_package(Qt5Core 5.1.0 REQUIRED) # Qt provides a Qt5 package config file.
+ find_package(LibXml2 REQUIRED) # Use pkg-config via the LibXml2 find-module
+
+In cases where it is known that a package configuration file is provided by
+upstream, and only that should be used, the ``CONFIG`` keyword may be passed
+to :command:`find_package`:
+
+.. code-block:: cmake
+
+ find_package(Qt5Core 5.1.0 CONFIG REQUIRED)
+ find_package(Qt5Gui 5.1.0 CONFIG)
+
+Similarly, the ``MODULE`` keyword says to use only a find-module:
+
+.. code-block:: cmake
+
+ find_package(Qt4 4.7.0 MODULE REQUIRED)
+
+Specifying the type of package explicitly improves the error message shown to
+the user if it is not found.
+
+Both types of packages also support specifying components of a package,
+either after the ``REQUIRED`` keyword:
+
+.. code-block:: cmake
+
+ find_package(Qt5 5.1.0 CONFIG REQUIRED Widgets Xml Sql)
+
+or as a separate ``COMPONENTS`` list:
+
+.. code-block:: cmake
+
+ find_package(Qt5 5.1.0 COMPONENTS Widgets Xml Sql)
+
+or as a separate ``OPTIONAL_COMPONENTS`` list:
+
+.. code-block:: cmake
+
+ find_package(Qt5 5.1.0 COMPONENTS Widgets
+ OPTIONAL_COMPONENTS Xml Sql
+ )
+
+Handling of ``COMPONENTS`` and ``OPTIONAL_COMPONENTS`` is defined by the
+package.
+
+By setting the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable to
+``TRUE``, the ``PackageName`` package will not be searched, and will always
+be ``NOTFOUND``.
+
+Config-file Packages
+--------------------
+
+A config-file package is a set of files provided by upstreams for downstreams
+to use. CMake searches in a number of locations for package configuration files, as
+described in the :command:`find_package` documentation. The most simple way for
+a CMake user to tell :manual:`cmake(1)` to search in a non-standard prefix for
+a package is to set the ``CMAKE_PREFIX_PATH`` cache variable.
+
+Config-file packages are provided by upstream vendors as part of development
+packages, that is, they belong with the header files and any other files
+provided to assist downsteams in using the package.
+
+A set of variables which provide package status information are also set
+automatically when using a config-file package. The ``<Package>_FOUND``
+variable is set to true or false, depending on whether the package was
+found. The ``<Package>_DIR`` cache variable is set to the location of the
+package configuration file.
+
+Find-module Packages
+--------------------
+
+A find module is a file with a set of rules for finding the required pieces of
+a dependency, primarily header files and libraries. Typically, a find module
+is needed when the upstream is not built with CMake, or is not CMake-aware
+enough to otherwise provide a package configuration file. Unlike a package configuration
+file, it is not shipped with upstream, but is used by downstream to find the
+files by guessing locations of files with platform-specific hints.
+
+Unlike the case of an upstream-provided package configuration file, no single point
+of reference identifies the package as being found, so the ``<Package>_FOUND``
+variable is not automatically set by the :command:`find_package` command. It
+can still be expected to be set by convention however and should be set by
+the author of the Find-module. Similarly there is no ``<Package>_DIR`` variable,
+but each of the artifacts such as library locations and header file locations
+provide a separate cache variable.
+
+See the :manual:`cmake-developer(7)` manual for more information about creating
+Find-module files.
+
+Package Layout
+==============
+
+A config-file package consists of a `Package Configuration File`_ and
+optionally a `Package Version File`_ provided with the project distribution.
+
+Package Configuration File
+--------------------------
+
+Consider a project ``Foo`` that installs the following files::
+
+ <prefix>/include/foo-1.2/foo.h
+ <prefix>/lib/foo-1.2/libfoo.a
+
+It may also provide a CMake package configuration file::
+
+ <prefix>/lib/cmake/foo-1.2/FooConfig.cmake
+
+with content defining :prop_tgt:`IMPORTED` targets, or defining variables, such
+as:
+
+.. code-block:: cmake
+
+ # ...
+ # (compute PREFIX relative to file location)
+ # ...
+ set(Foo_INCLUDE_DIRS ${PREFIX}/include/foo-1.2)
+ set(Foo_LIBRARIES ${PREFIX}/lib/foo-1.2/libfoo.a)
+
+If another project wishes to use ``Foo`` it need only to locate the ``FooConfig.cmake``
+file and load it to get all the information it needs about package content
+locations. Since the package configuration file is provided by the package
+installation it already knows all the file locations.
+
+The :command:`find_package` command may be used to search for the package
+configuration file. This command constructs a set of installation prefixes
+and searches under each prefix in several locations. Given the name ``Foo``,
+it looks for a file called ``FooConfig.cmake`` or ``foo-config.cmake``.
+The full set of locations is specified in the :command:`find_package` command
+documentation. One place it looks is::
+
+ <prefix>/lib/cmake/Foo*/
+
+where ``Foo*`` is a case-insensitive globbing expression. In our example the
+globbing expression will match ``<prefix>/lib/cmake/foo-1.2`` and the package
+configuration file will be found.
+
+Once found, a package configuration file is immediately loaded. It, together
+with a package version file, contains all the information the project needs to
+use the package.
+
+Package Version File
+--------------------
+
+When the :command:`find_package` command finds a candidate package configuration
+file it looks next to it for a version file. The version file is loaded to test
+whether the package version is an acceptable match for the version requested.
+If the version file claims compatibility the configuration file is accepted.
+Otherwise it is ignored.
+
+The name of the package version file must match that of the package configuration
+file but has either ``-version`` or ``Version`` appended to the name before
+the ``.cmake`` extension. For example, the files::
+
+ <prefix>/lib/cmake/foo-1.3/foo-config.cmake
+ <prefix>/lib/cmake/foo-1.3/foo-config-version.cmake
+
+and::
+
+ <prefix>/lib/cmake/bar-4.2/BarConfig.cmake
+ <prefix>/lib/cmake/bar-4.2/BarConfigVersion.cmake
+
+are each pairs of package configuration files and corresponding package version
+files.
+
+When the :command:`find_package` command loads a version file it first sets the
+following variables:
+
+``PACKAGE_FIND_NAME``
+ The <package> name
+
+``PACKAGE_FIND_VERSION``
+ Full requested version string
+
+``PACKAGE_FIND_VERSION_MAJOR``
+ Major version if requested, else 0
+
+``PACKAGE_FIND_VERSION_MINOR``
+ Minor version if requested, else 0
+
+``PACKAGE_FIND_VERSION_PATCH``
+ Patch version if requested, else 0
+
+``PACKAGE_FIND_VERSION_TWEAK``
+ Tweak version if requested, else 0
+
+``PACKAGE_FIND_VERSION_COUNT``
+ Number of version components, 0 to 4
+
+The version file must use these variables to check whether it is compatible or
+an exact match for the requested version and set the following variables with
+results:
+
+``PACKAGE_VERSION``
+ Full provided version string
+
+``PACKAGE_VERSION_EXACT``
+ True if version is exact match
+
+``PACKAGE_VERSION_COMPATIBLE``
+ True if version is compatible
+
+``PACKAGE_VERSION_UNSUITABLE``
+ True if unsuitable as any version
+
+Version files are loaded in a nested scope so they are free to set any variables
+they wish as part of their computation. The find_package command wipes out the
+scope when the version file has completed and it has checked the output
+variables. When the version file claims to be an acceptable match for the
+requested version the find_package command sets the following variables for
+use by the project:
+
+``<package>_VERSION``
+ Full provided version string
+
+``<package>_VERSION_MAJOR``
+ Major version if provided, else 0
+
+``<package>_VERSION_MINOR``
+ Minor version if provided, else 0
+
+``<package>_VERSION_PATCH``
+ Patch version if provided, else 0
+
+``<package>_VERSION_TWEAK``
+ Tweak version if provided, else 0
+
+``<package>_VERSION_COUNT``
+ Number of version components, 0 to 4
+
+The variables report the version of the package that was actually found.
+The ``<package>`` part of their name matches the argument given to the
+:command:`find_package` command.
+
+Creating Packages
+=================
+
+Usually, the upstream depends on CMake itself and can use some CMake facilities
+for creating the package files. Consider an upstream which provides a single
+shared library:
+
+.. code-block:: cmake
+
+ project(UpstreamLib)
+
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+
+ set(Upstream_VERSION 3.4.1)
+
+ include(GenerateExportHeader)
+
+ add_library(ClimbingStats SHARED climbingstats.cpp)
+ generate_export_header(ClimbingStats)
+ set_property(TARGET ClimbingStats PROPERTY VERSION ${Upstream_VERSION})
+ set_property(TARGET ClimbingStats PROPERTY SOVERSION 3)
+ set_property(TARGET ClimbingStats PROPERTY INTERFACE_ClimbingStats_MAJOR_VERSION 3)
+ set_property(TARGET ClimbingStats APPEND PROPERTY
+ COMPATIBLE_INTERFACE_STRING ClimbingStats_MAJOR_VERSION
+ )
+
+ install(TARGETS ClimbingStats EXPORT ClimbingStatsTargets
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include
+ )
+ install(
+ FILES
+ climbingstats.h
+ "${CMAKE_CURRENT_BINARY_DIR}/climbingstats_export.h"
+ DESTINATION
+ include
+ COMPONENT
+ Devel
+ )
+
+ include(CMakePackageConfigHelpers)
+ write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfigVersion.cmake"
+ VERSION ${Upstream_VERSION}
+ COMPATIBILITY AnyNewerVersion
+ )
+
+ export(EXPORT ClimbingStatsTargets
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsTargets.cmake"
+ NAMESPACE Upstream::
+ )
+ configure_file(cmake/ClimbingStatsConfig.cmake
+ "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake"
+ COPY_ONLY
+ )
+
+ set(ConfigPackageLocation lib/cmake/ClimbingStats)
+ install(EXPORT ClimbingStatsTargets
+ FILE
+ ClimbingStatsTargets.cmake
+ NAMESPACE
+ Upstream::
+ DESTINATION
+ ${ConfigPackageLocation}
+ )
+ install(
+ FILES
+ cmake/ClimbingStatsConfig.cmake
+ "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfigVersion.cmake"
+ DESTINATION
+ ${ConfigPackageLocation}
+ COMPONENT
+ Devel
+ )
+
+The :module:`CMakePackageConfigHelpers` module provides a macro for creating
+a simple ``ConfigVersion.cmake`` file. This file sets the version of the
+package. It is read by CMake when :command:`find_package` is called to
+determine the compatibility with the requested version, and to set some
+version-specific variables ``<Package>_VERSION``, ``<Package>_VERSION_MAJOR``,
+``<Package>_VERSION_MINOR`` etc. The :command:`install(EXPORT)` command is
+used to export the targets in the ``ClimbingStatsTargets`` export-set, defined
+previously by the :command:`install(TARGETS)` command. This command generates
+the ``ClimbingStatsTargets.cmake`` file to contain :prop_tgt:`IMPORTED`
+targets, suitable for use by downsteams and arranges to install it to
+``lib/cmake/ClimbingStats``. The generated ``ClimbingStatsConfigVersion.cmake``
+and a ``cmake/ClimbingStatsConfig.cmake`` are installed to the same location,
+completing the package.
+
+The generated :prop_tgt:`IMPORTED` targets have appropriate properties set
+to define their usage requirements, such as
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
+:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` and other relevant built-in
+``INTERFACE_`` properties. The ``INTERFACE`` variant of user-defined
+properties listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and
+other :ref:`Compatible Interface Properties` are also propagated to the
+generated :prop_tgt:`IMPORTED` targets. In the above case,
+``ClimbingStats_MAJOR_VERSION`` is defined as a string which must be
+compatible among the dependencies of any depender. By setting this custom
+defined user property in this version and in the next version of
+``ClimbingStats``, :manual:`cmake(1)` will issue a diagnostic if there is an
+attempt to use version 3 together with version 4. Packages can choose to
+employ such a pattern if different major versions of the package are designed
+to be incompatible.
+
+A ``NAMESPACE`` with double-colons is specified when exporting the targets
+for installation. This convention of double-colons gives CMake a hint that
+the name is an :prop_tgt:`IMPORTED` target when it is used by downstreams
+with the :command:`target_link_libraries` command. This way, CMake can
+issue a diagnostic if the package providing it has not yet been found.
+
+In this case, when using :command:`install(TARGETS)` the ``INCLUDES DESTINATION``
+was specified. This causes the ``IMPORTED`` targets to have their
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` populated with the ``include``
+directory in the :variable:`CMAKE_INSTALL_PREFIX`. When the ``IMPORTED``
+target is used by downsteam, it automatically consumes the entries from
+that property.
+
+In this case, the ``ClimbingStatsConfig.cmake`` file could be as simple as:
+
+.. code-block:: cmake
+
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
+
+As this allows downstreams to use the ``IMPORTED`` targets. If any macros
+should be provided by the ``ClimbingStats`` package, they should
+be in a separate file which is installed to the same location as the
+``ClimbingStatsConfig.cmake`` file, and included from there.
+
+The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets
+definition file which is specific to the build-tree. This can similiarly be
+used with a suitable package configuration file and package version file to
+define a package for the build tree which may be used without installation.
+Consumers of the build tree can simply ensure that the
+:variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the
+``ClimbingStats_DIR`` to ``<build_dir>/ClimbingStats`` in the cache.
+
+This can also be extended to cover dependencies:
+
+.. code-block:: cmake
+
+ # ...
+ add_library(ClimbingStats SHARED climbingstats.cpp)
+ generate_export_header(ClimbingStats)
+
+ find_package(Stats 2.6.4 REQUIRED)
+ target_link_libraries(ClimbingStats PUBLIC Stats::Types)
+
+As the ``Stats::Types`` target is a ``PUBLIC`` dependency of ``ClimbingStats``,
+downsteams must also find the ``Stats`` package and link to the ``Stats::Types``
+library. The ``Stats`` package should be found in the ``ClimbingStatsConfig.cmake``
+file to ensure this. The ``find_dependency`` macro from the
+:module:`CMakeFindDependencyMacro` helps with this by propagating
+whether the package is ``REQUIRED``, or ``QUIET`` etc. All ``REQUIRED``
+dependencies of a package should be found in the ``Config.cmake`` file:
+
+.. code-block:: cmake
+
+ include(CMakeFindDependencyMacro)
+ find_dependency(Stats 2.6.4)
+
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake")
+
+The ``find_dependency`` macro also sets ``ClimbingStats_FOUND`` to ``False`` if
+the dependency is not found, along with a diagnostic that the ``ClimbingStats``
+package can not be used without the ``Stats`` package.
+
+If ``COMPONENTS`` are specified when the downstream uses :command:`find_package`,
+they are listed in the ``<Package>_FIND_COMPONENTS`` variable. If a particular
+component is non-optional, then the ``<Package>_FIND_REQUIRED_<comp>`` will
+be true. This can be tested with logic in the package configuration file:
+
+.. code-block:: cmake
+
+ include(CMakeFindDependencyMacro)
+ find_dependency(Stats 2.6.4)
+
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake")
+
+ set(_supported_components Plot Table)
+
+ foreach(_comp ${ClimbingStats_FIND_COMPONENTS})
+ if (NOT ";${_supported_components};" MATCHES _comp)
+ set(ClimbingStats_FOUND False)
+ set(ClimbingStats_NOTFOUND_MESSAGE "Specified unsupported component: ${_comp}")
+ endif()
+ include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake")
+ endforeach()
+
+Here, the ``ClimbingStats_NOTFOUND_MESSAGE`` is set to a diagnosis that the package
+could not be found because an invalid component was specified. This message
+variable can be set for any case where the ``_FOUND`` variable is set to ``False``,
+and will be displayed to the user.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 5e94f89..9138660 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -21,7 +21,23 @@ for a policy, also avoiding the warning.
The :command:`cmake_minimum_required` command does more than report an
error if a too-old version of CMake is used to build a project. It
also sets all policies introduced in that CMake version or earlier to
-NEW behavior.
+NEW behavior. To manage policies without increasing the minimum required
+CMake version, the :command:`if(POLICY)` command may be used:
+
+.. code-block:: cmake
+
+ if(POLICY CMP0990)
+ cmake_policy(SET CMP0990 NEW)
+ endif()
+
+This has the effect of using the NEW behavior with newer CMake releases which
+users may be using and not issuing a compatibility warning.
+
+The setting of a policy is confined in some cases to not propagate to the
+parent scope. For example, if the files read by the :command:`include` command
+or the :command:`find_package` command contain a use of :command:`cmake_policy`,
+that policy setting will not affect the caller by default. Both commands accept
+an optional ``NO_POLICY_SCOPE`` keyword to control this behavior.
The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
@@ -75,3 +91,4 @@ All Policies
/policy/CMP0039
/policy/CMP0040
/policy/CMP0041
+ /policy/CMP0042
diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst
index fbe546e..fb529ad 100644
--- a/Help/manual/cmake-toolchains.7.rst
+++ b/Help/manual/cmake-toolchains.7.rst
@@ -20,19 +20,29 @@ with information about compiler and utility paths.
Languages
=========
-Languages are enabled by the :command:`project` command. If no project command
+Languages are enabled by the :command:`project` command. Language-specific
+built-in variables, such as
+:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>`,
+:variable:`CMAKE_CXX_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` etc are set by
+invoking the :command:`project` command. If no project command
is in the top-level CMakeLists file, one will be implicitly generated. By default
-the enabled languages are C and CXX::
+the enabled languages are C and CXX:
+
+.. code-block:: cmake
project(C_Only C)
A special value of NONE can also be used with the :command:`project` command
-to enable no languages::
+to enable no languages:
+
+.. code-block:: cmake
project(MyProject NONE)
The :command:`enable_language` command can be used to enable languages after the
-:command:`project` command::
+:command:`project` command:
+
+.. code-block:: cmake
enable_language(CXX)
@@ -86,7 +96,9 @@ Cross Compiling
If :manual:`cmake(1)` is invoked with the command line parameter
``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set
values for the compilers. A typical cross-compiling toolchain has content such
-as::
+as:
+
+.. code-block:: cmake
set(CMAKE_SYSTEM_NAME Linux)
@@ -127,7 +139,9 @@ the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables.
Some compilers are inherently cross compilers, such as Clang and the QNX QCC
compiler. The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
-value to those supported compilers when compiling::
+value to those supported compilers when compiling:
+
+.. code-block:: cmake
set(CMAKE_SYSTEM_NAME Linux)
@@ -138,7 +152,9 @@ value to those supported compilers when compiling::
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
-Or, for QCC::
+Or, for QCC:
+
+.. code-block:: cmake
set(CMAKE_SYSTEM_NAME QNX)
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index d86db37..aebfe87 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -207,6 +207,7 @@ Variables that Control the Build
/variable/CMAKE_LINK_LIBRARY_FILE_FLAG
/variable/CMAKE_LINK_LIBRARY_FLAG
/variable/CMAKE_MACOSX_BUNDLE
+ /variable/CMAKE_MACOSX_RPATH
/variable/CMAKE_MAP_IMPORTED_CONFIG_CONFIG
/variable/CMAKE_MODULE_LINKER_FLAGS_CONFIG
/variable/CMAKE_MODULE_LINKER_FLAGS
diff --git a/Help/module/CMakeFindDependencyMacro.rst b/Help/module/CMakeFindDependencyMacro.rst
new file mode 100644
index 0000000..5b5b550
--- /dev/null
+++ b/Help/module/CMakeFindDependencyMacro.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/CMakeFindDependencyMacro.cmake
diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst
index d068c55..16a5bc3 100644
--- a/Help/policy/CMP0022.rst
+++ b/Help/policy/CMP0022.rst
@@ -22,6 +22,10 @@ downstream users of CMake versions older than 2.8.12. The
target_link_libraries command will no longer populate the properties
matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy is NEW.
+Warning-free future-compatible code which works with CMake 2.8.9 onwards
+can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
+of :command:`target_link_libraries`.
+
The OLD behavior for this policy is to ignore the
INTERFACE_LINK_LIBRARIES property for in-build targets. The NEW
behavior for this policy is to use the INTERFACE_LINK_LIBRARIES
diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst
index 4c8c714..abfcc75 100644
--- a/Help/policy/CMP0024.rst
+++ b/Help/policy/CMP0024.rst
@@ -11,7 +11,7 @@ until later at generate-time, such as the link language and complete
list of link libraries. Future refactoring will change the effect of
the export() command to be executed at generate-time. Use ALIAS
targets instead in cases where the goal is to refer to targets by
-another name
+another name.
The OLD behavior for this policy is to allow including the result of
an export() command. The NEW behavior for this policy is to not to
diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst
index 059b2e6..f4d2f4e 100644
--- a/Help/policy/CMP0037.rst
+++ b/Help/policy/CMP0037.rst
@@ -11,7 +11,7 @@ diagnostics expect target names to match a restricted pattern.
Target names may contain upper and lower case letters, numbers, the underscore
character (_), dot(.), plus(+) and minus(-). As a special case, ALIAS
-targets and INTERFACE library targets may contain two consequtive colons.
+targets and IMPORTED targets may contain two consequtive colons.
Target names reserved by one or more CMake generators are not allowed.
Among others these include "all", "help" and "test".
diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst
new file mode 100644
index 0000000..0ed3bd1
--- /dev/null
+++ b/Help/policy/CMP0042.rst
@@ -0,0 +1,19 @@
+CMP0042
+-------
+
+:prop_tgt:`MACOSX_RPATH` is enabled by default.
+
+CMake 2.8.12 and newer has support for using ``@rpath`` in a target's install
+name. This was enabled by setting the target property
+:prop_tgt:`MACOSX_RPATH`. The ``@rpath`` in an install name is a more
+flexible and powerful mechanism than ``@executable_path`` or ``@loader_path``
+for locating shared libraries.
+
+CMake 3.0.0 and later prefer this property to be ON by default. Projects
+wanting ``@rpath`` in a target's install name may remove any setting of
+the :prop_tgt:`INSTALL_NAME_DIR` and :variable:`CMAKE_INSTALL_NAME_DIR`
+variables.
+
+This policy was introduced in CMake version 3.0.0. CMake version
+|release| warns when the policy is not set and uses OLD behavior. Use
+the cmake_policy command to set it to OLD or NEW explicitly.
diff --git a/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst b/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst
index 48cc8a1..5a69ef3 100644
--- a/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst
+++ b/Help/prop_gbl/AUTOGEN_TARGETS_FOLDER.rst
@@ -1,8 +1,9 @@
AUTOGEN_TARGETS_FOLDER
----------------------
-Name of FOLDER for ``*_automoc`` targets that are added automatically by CMake for targets for which AUTOMOC is enabled.
+Name of :prop_tgt:`FOLDER` for ``*_automoc`` targets that are added automatically by
+CMake for targets for which :prop_tgt:`AUTOMOC` is enabled.
-If not set, CMake uses the FOLDER property of the parent target as a
+If not set, CMake uses the :prop_tgt:`FOLDER` property of the parent target as a
default value for this property. See also the documentation for the
-FOLDER target property and the AUTOMOC target property.
+:prop_tgt:`FOLDER` target property and the :prop_tgt:`AUTOMOC` target property.
diff --git a/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst b/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst
index 185e0ec..671f86a 100644
--- a/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst
+++ b/Help/prop_gbl/AUTOMOC_TARGETS_FOLDER.rst
@@ -1,10 +1,11 @@
AUTOMOC_TARGETS_FOLDER
----------------------
-Name of FOLDER for ``*_automoc`` targets that are added automatically by CMake for targets for which AUTOMOC is enabled.
+Name of :prop_tgt:`FOLDER` for ``*_automoc`` targets that are added automatically by
+CMake for targets for which :prop_tgt:`AUTOMOC` is enabled.
-This property is obsolete. Use AUTOGEN_TARGETS_FOLDER instead.
+This property is obsolete. Use :prop_gbl:`AUTOGEN_TARGETS_FOLDER` instead.
-If not set, CMake uses the FOLDER property of the parent target as a
+If not set, CMake uses the :prop_tgt:`FOLDER` property of the parent target as a
default value for this property. See also the documentation for the
-FOLDER target property and the AUTOMOC target property.
+:prop_tgt:`FOLDER` target property and the :prop_tgt:`AUTOMOC` target property.
diff --git a/Help/prop_sf/AUTORCC_OPTIONS.rst b/Help/prop_sf/AUTORCC_OPTIONS.rst
index 4b6bb10..d9dc4d3 100644
--- a/Help/prop_sf/AUTORCC_OPTIONS.rst
+++ b/Help/prop_sf/AUTORCC_OPTIONS.rst
@@ -1,14 +1,13 @@
AUTORCC_OPTIONS
---------------
-Additional options for rcc when using autorcc (see the :prop_tgt:`AUTORCC` target
-property)
+Additional options for ``rcc`` when using :prop_tgt:`AUTORCC`
This property holds additional command line options which will be used when
-rcc is executed during the build via autorcc, i.e. it is equivalent to the
-optional OPTIONS argument of the qt4_add_resources() macro.
+``rcc`` is executed during the build via :prop_tgt:`AUTORCC`, i.e. it is equivalent to the
+optional ``OPTIONS`` argument of the :module:`qt4_add_resources() <FindQt4>` macro.
By default it is empty.
-The options set on the .qrc source file may override :prop_tgt:`AUTORCC_OPTIONS` set
+The options set on the ``.qrc`` source file may override :prop_tgt:`AUTORCC_OPTIONS` set
on the target.
diff --git a/Help/prop_sf/AUTOUIC_OPTIONS.rst b/Help/prop_sf/AUTOUIC_OPTIONS.rst
index a38b2f8..6dfabb0 100644
--- a/Help/prop_sf/AUTOUIC_OPTIONS.rst
+++ b/Help/prop_sf/AUTOUIC_OPTIONS.rst
@@ -1,14 +1,14 @@
AUTOUIC_OPTIONS
---------------
-Additional options for uic when using autouic (see the :prop_tgt:`AUTOUIC` target property)
+Additional options for ``uic`` when using :prop_tgt:`AUTOUIC`
This property holds additional command line options
-which will be used when uic is executed during the build via autouic,
-i.e. it is equivalent to the optional OPTIONS argument of the
-qt4_wrap_ui() macro.
+which will be used when ``uic`` is executed during the build via :prop_tgt:`AUTOUIC`,
+i.e. it is equivalent to the optional ``OPTIONS`` argument of the
+:module:`qt4_wrap_ui()<FindQt4>` macro.
By default it is empty.
-The options set on the .ui source file may override :prop_tgt:`AUTOUIC_OPTIONS` set
+The options set on the ``.ui`` source file may override :prop_tgt:`AUTOUIC_OPTIONS` set
on the target.
diff --git a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
index 006c83a..3e6c4d1 100644
--- a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
+++ b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
@@ -3,12 +3,12 @@ AUTOGEN_TARGET_DEPENDS
Target dependencies of the corresponding ``_automoc`` target.
-Targets which have their :prop_tgt:`AUTOMOC` target set to true have a
+Targets which have their :prop_tgt:`AUTOMOC` target set to ``TRUE`` have a
corresponding ``_automoc`` target which is used to autogenerate generate moc
files. As this ``_automoc`` target is created at generate-time, it is not
-possible to define dependencies of it, such as to create inputs for the moc
+possible to define dependencies of it, such as to create inputs for the ``moc``
executable.
-The ``AUTOGEN_TARGET_DEPENDS`` target can be set instead to a list of dependencies
-for the ``_automoc`` target. The buildsystem will be generated to depend on its
-contents.
+The ``AUTOGEN_TARGET_DEPENDS`` target property can be set instead to a list of
+dependencies for the ``_automoc`` target. The buildsystem will be generated to
+depend on its contents.
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index 8af1116..16094c7 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -3,29 +3,29 @@ AUTOMOC
Should the target be processed with automoc (for Qt projects).
-AUTOMOC is a boolean specifying whether CMake will handle the Qt moc
+AUTOMOC is a boolean specifying whether CMake will handle the Qt ``moc``
preprocessor automatically, i.e. without having to use the
-QT4_WRAP_CPP() or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are
-supported. When this property is set to TRUE, CMake will scan the
-source files at build time and invoke moc accordingly. If an #include
-statement like #include "moc_foo.cpp" is found, the Q_OBJECT class
-declaration is expected in the header, and moc is run on the header
-file. If an #include statement like #include "foo.moc" is found, then
-a Q_OBJECT is expected in the current source file and moc is run on
+:module:`QT4_WRAP_CPP() <FindQt4>` or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are
+supported. When this property is set to ``TRUE``, CMake will scan the
+source files at build time and invoke moc accordingly. If an ``#include``
+statement like ``#include "moc_foo.cpp"`` is found, the ``Q_OBJECT`` class
+declaration is expected in the header, and ``moc`` is run on the header
+file. If an ``#include`` statement like ``#include "foo.moc"`` is found, then
+a ``Q_OBJECT`` is expected in the current source file and ``moc`` is run on
the file itself. Additionally, all header files are parsed for
-Q_OBJECT macros, and if found, moc is also executed on those files.
+``Q_OBJECT`` macros, and if found, ``moc`` is also executed on those files.
The resulting moc files, which are not included as shown above in any
of the source files are included in a generated
-<targetname>_automoc.cpp file, which is compiled as part of the
-target.This property is initialized by the value of the variable
-CMAKE_AUTOMOC if it is set when a target is created.
+``<targetname>_automoc.cpp`` file, which is compiled as part of the
+target. This property is initialized by the value of the variable
+:variable:`CMAKE_AUTOMOC` if it is set when a target is created.
Additional command line options for moc can be set via the
-AUTOMOC_MOC_OPTIONS property.
+:prop_tgt:`AUTOMOC_MOC_OPTIONS` property.
-By setting the CMAKE_AUTOMOC_RELAXED_MODE variable to TRUE the rules
-for searching the files which will be processed by moc can be relaxed.
+By setting the :variable:`CMAKE_AUTOMOC_RELAXED_MODE` variable to ``TRUE`` the
+rules for searching the files which will be processed by moc can be relaxed.
See the documentation for this variable for more details.
-The global property AUTOMOC_TARGETS_FOLDER can be used to group the
+The global property :prop_gbl:`AUTOMOC_TARGETS_FOLDER` can be used to group the
automoc targets together in an IDE, e.g. in MSVS.
diff --git a/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst b/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
index 6ab5c85..d086bf5 100644
--- a/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOMOC_MOC_OPTIONS.rst
@@ -1,12 +1,12 @@
AUTOMOC_MOC_OPTIONS
-------------------
-Additional options for moc when using automoc (see the AUTOMOC property)
+Additional options for moc when using :prop_tgt:`AUTOMOC`
-This property is only used if the AUTOMOC property is set to TRUE for
-this target. In this case, it holds additional command line options
-which will be used when moc is executed during the build, i.e. it is
-equivalent to the optional OPTIONS argument of the qt4_wrap_cpp()
+This property is only used if the :prop_tgt:`AUTOMOC` property is set to ``TRUE``
+for this target. In this case, it holds additional command line options
+which will be used when ``moc`` is executed during the build, i.e. it is
+equivalent to the optional ``OPTIONS`` argument of the :module:`qt4_wrap_cpp() <FindQt4>`
macro.
By default it is empty.
diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst
index ef2c9c8..f6409ea 100644
--- a/Help/prop_tgt/AUTORCC.rst
+++ b/Help/prop_tgt/AUTORCC.rst
@@ -4,18 +4,18 @@ AUTORCC
Should the target be processed with autorcc (for Qt projects).
-AUTORCC is a boolean specifying whether CMake will handle
-the Qt rcc code generator automatically, i.e. without having to use
-the QT4_ADD_RESOURCES() or QT5_ADD_RESOURCES() macro. Currently Qt4 and Qt5 are
-supported.
+``AUTORCC`` is a boolean specifying whether CMake will handle
+the Qt ``rcc`` code generator automatically, i.e. without having to use
+the :module:`QT4_ADD_RESOURCES() <FindQt4>` or QT5_ADD_RESOURCES() macro.
+Currently Qt4 and Qt5 are supported.
-When this property is set to TRUE, CMake will handle .qrc files added
-as target sources at build time and invoke rcc accordingly.
+When this property is set to ``TRUE``, CMake will handle ``.qrc`` files added
+as target sources at build time and invoke ``rcc`` accordingly.
This property is initialized by the value of the :variable:`CMAKE_AUTORCC`
variable if it is set when a target is created.
Additional command line options for rcc can be set via the
-:prop_sf:`AUTORCC_OPTIONS` source file property on the .qrc file.
+:prop_sf:`AUTORCC_OPTIONS` source file property on the ``.qrc`` file.
The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the
autouic targets together in an IDE, e.g. in MSVS.
diff --git a/Help/prop_tgt/AUTORCC_OPTIONS.rst b/Help/prop_tgt/AUTORCC_OPTIONS.rst
index 489e277..1dd82ee 100644
--- a/Help/prop_tgt/AUTORCC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTORCC_OPTIONS.rst
@@ -1,12 +1,12 @@
AUTORCC_OPTIONS
---------------
-Additional options for rcc when using autorcc (see the :prop_tgt:`AUTORCC` target property)
+Additional options for ``rcc`` when using :prop_tgt:`AUTORCC`
This property holds additional command line options
-which will be used when rcc is executed during the build via autorcc,
-i.e. it is equivalent to the optional OPTIONS argument of the
-qt4_add_resources() macro.
+which will be used when ``rcc`` is executed during the build via :prop_tgt:`AUTORCC`,
+i.e. it is equivalent to the optional ``OPTIONS`` argument of the
+:module:`qt4_add_resources() <FindQt4>` macro.
By default it is empty.
@@ -14,4 +14,4 @@ This property is initialized by the value of the variable
:variable:`CMAKE_AUTORCC` if it is set when a target is created.
The options set on the target may be overridden by :prop_sf:`AUTORCC_OPTIONS` set
-on the .qrc source file.
+on the ``.qrc`` source file.
diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst
index 548c259..010c027 100644
--- a/Help/prop_tgt/AUTOUIC.rst
+++ b/Help/prop_tgt/AUTOUIC.rst
@@ -3,20 +3,20 @@ AUTOUIC
Should the target be processed with autouic (for Qt projects).
-AUTOUIC is a boolean specifying whether CMake will handle
-the Qt uic code generator automatically, i.e. without having to use
-the QT4_WRAP_UI() or QT5_WRAP_UI() macro. Currently Qt4 and Qt5 are
-supported.
+``AUTOUIC`` is a boolean specifying whether CMake will handle
+the Qt ``uic`` code generator automatically, i.e. without having to use
+the :module:`QT4_WRAP_UI() <FindQt4>` or QT5_WRAP_UI() macro. Currently Qt4
+and Qt5 are supported.
-When this property is set to TRUE, CMake will scan the source files
-at build time and invoke uic accordingly.
-If an #include statement like #include "ui_foo.h" is found in
-foo.cpp, a foo.ui file is expected next to foo.cpp, and uic is
-run on the foo.ui file.
+When this property is set to ``TRUE``, CMake will scan the source files
+at build time and invoke ``uic`` accordingly.
+If an ``#include`` statement like ``#include "ui_foo.h"`` is found in
+``foo.cpp``, a ``foo.ui`` file is expected next to ``foo.cpp``, and ``uic`` is
+run on the ``foo.ui`` file.
This property is initialized by the value of the :variable:`CMAKE_AUTOUIC`
variable if it is set when a target is created.
Additional command line options for uic can be set via the
-:prop_sf:`AUTOUIC_OPTIONS` source file property on the foo.ui file.
+:prop_sf:`AUTOUIC_OPTIONS` source file property on the ``foo.ui`` file.
The global property :prop_gbl:`AUTOGEN_TARGETS_FOLDER` can be used to group the
autouic targets together in an IDE, e.g. in MSVS.
diff --git a/Help/prop_tgt/AUTOUIC_OPTIONS.rst b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
index aeec38b..d0f865c 100644
--- a/Help/prop_tgt/AUTOUIC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
@@ -1,12 +1,12 @@
AUTOUIC_OPTIONS
---------------
-Additional options for uic when using autouic (see the :prop_tgt:`AUTOUIC` target property)
+Additional options for uic when using :prop_tgt:`AUTOUIC`
This property holds additional command line options
-which will be used when uic is executed during the build via autouic,
-i.e. it is equivalent to the optional OPTIONS argument of the
-qt4_wrap_ui() macro.
+which will be used when ``uic`` is executed during the build via :prop_tgt:`AUTOUIC`,
+i.e. it is equivalent to the optional ``OPTIONS`` argument of the
+:module:`qt4_wrap_ui() <FindQt4>` macro.
By default it is empty.
@@ -14,7 +14,7 @@ This property is initialized by the value of the variable
:variable:`CMAKE_AUTOUIC` if it is set when a target is created.
The options set on the target may be overridden by :prop_sf:`AUTOUIC_OPTIONS` set
-on the .ui source file.
+on the ``.ui`` source file.
This property may use "generator expressions" with the syntax "$<...>".
See the :manual:`cmake-generator-expressions(7)` manual for available
diff --git a/Help/prop_tgt/MACOSX_RPATH.rst b/Help/prop_tgt/MACOSX_RPATH.rst
index f2d8078..d3934ba 100644
--- a/Help/prop_tgt/MACOSX_RPATH.rst
+++ b/Help/prop_tgt/MACOSX_RPATH.rst
@@ -4,7 +4,15 @@ MACOSX_RPATH
Whether to use rpaths on Mac OS X.
When this property is set to true, the directory portion of
-the"install_name" field of shared libraries will default to
-"@rpath".Runtime paths will also be embedded in binaries using this
-target.This property is initialized by the value of the variable
-CMAKE_MACOSX_RPATH if it is set when a target is created.
+the "install_name" field of shared libraries will be ``@rpath``
+unless overridden by :prop_tgt:`INSTALL_NAME_DIR`. Runtime
+paths will also be embedded in binaries using this target and
+can be controlled by the :prop_tgt:`INSTALL_RPATH` target property.
+This property is initialized by the value of the variable
+:variable:`CMAKE_MACOSX_RPATH` if it is set when a target is
+created.
+
+Policy CMP0042 was introduced to change the default value of
+MACOSX_RPATH to ON. This is because use of ``@rpath`` is a
+more flexible and powerful alternative to ``@executable_path`` and
+``@loader_path``.
diff --git a/Help/variable/CMAKE_AUTOMOC.rst b/Help/variable/CMAKE_AUTOMOC.rst
index 87e8a9b..02e5eb5 100644
--- a/Help/variable/CMAKE_AUTOMOC.rst
+++ b/Help/variable/CMAKE_AUTOMOC.rst
@@ -1,7 +1,7 @@
CMAKE_AUTOMOC
-------------
-Whether to handle moc automatically for Qt targets.
+Whether to handle ``moc`` automatically for Qt targets.
-This variable is used to initialize the AUTOMOC property on all the
+This variable is used to initialize the :prop_tgt:`AUTOMOC` property on all the
targets. See that target property for additional information.
diff --git a/Help/variable/CMAKE_AUTOMOC_MOC_OPTIONS.rst b/Help/variable/CMAKE_AUTOMOC_MOC_OPTIONS.rst
index bdbed85..09bf5cd 100644
--- a/Help/variable/CMAKE_AUTOMOC_MOC_OPTIONS.rst
+++ b/Help/variable/CMAKE_AUTOMOC_MOC_OPTIONS.rst
@@ -1,8 +1,7 @@
CMAKE_AUTOMOC_MOC_OPTIONS
-------------------------
-Additional options for moc when using automoc (see CMAKE_AUTOMOC).
+Additional options for ``moc`` when using :variable:`CMAKE_AUTOMOC`.
-This variable is used to initialize the AUTOMOC_MOC_OPTIONS property
-on all the targets. See that target property for additional
-information.
+This variable is used to initialize the :prop_tgt:`AUTOMOC_MOC_OPTIONS` property
+on all the targets. See that target property for additional information.
diff --git a/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst b/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst
index 8858410..a814d40 100644
--- a/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst
+++ b/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst
@@ -3,11 +3,11 @@ CMAKE_AUTOMOC_RELAXED_MODE
Switch between strict and relaxed automoc mode.
-By default, automoc behaves exactly as described in the documentation
-of the AUTOMOC target property. When set to TRUE, it accepts more
-input and tries to find the correct input file for moc even if it
+By default, :prop_tgt:`AUTOMOC` behaves exactly as described in the documentation
+of the :prop_tgt:`AUTOMOC` target property. When set to ``TRUE``, it accepts more
+input and tries to find the correct input file for ``moc`` even if it
differs from the documented behaviour. In this mode it e.g. also
checks whether a header file is intended to be processed by moc when a
-"foo.moc" file has been included.
+``"foo.moc"`` file has been included.
Relaxed mode has to be enabled for KDE4 compatibility.
diff --git a/Help/variable/CMAKE_AUTORCC.rst b/Help/variable/CMAKE_AUTORCC.rst
index d213993..067f766 100644
--- a/Help/variable/CMAKE_AUTORCC.rst
+++ b/Help/variable/CMAKE_AUTORCC.rst
@@ -1,7 +1,7 @@
CMAKE_AUTORCC
-------------
-Whether to handle rcc automatically for Qt targets.
+Whether to handle ``rcc`` automatically for Qt targets.
This variable is used to initialize the :prop_tgt:`AUTORCC` property on all the targets.
See that target property for additional information.
diff --git a/Help/variable/CMAKE_AUTORCC_OPTIONS.rst b/Help/variable/CMAKE_AUTORCC_OPTIONS.rst
index 5efbfa3..298cb6b 100644
--- a/Help/variable/CMAKE_AUTORCC_OPTIONS.rst
+++ b/Help/variable/CMAKE_AUTORCC_OPTIONS.rst
@@ -1,7 +1,7 @@
CMAKE_AUTORCC_OPTIONS
---------------------
-Whether to handle rcc automatically for Qt targets.
+Whether to handle ``rcc`` automatically for Qt targets.
This variable is used to initialize the :prop_tgt:`AUTORCC_OPTIONS` property on
all the targets. See that target property for additional information.
diff --git a/Help/variable/CMAKE_AUTOUIC.rst b/Help/variable/CMAKE_AUTOUIC.rst
index 3b016b0..0beb555 100644
--- a/Help/variable/CMAKE_AUTOUIC.rst
+++ b/Help/variable/CMAKE_AUTOUIC.rst
@@ -1,7 +1,7 @@
CMAKE_AUTOUIC
-------------
-Whether to handle uic automatically for Qt targets.
+Whether to handle ``uic`` automatically for Qt targets.
This variable is used to initialize the :prop_tgt:`AUTOUIC` property on all the targets.
See that target property for additional information.
diff --git a/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst b/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst
index 6a88669..3c9b8c4 100644
--- a/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst
+++ b/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst
@@ -1,7 +1,7 @@
CMAKE_AUTOUIC_OPTIONS
---------------------
-Whether to handle uic automatically for Qt targets.
+Whether to handle ``uic`` automatically for Qt targets.
This variable is used to initialize the :prop_tgt:`AUTOUIC_OPTIONS` property on
all the targets. See that target property for additional information.
diff --git a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
index 6b17f6e..11aed0c 100644
--- a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
+++ b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst
@@ -5,7 +5,9 @@ Enables tracing output for target properties.
This variable can be populated with a list of properties to generate
debug output for when evaluating target properties. Currently it can
-only be used when evaluating the INCLUDE_DIRECTORIES,
-COMPILE_DEFINITIONS, COMPILE_OPTIONS and AUTOUIC_OPTIONS target properties.
-In that case, it outputs a backtrace for each entry in the target property.
+only be used when evaluating the :prop_tgt:`INCLUDE_DIRECTORIES`,
+:prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`, :prop_tgt:`AUTOUIC_OPTIONS`,
+:prop_tgt:`POSITION_INDEPENDENT_CODE` target properties and any other property
+listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other ``COMPATIBLE_INTERFACE_``
+properties. It outputs an origin for each entry in the target property.
Default is unset.
diff --git a/Help/variable/CMAKE_MACOSX_RPATH.rst b/Help/variable/CMAKE_MACOSX_RPATH.rst
new file mode 100644
index 0000000..ac897c0
--- /dev/null
+++ b/Help/variable/CMAKE_MACOSX_RPATH.rst
@@ -0,0 +1,7 @@
+CMAKE_MACOSX_RPATH
+-------------------
+
+Whether to use rpaths on Mac OS X.
+
+This variable is used to initialize the :prop_tgt:`MACOSX_RPATH` property on
+all targets.
diff --git a/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst b/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst
index 451ce8c..2420a25 100644
--- a/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst
+++ b/Help/variable/CMAKE_VERBOSE_MAKEFILE.rst
@@ -1,8 +1,9 @@
CMAKE_VERBOSE_MAKEFILE
----------------------
-Create verbose makefiles if on.
+Enable verbose output from Makefile builds.
-This variable defaults to false. You can set this variable to true to
-make CMake produce verbose makefiles that show each command line as it
-is used.
+This variable is a cache entry initialized (to FALSE) by
+the :command:`project` command. Users may enable the option
+in their local build tree to get more verbose output from
+Makefile builds and show each command line as it is launched.
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 518b8c6..2bcf3d1 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -232,7 +232,7 @@ Id flags: ${testflags}
# ...
# /path/to/cc ...CompilerId${lang}/...
# to extract the compiler front-end for the language.
- if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/\\./CompilerId${lang}[ \t\n\\\"]")
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?CompilerId${lang}[ \t\n\\\"]")
set(_comp "${CMAKE_MATCH_2}")
if(EXISTS "${_comp}")
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 47ac316..0752e04 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -2,15 +2,10 @@
# CMakeExpandImportedTargets
# --------------------------
#
-#
-#
-# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
-#
# ::
#
-# [CONFIGURATION <config>] )
-#
-#
+# CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
+# [CONFIGURATION <config>])
#
# CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces
# all imported targets contained in this list with their actual file
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
new file mode 100644
index 0000000..596c6fc
--- /dev/null
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -0,0 +1,58 @@
+#.rst:
+# CMakeFindDependencyMacro
+# -------------------------
+#
+# ::
+#
+# find_dependency(<dep> [<version>])
+#
+#
+# ``find_dependency()`` wraps a :command:`find_package` call for a package
+# dependency. It is designed to be used in a <package>Config.cmake file, and it
+# forwards the correct parameters for EXACT, QUIET and REQUIRED which were
+# passed to the original :command:`find_package` call. It also sets an
+# informative diagnostic message if the dependency could not be found.
+#
+
+#=============================================================================
+# Copyright 2013 Stephen Kelly <steveire@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+macro(find_dependency dep)
+ if (NOT ${dep}_FOUND)
+ if (${ARGV1})
+ set(version ${ARGV1})
+ endif()
+ set(exact_arg)
+ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT)
+ set(exact_arg EXACT)
+ endif()
+ set(quiet_arg)
+ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+ set(quiet_arg QUIET)
+ endif()
+ set(required_arg)
+ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
+ set(required_arg REQUIRED)
+ endif()
+
+ find_package(${dep} ${version} ${exact_arg} ${quiet_arg} ${required_arg})
+ if (NOT ${dep}_FOUND)
+ set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
+ set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
+ return()
+ endif()
+ set(required_arg)
+ set(quiet_arg)
+ set(exact_arg)
+ endif()
+endmacro()
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 855af9c..f388fe0 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -11,8 +11,7 @@
# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
# [PATH_VARS <var1> <var2> ... <varN>]
# [NO_SET_AND_CHECK_MACRO]
-# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
-# [NO_FIND_DEPENDENCY_MACRO])
+# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
#
#
#
@@ -201,9 +200,10 @@ macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
write_basic_config_version_file(${ARGN})
endmacro()
+set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR})
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
- set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO)
+ set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
set(oneValueArgs INSTALL_DESTINATION )
set(multiValueArgs PATH_VARS )
@@ -289,40 +289,6 @@ endmacro()
")
endif()
- if(NOT CCF_NO_FIND_DEPENDENCY_MACRO)
- set(PACKAGE_INIT "${PACKAGE_INIT}
-macro(find_dependency dep)
- if (NOT \${dep}_FOUND)
- if (\${ARGV1})
- set(version \${ARGV1})
- endif()
- set(exact_arg)
- if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT)
- set(exact_arg EXACT)
- endif()
- set(quiet_arg)
- if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
- set(quiet_arg QUIET)
- endif()
- set(required_arg)
- if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
- set(required_arg REQUIRED)
- endif()
-
- find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg})
- if (NOT \${dep}_FOUND)
- set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\")
- set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
- return()
- endif()
- set(required_arg)
- set(quiet_arg)
- set(exact_arg)
- endif()
-endmacro()
-")
- endif()
-
set(PACKAGE_INIT "${PACKAGE_INIT}
####################################################################################")
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index 72832ad..ad3b0d5 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -4,22 +4,15 @@
#
# Convenience macros for printing properties and variables, useful e.g. for debugging.
#
-#
-#
-#
-#
-# CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN]
-#
# ::
#
+# CMAKE_PRINT_PROPERTIES([TARGETS target1 .. targetN]
# [SOURCES source1 .. sourceN]
# [DIRECTORIES dir1 .. dirN]
# [TESTS test1 .. testN]
# [CACHE_ENTRIES entry1 .. entryN]
# PROPERTIES prop1 .. propN )
#
-#
-#
# This macro prints the values of the properties of the given targets,
# source files, directories, tests or cache entries. Exactly one of the
# scope keywords must be used. Example:
diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 237c5bc..39183c6 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -52,6 +52,7 @@
#
# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly
# converted to RTF by the WiX Generator.
+# The expected encoding of the .txt file is UTF-8.
#
# With CPACK_WIX_LICENSE_RTF you can override the license file used by the
# WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported
@@ -116,6 +117,57 @@
# If this variable is not set, the default MSI template included with CMake
# will be used.
#
+# .. variable:: CPACK_WIX_PATCH_FILE
+#
+# Optional XML file with fragments to be inserted into generated WiX sources
+#
+# This optional variable can be used to specify an XML file that the
+# WiX generator will use to inject fragments into its generated
+# source files.
+#
+# Patch files understood by the CPack WiX generator
+# roughly follow this RELAX NG compact schema:
+#
+# .. code-block:: none
+#
+# start = CPackWiXPatch
+#
+# CPackWiXPatch = element CPackWiXPatch { CPackWiXFragment* }
+#
+# CPackWiXFragment = element CPackWiXFragment
+# {
+# attribute Id { string },
+# fragmentContent*
+# }
+#
+# fragmentContent = element * - CPackWiXFragment
+# {
+# (attribute * { text } | text | fragmentContent)*
+# }
+#
+# Currently fragments can be injected into most
+# Component, File and Directory elements.
+#
+# The following example illustrates how this works.
+#
+# Given that the WiX generator creates the following XML element:
+#
+# .. code-block:: xml
+#
+# <Component Id="CM_CP_applications.bin.my_libapp.exe" Guid="*"/>
+#
+# The following XML patch file may be used to inject an Environment element
+# into it:
+#
+# .. code-block:: xml
+#
+# <CPackWiXPatch>
+# <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
+# <Environment Id="MyEnvironment" Action="set"
+# Name="MyVariableName" Value="MyVariableValue"/>
+# </CPackWiXFragment>
+# </CPackWiXPatch>
+#
# .. variable:: CPACK_WIX_EXTRA_SOURCES
#
# Extra WiX source files
@@ -153,6 +205,17 @@
#
# ``<TOOL>`` can be either LIGHT or CANDLE.
#
+# .. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
+#
+# If this variable is set the generated installer will create
+# an entry in the windows registry key
+# ``HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>``
+# The value for ``<package>`` is provided by this variable.
+#
+# Assuming you also install a CMake configuration file this will
+# allow other CMake projects to find your package with
+# the :command:`find_package` command.
+#
#=============================================================================
# Copyright 2013 Kitware, Inc.
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index a4ed8d5..a864e82 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -4,13 +4,10 @@
#
# Check if the given struct or class has the specified member variable
#
-# CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable>
-#
# ::
#
-# [LANGUAGE <language>])
-#
-#
+# CHECK_STRUCT_HAS_MEMBER(<struct> <member> <header> <variable>
+# [LANGUAGE <language>])
#
# ::
#
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index 56e739e..83789cc 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -58,17 +58,20 @@ endif(Backtrace_HEADER)
find_path(Backtrace_INCLUDE_DIR "${_Backtrace_HEADER_TRY}")
set(Backtrace_INCLUDE_DIRS ${Backtrace_INCLUDE_DIR})
-# First, check if we already have backtrace(), e.g., in libc
-cmake_push_check_state(RESET)
-set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
-check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
-cmake_pop_check_state()
+if (NOT DEFINED Backtrace_LIBRARY)
+ # First, check if we already have backtrace(), e.g., in libc
+ cmake_push_check_state(RESET)
+ set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
+ check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
+ cmake_pop_check_state()
+endif()
if(_Backtrace_SYM_FOUND)
- set(Backtrace_LIBRARY)
- if(NOT Backtrace_FIND_QUIETLY)
+ # Avoid repeating the message() call below each time CMake is run.
+ if(NOT Backtrace_FIND_QUIETLY AND NOT DEFINED Backtrace_LIBRARY)
message(STATUS "backtrace facility detected in default set of libraries")
endif()
+ set(Backtrace_LIBRARY "" CACHE FILEPATH "Library providing backtrace(3), empty for default set of libraries")
else()
# Check for external library, for non-glibc systems
if(Backtrace_INCLUDE_DIR)
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index 22a82b5..865d061 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -49,7 +49,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_path(IL_INCLUDE_DIR il.h
PATH_SUFFIXES include IL
- DOC "The path the the directory that contains il.h"
+ DOC "The path to the directory that contains il.h"
)
#message("IL_INCLUDE_DIR is ${IL_INCLUDE_DIR}")
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 179dc00..6f03c86 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -65,7 +65,10 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATH_SUFFIXES include/freetype2 include
)
-find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
+find_path(FREETYPE_INCLUDE_DIR_freetype2
+ NAMES
+ freetype/config/ftheader.h
+ config/ftheader.h
HINTS
ENV FREETYPE_DIR
PATHS
@@ -97,11 +100,18 @@ find_library(FREETYPE_LIBRARY
# set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
+ list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
-if(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
- file(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str
+if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+ set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
+elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
+ set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
+endif()
+
+if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
+ file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 24747f7..28b8454 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1203,6 +1203,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
"${QT_MKSPECS_DIR}/default"
${QT_INCLUDE_DIR}
)
+ set_property(TARGET Qt4::QtCore APPEND PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS
+ $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>
+ )
set_property(TARGET Qt4::QtCore PROPERTY
INTERFACE_QT_MAJOR_VERSION 4
)
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index ec1f881..3905e54 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -15,7 +15,7 @@
#
#
#
-# This module responds to the the flag:
+# This module responds to the flag:
#
# ::
#
@@ -23,7 +23,7 @@
# If this is defined, then no SDL_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
-# module will attempt to locate and set the the proper link flags
+# module will attempt to locate and set the proper link flags
# as part of the returned SDL_LIBRARY variable.
#
#
diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake
index 2338721..0d13318 100644
--- a/Modules/FindSubversion.cmake
+++ b/Modules/FindSubversion.cmake
@@ -73,6 +73,8 @@
# License text for the above reference.)
find_program(Subversion_SVN_EXECUTABLE svn
+ PATHS
+ [HKEY_LOCAL_MACHINE\\Software\\TortoiseSVN;Directory]/bin
DOC "subversion command line client")
mark_as_advanced(Subversion_SVN_EXECUTABLE)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 5baf9e0..f83f992 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -6,14 +6,11 @@
#
# This module provides the function GENERATE_EXPORT_HEADER().
#
-# The GENERATE_EXPORT_HEADER function can be used to generate a file
+# The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file
# suitable for preprocessor inclusion which contains EXPORT macros to be
-# used in library classes.
-#
-# GENERATE_EXPORT_HEADER( LIBRARY_TARGET
-#
-# ::
+# used in library classes::
#
+# GENERATE_EXPORT_HEADER( LIBRARY_TARGET
# [BASE_NAME <base_name>]
# [EXPORT_MACRO_NAME <export_macro_name>]
# [EXPORT_FILE_NAME <export_file_name>]
@@ -23,20 +20,21 @@
# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
# [DEFINE_NO_DEPRECATED]
# [PREFIX_NAME <prefix_name>]
+# )
#
-# )
#
-# The target properties CXX_VISIBILITY_PRESET and
-# VISIBILITY_INLINES_HIDDEN can be used to add the appropriate compile
-# flags for targets. See the documentation of those target properties,
-# and the convenience variables CMAKE_CXX_VISIBILITY_PRESET and
-# CMAKE_VISIBILITY_INLINES_HIDDEN.
+# The target properties :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>`
+# and :prop_tgt:`VISIBILITY_INLINES_HIDDEN` can be used to add the appropriate
+# compile flags for targets. See the documentation of those target properties,
+# and the convenience variables
+# :variable:`CMAKE_CXX_VISIBILITY_PRESET <CMAKE_<LANG>_VISIBILITY_PRESET>` and
+# :variable:`CMAKE_VISIBILITY_INLINES_HIDDEN`.
#
-# By default GENERATE_EXPORT_HEADER() generates macro names in a file
+# By default ``GENERATE_EXPORT_HEADER()`` generates macro names in a file
# name determined by the name of the library. This means that in the
-# simplest case, users of generate_export_header will be equivalent to:
+# simplest case, users of ``GenerateExportHeader`` will be equivalent to:
#
-# ::
+# .. code-block:: cmake
#
# set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
@@ -49,10 +47,9 @@
# )
#
#
-#
# And in the ABI header files:
#
-# ::
+# .. code-block:: c++
#
# #include "somelib_export.h"
# class SOMELIB_EXPORT SomeClass {
@@ -60,17 +57,16 @@
# };
#
#
-#
# The CMake fragment will generate a file in the
-# ${CMAKE_CURRENT_BINARY_DIR} called somelib_export.h containing the
-# macros SOMELIB_EXPORT, SOMELIB_NO_EXPORT, SOMELIB_DEPRECATED,
-# SOMELIB_DEPRECATED_EXPORT and SOMELIB_DEPRECATED_NO_EXPORT. The
+# ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
+# macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
+# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. The
# resulting file should be installed with other headers in the library.
#
-# The BASE_NAME argument can be used to override the file name and the
-# names used for the macros
+# The ``BASE_NAME`` argument can be used to override the file name and the
+# names used for the macros:
#
-# ::
+# .. code-block:: cmake
#
# add_library(somelib someclass.cpp)
# generate_export_header(somelib
@@ -78,14 +74,14 @@
# )
#
#
+# Generates a file called ``other_name_export.h`` containing the macros
+# ``OTHER_NAME_EXPORT``, ``OTHER_NAME_NO_EXPORT`` and ``OTHER_NAME_DEPRECATED``
+# etc.
#
-# Generates a file called other_name_export.h containing the macros
-# OTHER_NAME_EXPORT, OTHER_NAME_NO_EXPORT and OTHER_NAME_DEPRECATED etc.
-#
-# The BASE_NAME may be overridden by specifiying other options in the
+# The ``BASE_NAME`` may be overridden by specifiying other options in the
# function. For example:
#
-# ::
+# .. code-block:: cmake
#
# add_library(somelib someclass.cpp)
# generate_export_header(somelib
@@ -93,11 +89,10 @@
# )
#
#
+# creates the macro ``OTHER_NAME_EXPORT`` instead of ``SOMELIB_EXPORT``, but
+# other macros and the generated file name is as default:
#
-# creates the macro OTHER_NAME_EXPORT instead of SOMELIB_EXPORT, but
-# other macros and the generated file name is as default.
-#
-# ::
+# .. code-block:: cmake
#
# add_library(somelib someclass.cpp)
# generate_export_header(somelib
@@ -105,17 +100,16 @@
# )
#
#
+# creates the macro ``KDE_DEPRECATED`` instead of ``SOMELIB_DEPRECATED``.
#
-# creates the macro KDE_DEPRECATED instead of SOMELIB_DEPRECATED.
-#
-# If LIBRARY_TARGET is a static library, macros are defined without
+# If ``LIBRARY_TARGET`` is a static library, macros are defined without
# values.
#
# If the same sources are used to create both a shared and a static
-# library, the uppercased symbol ${BASE_NAME}_STATIC_DEFINE should be
-# used when building the static library
+# library, the uppercased symbol ``${BASE_NAME}_STATIC_DEFINE`` should be
+# used when building the static library:
#
-# ::
+# .. code-block:: cmake
#
# add_library(shared_variant SHARED ${lib_SRCS})
# add_library(static_variant ${lib_SRCS})
@@ -123,16 +117,14 @@
# set_target_properties(static_variant PROPERTIES
# COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
#
-#
-#
# This will cause the export macros to expand to nothing when building
# the static library.
#
-# If DEFINE_NO_DEPRECATED is specified, then a macro
-# ${BASE_NAME}_NO_DEPRECATED will be defined This macro can be used to
-# remove deprecated code from preprocessor output.
+# If ``DEFINE_NO_DEPRECATED`` is specified, then a macro
+# ``${BASE_NAME}_NO_DEPRECATED`` will be defined This macro can be used to
+# remove deprecated code from preprocessor output:
#
-# ::
+# .. code-block:: cmake
#
# option(EXCLUDE_DEPRECATED "Exclude deprecated parts of the library" FALSE)
# if (EXCLUDE_DEPRECATED)
@@ -141,10 +133,9 @@
# generate_export_header(somelib ${NO_BUILD_DEPRECATED})
#
#
-#
# And then in somelib:
#
-# ::
+# .. code-block:: c++
#
# class SOMELIB_EXPORT SomeClass
# {
@@ -154,42 +145,38 @@
# #endif
# };
#
-#
-#
-# ::
+# .. code-block:: c++
#
# #ifndef SOMELIB_NO_DEPRECATED
# void SomeClass::oldMethod() { }
# #endif
#
#
-#
-# If PREFIX_NAME is specified, the argument will be used as a prefix to
+# If ``PREFIX_NAME`` is specified, the argument will be used as a prefix to
# all generated macros.
#
# For example:
#
-# ::
+# .. code-block:: cmake
#
# generate_export_header(somelib PREFIX_NAME VTK_)
#
+# Generates the macros ``VTK_SOMELIB_EXPORT`` etc.
#
+# ::
#
-# Generates the macros VTK_SOMELIB_EXPORT etc.
-#
-#
-#
-# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
+# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
#
-# The ADD_COMPILER_EXPORT_FLAGS function adds -fvisibility=hidden to
-# CMAKE_CXX_FLAGS if supported, and is a no-op on Windows which does not
-# need extra compiler flags for exporting support. You may optionally
-# pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will be
-# populated with the required CXX_FLAGS required to enable visibility
+# The ``ADD_COMPILER_EXPORT_FLAGS`` function adds ``-fvisibility=hidden`` to
+# :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` if supported, and is a no-op
+# on Windows which does not need extra compiler flags for exporting support.
+# You may optionally pass a single argument to ``ADD_COMPILER_EXPORT_FLAGS``
+# that will be populated with the ``CXX_FLAGS`` required to enable visibility
# support for the compiler/architecture in use.
#
# This function is deprecated. Set the target properties
-# CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN instead.
+# :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
+# :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
#=============================================================================
# Copyright 2011 Stephen Kelly <steveire@gmail.com>
diff --git a/Modules/Platform/MirBSD.cmake b/Modules/Platform/MirBSD.cmake
new file mode 100644
index 0000000..7637f9b
--- /dev/null
+++ b/Modules/Platform/MirBSD.cmake
@@ -0,0 +1 @@
+include(Platform/OpenBSD)
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index b5f005f..fd9819f 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -120,6 +120,7 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
string (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
if(moc_target)
+ set (_moc_parameters_file ${_moc_parameters_file}$<$<BOOL:$<CONFIGURATION>>:_$<CONFIGURATION>>)
set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>")
set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>")
diff --git a/Modules/TestCXXAcceptsFlag.cmake b/Modules/TestCXXAcceptsFlag.cmake
index 2bcbea6..c814187 100644
--- a/Modules/TestCXXAcceptsFlag.cmake
+++ b/Modules/TestCXXAcceptsFlag.cmake
@@ -2,16 +2,18 @@
# TestCXXAcceptsFlag
# ------------------
#
-# Test CXX compiler for a flag
+# Deprecated. See :module:`CheckCXXCompilerFlag`.
#
-# Check if the CXX compiler accepts a flag
+# Check if the CXX compiler accepts a flag.
#
-# ::
+# .. code-block:: cmake
#
-# Macro CHECK_CXX_ACCEPTS_FLAG(FLAGS VARIABLE) -
-# checks if the function exists
-# FLAGS - the flags to try
-# VARIABLE - variable to store the result
+# CHECK_CXX_ACCEPTS_FLAG(<flags> <variable>)
+#
+# ``<flags>``
+# the flags to try
+# ``<variable>``
+# variable to store the result
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index f7f242b..654b4d0 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -8,19 +8,16 @@
# FindJava.cmake has already been loaded. See FindJava.cmake for
# information on how to load Java into your CMake project.
#
-# add_jar(target_name
-#
# ::
#
+# add_jar(target_name
# [SOURCES] source1 [source2 ...] [resource1 ...]
# [INCLUDE_JARS jar1 [jar2 ...]]
# [ENTRY_POINT entry]
# [VERSION version]
# [OUTPUT_NAME name]
# [OUTPUT_DIR dir]
-# )
-#
-#
+# )
#
# This command creates a <target_name>.jar. It compiles the given
# source files (source) and adds the given resource files (resource) to
@@ -189,19 +186,14 @@
# CLASS_DIR The directory where the class files can be found. For
# example to use them with javah.
#
-#
-#
-# find_jar(<VAR>
-#
# ::
#
+# find_jar(<VAR>
# name | NAMES name1 [name2 ...]
# [PATHS path1 [path2 ... ENV var]]
# [VERSIONS version1 [version2]]
# [DOC "cache documentation string"]
-# )
-#
-#
+# )
#
# This command is used to find a full path to the named jar. A cache
# entry named by <VAR> is created to stor the result of this command.
@@ -216,21 +208,24 @@
# the VERSIONS argument. The argument after DOC will be used for the
# documentation string in the cache.
#
-# install_jar(TARGET_NAME DESTINATION)
+# ::
+#
+# install_jar(TARGET_NAME DESTINATION)
#
# This command installs the TARGET_NAME files to the given DESTINATION.
# It should be called in the same scope as add_jar() or it will fail.
#
-# install_jni_symlink(TARGET_NAME DESTINATION)
+# ::
+#
+# install_jni_symlink(TARGET_NAME DESTINATION)
#
# This command installs the TARGET_NAME JNI symlinks to the given
# DESTINATION. It should be called in the same scope as add_jar() or it
# will fail.
#
-# create_javadoc(<VAR>
-#
# ::
#
+# create_javadoc(<VAR>
# PACKAGES pkg1 [pkg2 ...]
# [SOURCEPATH <sourcepath>]
# [CLASSPATH <classpath>]
@@ -240,9 +235,7 @@
# [AUTHOR TRUE|FALSE]
# [USE TRUE|FALSE]
# [VERSION TRUE|FALSE]
-# )
-#
-#
+# )
#
# Create java documentation based on files or packages. For more
# details please read the javadoc manpage.
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 67cab4a..11ca205 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -22,11 +22,9 @@
# 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. If the source file generated
-# by swig need some special flag you can use
-# set_source_files_properties( ${swig_generated_file_fullname}
-#
-# ::
+# by swig need some special flag you can use::
#
+# set_source_files_properties( ${swig_generated_file_fullname}
# PROPERTIES COMPILE_FLAGS "-bla")
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 17fb52d..3c944fb 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -517,6 +517,7 @@ if(WIN32)
CPack/WiX/cmCPackWIXGenerator.cxx
CPack/WiX/cmWIXSourceWriter.cxx
CPack/WiX/cmWIXRichTextFormatWriter.cxx
+ CPack/WiX/cmWIXPatchParser.cxx
)
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8ae87ef..08ff713 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 12)
-set(CMake_VERSION_TWEAK 20131213)
+set(CMake_VERSION_TWEAK 20140109)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index a9842c1..d9d6236 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -11,8 +11,8 @@
============================================================================*/
#include <cmsys/SystemTools.hxx>
#include <cmsys/Process.h>
-#include <cmsys/ios/fstream>
#include <cmsys/ios/iostream>
+#include <cmsys/FStream.hxx>
#include <CoreFoundation/CoreFoundation.h>
@@ -27,7 +27,7 @@ int main(int argc, char* argv[])
{
//if ( cmsys::SystemTools::FileExists(
cmsys_stl::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
- cmsys_ios::ofstream ofs("/tmp/output.txt");
+ cmsys::ofstream ofs("/tmp/output.txt");
CFStringRef fileName;
CFBundleRef appBundle;
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 1b9b20a..998b5f1 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -24,9 +24,13 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx>
+#include <cmsys/FStream.hxx>
#include <rpc.h> // for GUID generation
+#include <sys/types.h>
+#include <sys/stat.h>
+
int cmCPackWIXGenerator::InitializeInternal()
{
componentPackageMethod = ONE_PACKAGE;
@@ -53,7 +57,7 @@ bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command)
bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output,
&returnValue, 0, cmSystemTools::OUTPUT_NONE);
- std::ofstream logFile(logFileName.c_str(), std::ios::app);
+ cmsys::ofstream logFile(logFileName.c_str(), std::ios::app);
logFile << command << std::endl;
logFile << output;
logFile.close();
@@ -85,8 +89,8 @@ bool cmCPackWIXGenerator::RunCandleCommand(
command << " -arch " << GetArchitecture();
command << " -out " << QuotePath(objectFile);
- for(extension_set_t::const_iterator i = candleExtensions.begin();
- i != candleExtensions.end(); ++i)
+ for(extension_set_t::const_iterator i = CandleExtensions.begin();
+ i != CandleExtensions.end(); ++i)
{
command << " -ext " << QuotePath(*i);
}
@@ -111,8 +115,8 @@ bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles)
command << " -nologo";
command << " -out " << QuotePath(packageFileNames.at(0));
- for(extension_set_t::const_iterator i = lightExtensions.begin();
- i != lightExtensions.end(); ++i)
+ for(extension_set_t::const_iterator i = LightExtensions.begin();
+ i != LightExtensions.end(); ++i)
{
command << " -ext " << QuotePath(*i);
}
@@ -211,12 +215,18 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
SetOption("CPACK_WIX_UI_REF", defaultRef.c_str());
}
- CollectExtensions("CPACK_WIX_EXTENSIONS", candleExtensions);
- CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", candleExtensions);
+ CollectExtensions("CPACK_WIX_EXTENSIONS", CandleExtensions);
+ CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", CandleExtensions);
+
+ LightExtensions.insert("WixUIExtension");
+ CollectExtensions("CPACK_WIX_EXTENSIONS", LightExtensions);
+ CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", LightExtensions);
- lightExtensions.insert("WixUIExtension");
- CollectExtensions("CPACK_WIX_EXTENSIONS", lightExtensions);
- CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", lightExtensions);
+ const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
+ if(patchFilePath)
+ {
+ LoadPatchFragments(patchFilePath);
+ }
return true;
}
@@ -241,9 +251,9 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
AppendUserSuppliedExtraSources();
std::stringstream objectFiles;
- for(size_t i = 0; i < wixSources.size(); ++i)
+ for(size_t i = 0; i < WixSources.size(); ++i)
{
- const std::string& sourceFilename = wixSources[i];
+ const std::string& sourceFilename = WixSources[i];
std::string objectFilename =
cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj";
@@ -266,7 +276,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources()
const char *cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES");
if(!cpackWixExtraSources) return;
- cmSystemTools::ExpandListArgument(cpackWixExtraSources, wixSources);
+ cmSystemTools::ExpandListArgument(cpackWixExtraSources, WixSources);
}
void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
@@ -345,7 +355,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string directoryDefinitionsFilename =
cpackTopLevel + "/directories.wxs";
- wixSources.push_back(directoryDefinitionsFilename);
+ WixSources.push_back(directoryDefinitionsFilename);
cmWIXSourceWriter directoryDefinitions(Logger, directoryDefinitionsFilename);
directoryDefinitions.BeginElement("Fragment");
@@ -400,7 +410,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string fileDefinitionsFilename =
cpackTopLevel + "/files.wxs";
- wixSources.push_back(fileDefinitionsFilename);
+ WixSources.push_back(fileDefinitionsFilename);
cmWIXSourceWriter fileDefinitions(Logger, fileDefinitionsFilename);
fileDefinitions.BeginElement("Fragment");
@@ -408,7 +418,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string featureDefinitionsFilename =
cpackTopLevel +"/features.wxs";
- wixSources.push_back(featureDefinitionsFilename);
+ WixSources.push_back(featureDefinitionsFilename);
cmWIXSourceWriter featureDefinitions(Logger, featureDefinitionsFilename);
featureDefinitions.BeginElement("Fragment");
@@ -427,7 +437,15 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.AddAttribute("Level", "1");
- CreateFeatureHierarchy(featureDefinitions);
+ if(!CreateCMakePackageRegistryEntry(featureDefinitions))
+ {
+ return false;
+ }
+
+ if(!CreateFeatureHierarchy(featureDefinitions))
+ {
+ return false;
+ }
featureDefinitions.EndElement("Feature");
@@ -527,7 +545,62 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return false;
}
- wixSources.push_back(mainSourceFilePath);
+ WixSources.push_back(mainSourceFilePath);
+
+ std::string fragmentList;
+ for(cmWIXPatchParser::fragment_map_t::const_iterator
+ i = Fragments.begin(); i != Fragments.end(); ++i)
+ {
+ if(!fragmentList.empty())
+ {
+ fragmentList += ", ";
+ }
+
+ fragmentList += "'";
+ fragmentList += i->first;
+ fragmentList += "'";
+ }
+
+ if(fragmentList.size())
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Some XML patch fragments did not have matching IDs: " <<
+ fragmentList << std::endl);
+ return false;
+ }
+
+ return true;
+}
+
+bool cmCPackWIXGenerator::CreateCMakePackageRegistryEntry(
+ cmWIXSourceWriter& featureDefinitions)
+{
+ const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
+ if(!package)
+ {
+ return true;
+ }
+
+ featureDefinitions.BeginElement("Component");
+ featureDefinitions.AddAttribute("Id", "CM_PACKAGE_REGISTRY");
+ featureDefinitions.AddAttribute("Directory", "TARGETDIR");
+ featureDefinitions.AddAttribute("Guid", "*");
+
+ std::string registryKey =
+ std::string("Software\\Kitware\\CMake\\Packages\\") + package;
+
+ std::string upgradeGuid = GetOption("CPACK_WIX_UPGRADE_GUID");
+
+ featureDefinitions.BeginElement("RegistryValue");
+ featureDefinitions.AddAttribute("Root", "HKLM");
+ featureDefinitions.AddAttribute("Key", registryKey);
+ featureDefinitions.AddAttribute("Name", upgradeGuid);
+ featureDefinitions.AddAttribute("Type", "string");
+ featureDefinitions.AddAttribute("Value", "[INSTALL_ROOT]");
+ featureDefinitions.AddAttribute("KeyPath", "yes");
+ featureDefinitions.EndElement("RegistryValue");
+
+ featureDefinitions.EndElement("Component");
return true;
}
@@ -737,7 +810,7 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
fileDefinitions.EndElement("RemoveFolder");
std::string registryKey =
- std::string("Software/") + cpackVendor + "/" + cpackPackageName;
+ std::string("Software\\") + cpackVendor + "\\" + cpackPackageName;
fileDefinitions.BeginElement("RegistryValue");
fileDefinitions.AddAttribute("Root", "HKCU");
@@ -807,7 +880,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
{
cmWIXRichTextFormatWriter rtfWriter(licenseDestinationFilename);
- std::ifstream licenseSource(licenseSourceFilename.c_str());
+ cmsys::ifstream licenseSource(licenseSourceFilename.c_str());
std::string line;
while(std::getline(licenseSource, line))
@@ -872,6 +945,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
packageExecutables,
shortcutMap);
+ ApplyPatchFragment(subDirectoryId, directoryDefinitions);
directoryDefinitions.EndElement("Directory");
}
else
@@ -891,7 +965,18 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
fileDefinitions.AddAttribute("Source", fullPath);
fileDefinitions.AddAttribute("KeyPath", "yes");
+ mode_t fileMode = 0;
+ cmSystemTools::GetPermissions(fullPath.c_str(), fileMode);
+
+ if(!(fileMode & S_IWRITE))
+ {
+ fileDefinitions.AddAttribute("ReadOnly", "yes");
+ }
+
+ ApplyPatchFragment(fileId, fileDefinitions);
fileDefinitions.EndElement("File");
+
+ ApplyPatchFragment(componentId, fileDefinitions);
fileDefinitions.EndElement("Component");
fileDefinitions.EndElement("DirectoryRef");
@@ -986,8 +1071,8 @@ std::string cmCPackWIXGenerator::GetRightmostExtension(
std::string cmCPackWIXGenerator::PathToId(const std::string& path)
{
- id_map_t::const_iterator i = pathToIdMap.find(path);
- if(i != pathToIdMap.end()) return i->second;
+ id_map_t::const_iterator i = PathToIdMap.find(path);
+ if(i != PathToIdMap.end()) return i->second;
std::string id = CreateNewIdForPath(path);
return id;
@@ -1024,7 +1109,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(const std::string& path)
std::stringstream result;
result << idPrefix << "_" << identifier;
- size_t ambiguityCount = ++idAmbiguityCounter[identifier];
+ size_t ambiguityCount = ++IdAmbiguityCounter[identifier];
if(ambiguityCount > 999)
{
@@ -1041,7 +1126,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(const std::string& path)
std::string resultString = result.str();
- pathToIdMap[path] = resultString;
+ PathToIdMap[path] = resultString;
return resultString;
}
@@ -1146,3 +1231,45 @@ void cmCPackWIXGenerator::CreateStartMenuFolder(
directoryDefinitions.EndElement("Directory");
}
+
+void cmCPackWIXGenerator::LoadPatchFragments(const std::string& patchFilePath)
+{
+ cmWIXPatchParser parser(Fragments, Logger);
+ parser.ParseFile(patchFilePath.c_str());
+}
+
+void cmCPackWIXGenerator::ApplyPatchFragment(
+ const std::string& id, cmWIXSourceWriter& writer)
+{
+ cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id);
+ if(i == Fragments.end()) return;
+
+ const cmWIXPatchElement& fragment = i->second;
+ for(cmWIXPatchElement::child_list_t::const_iterator
+ j = fragment.children.begin(); j != fragment.children.end(); ++j)
+ {
+ ApplyPatchElement(**j, writer);
+ }
+
+ Fragments.erase(i);
+}
+
+void cmCPackWIXGenerator::ApplyPatchElement(
+ const cmWIXPatchElement& element, cmWIXSourceWriter& writer)
+{
+ writer.BeginElement(element.name);
+
+ for(cmWIXPatchElement::attributes_t::const_iterator
+ i = element.attributes.begin(); i != element.attributes.end(); ++i)
+ {
+ writer.AddAttribute(i->first, i->second);
+ }
+
+ for(cmWIXPatchElement::child_list_t::const_iterator
+ i = element.children.begin(); i != element.children.end(); ++i)
+ {
+ ApplyPatchElement(**i, writer);
+ }
+
+ writer.EndElement(element.name);
+}
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 84f68b6..1f4facf 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -13,6 +13,8 @@
#ifndef cmCPackWIXGenerator_h
#define cmCPackWIXGenerator_h
+#include "cmWIXPatchParser.h"
+
#include <CPack/cmCPackGenerator.h>
#include <string>
@@ -79,6 +81,9 @@ private:
bool CreateWiXSourceFiles();
+ bool CreateCMakePackageRegistryEntry(
+ cmWIXSourceWriter& featureDefinitions);
+
bool CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions);
@@ -160,12 +165,21 @@ private:
void CreateStartMenuFolder(cmWIXSourceWriter& directoryDefinitions);
- std::vector<std::string> wixSources;
- id_map_t pathToIdMap;
- ambiguity_map_t idAmbiguityCounter;
+ void LoadPatchFragments(const std::string& patchFilePath);
+
+ void ApplyPatchFragment(const std::string& id, cmWIXSourceWriter& writer);
+
+ void ApplyPatchElement(const cmWIXPatchElement& element,
+ cmWIXSourceWriter& writer);
+
+ std::vector<std::string> WixSources;
+ id_map_t PathToIdMap;
+ ambiguity_map_t IdAmbiguityCounter;
+
+ extension_set_t CandleExtensions;
+ extension_set_t LightExtensions;
- extension_set_t candleExtensions;
- extension_set_t lightExtensions;
+ cmWIXPatchParser::fragment_map_t Fragments;
};
#endif
diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx
new file mode 100644
index 0000000..7ceaf1f
--- /dev/null
+++ b/Source/CPack/WiX/cmWIXPatchParser.cxx
@@ -0,0 +1,145 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmWIXPatchParser.h"
+
+#include <CPack/cmCPackGenerator.h>
+
+#include <cm_expat.h>
+
+cmWIXPatchElement::~cmWIXPatchElement()
+{
+ for(child_list_t::iterator i = children.begin(); i != children.end(); ++i)
+ {
+ delete *i;
+ }
+}
+
+cmWIXPatchParser::cmWIXPatchParser(
+ fragment_map_t& fragments, cmCPackLog* logger):
+ Logger(logger),
+ State(BEGIN_DOCUMENT),
+ Valid(true),
+ Fragments(fragments)
+{
+
+}
+
+void cmWIXPatchParser::StartElement(const char *name, const char **atts)
+{
+ std::string name_str = name;
+ if(State == BEGIN_DOCUMENT)
+ {
+ if(name_str == "CPackWiXPatch")
+ {
+ State = BEGIN_FRAGMENTS;
+ }
+ else
+ {
+ ReportValidationError("Expected root element 'CPackWiXPatch'");
+ }
+ }
+ else if(State == BEGIN_FRAGMENTS)
+ {
+ if(name_str == "CPackWiXFragment")
+ {
+ State = INSIDE_FRAGMENT;
+ StartFragment(atts);
+ }
+ else
+ {
+ ReportValidationError("Expected 'CPackWixFragment' element");
+ }
+ }
+ else if(State == INSIDE_FRAGMENT)
+ {
+ cmWIXPatchElement &parent = *ElementStack.back();
+
+ parent.children.resize(parent.children.size() + 1);
+ cmWIXPatchElement*& currentElement = parent.children.back();
+ currentElement = new cmWIXPatchElement;
+ currentElement->name = name;
+
+ for(size_t i = 0; atts[i]; i += 2)
+ {
+ std::string key = atts[i];
+ std::string value = atts[i+1];
+
+ currentElement->attributes[key] = value;
+ }
+
+ ElementStack.push_back(currentElement);
+ }
+}
+
+void cmWIXPatchParser::StartFragment(const char **attributes)
+{
+ for(size_t i = 0; attributes[i]; i += 2)
+ {
+ std::string key = attributes[i];
+ std::string value = attributes[i+1];
+
+ if(key == "Id")
+ {
+ if(Fragments.find(value) != Fragments.end())
+ {
+ std::stringstream tmp;
+ tmp << "Invalid reuse of 'CPackWixFragment' 'Id': " << value;
+ ReportValidationError(tmp.str());
+ }
+
+ ElementStack.push_back(&Fragments[value]);
+ }
+ else
+ {
+ ReportValidationError(
+ "The only allowed 'CPackWixFragment' attribute is 'Id'");
+ }
+ }
+}
+
+void cmWIXPatchParser::EndElement(const char *name)
+{
+ std::string name_str = name;
+ if(State == INSIDE_FRAGMENT)
+ {
+ if(name_str == "CPackWiXFragment")
+ {
+ State = BEGIN_FRAGMENTS;
+ ElementStack.clear();
+ }
+ else
+ {
+ ElementStack.pop_back();
+ }
+ }
+}
+
+void cmWIXPatchParser::ReportError(int line, int column, const char* msg)
+{
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error while processing XML patch file at " << line << ":" << column <<
+ ": "<< msg << std::endl);
+ Valid = false;
+}
+
+void cmWIXPatchParser::ReportValidationError(const std::string& message)
+{
+ ReportError(XML_GetCurrentLineNumber(Parser),
+ XML_GetCurrentColumnNumber(Parser),
+ message.c_str());
+}
+
+bool cmWIXPatchParser::IsValid() const
+{
+ return Valid;
+}
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
new file mode 100644
index 0000000..91b3b66
--- /dev/null
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -0,0 +1,75 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackWIXPatchParser_h
+#define cmCPackWIXPatchParser_h
+
+#include <cmXMLParser.h>
+
+#include <CPack/cmCPackLog.h>
+
+#include <map>
+#include <list>
+
+struct cmWIXPatchElement
+{
+ ~cmWIXPatchElement();
+
+ typedef std::list<cmWIXPatchElement*> child_list_t;
+ typedef std::map<std::string, std::string> attributes_t;
+
+ std::string name;
+ child_list_t children;
+ attributes_t attributes;
+};
+
+/** \class cmWIXPatchParser
+ * \brief Helper class that parses XML patch files (CPACK_WIX_PATCH_FILE)
+ */
+class cmWIXPatchParser : public cmXMLParser
+{
+public:
+ typedef std::map<std::string, cmWIXPatchElement> fragment_map_t;
+
+ cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
+
+private:
+ virtual void StartElement(const char *name, const char **atts);
+
+ void StartFragment(const char **attributes);
+
+ virtual void EndElement(const char *name);
+ virtual void ReportError(int line, int column, const char* msg);
+
+ void ReportValidationError(const std::string& message);
+
+ bool IsValid() const;
+
+ cmCPackLog* Logger;
+
+ enum ParserState
+ {
+ BEGIN_DOCUMENT,
+ BEGIN_FRAGMENTS,
+ INSIDE_FRAGMENT
+ };
+
+ ParserState State;
+
+ bool Valid;
+
+ fragment_map_t& Fragments;
+
+ std::list<cmWIXPatchElement*> ElementStack;
+};
+
+#endif
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
index 774c22c..ddc1d71 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
@@ -16,7 +16,7 @@
cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter(
const std::string& filename):
- file(filename.c_str(), std::ios::binary)
+ File(filename.c_str(), std::ios::binary)
{
StartGroup();
WriteHeader();
@@ -29,8 +29,8 @@ cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter()
/* I haven't seen this in the RTF spec but
* wordpad terminates its RTF like this */
- file << "\r\n";
- file.put(0);
+ File << "\r\n";
+ File.put(0);
}
void cmWIXRichTextFormatWriter::AddText(const std::string& text)
@@ -44,16 +44,16 @@ void cmWIXRichTextFormatWriter::AddText(const std::string& text)
switch(c)
{
case '\\':
- file << "\\\\";
+ File << "\\\\";
break;
case '{':
- file << "\\{";
+ File << "\\{";
break;
case '}':
- file << "\\}";
+ File << "\\}";
break;
case '\n':
- file << "\\par\r\n";
+ File << "\\par\r\n";
break;
case '\r':
continue;
@@ -61,11 +61,45 @@ void cmWIXRichTextFormatWriter::AddText(const std::string& text)
{
if(c <= 0x7F)
{
- file << c;
+ File << c;
}
else
{
- file << "[NON-ASCII-" << int(c) << "]";
+ if(c <= 0xC0)
+ {
+ EmitInvalidCodepoint(c);
+ }
+ else if(c < 0xE0 && i+1 < text.size())
+ {
+ EmitUnicodeCodepoint(
+ (text[i+1] & 0x3F) |
+ ((c & 0x1F) << 6)
+ );
+ i+= 1;
+ }
+ else if(c < 0xF0 && i+2 < text.size())
+ {
+ EmitUnicodeCodepoint(
+ (text[i+2] & 0x3F) |
+ ((text[i+1] & 0x3F) << 6) |
+ ((c & 0xF) << 12)
+ );
+ i += 2;
+ }
+ else if(c < 0xF8 && i+3 < text.size())
+ {
+ EmitUnicodeCodepoint(
+ (text[i+3] & 0x3F) |
+ ((text[i+2] & 0x3F) << 6) |
+ ((text[i+1] & 0x3F) << 12) |
+ ((c & 0x7) << 18)
+ );
+ i += 3;
+ }
+ else
+ {
+ EmitInvalidCodepoint(c);
+ }
}
}
break;
@@ -82,6 +116,7 @@ void cmWIXRichTextFormatWriter::WriteHeader()
ControlWord("deflang1031");
WriteFontTable();
+ WriteColorTable();
WriteGenerator();
}
@@ -99,11 +134,27 @@ void cmWIXRichTextFormatWriter::WriteFontTable()
EndGroup();
}
+void cmWIXRichTextFormatWriter::WriteColorTable()
+{
+ StartGroup();
+ ControlWord("colortbl ;");
+ ControlWord("red255");
+ ControlWord("green0");
+ ControlWord("blue0;");
+ ControlWord("red0");
+ ControlWord("green255");
+ ControlWord("blue0;");
+ ControlWord("red0");
+ ControlWord("green0");
+ ControlWord("blue255;");
+ EndGroup();
+}
+
void cmWIXRichTextFormatWriter::WriteGenerator()
{
StartGroup();
NewControlWord("generator");
- file << " CPack WiX Generator (" << cmVersion::GetCMakeVersion() << ");";
+ File << " CPack WiX Generator (" << cmVersion::GetCMakeVersion() << ");";
EndGroup();
}
@@ -118,20 +169,60 @@ void cmWIXRichTextFormatWriter::WriteDocumentPrefix()
void cmWIXRichTextFormatWriter::ControlWord(const std::string& keyword)
{
- file << "\\" << keyword;
+ File << "\\" << keyword;
}
void cmWIXRichTextFormatWriter::NewControlWord(const std::string& keyword)
{
- file << "\\*\\" << keyword;
+ File << "\\*\\" << keyword;
}
void cmWIXRichTextFormatWriter::StartGroup()
{
- file.put('{');
+ File.put('{');
}
void cmWIXRichTextFormatWriter::EndGroup()
{
- file.put('}');
+ File.put('}');
+}
+
+void cmWIXRichTextFormatWriter::EmitUnicodeCodepoint(int c)
+{
+ // Do not emit byte order mark (BOM)
+ if(c == 0xFEFF)
+ {
+ return;
+ }
+ else if(c <= 0xFFFF)
+ {
+ EmitUnicodeSurrogate(c);
+ }
+ else
+ {
+ c -= 0x10000;
+ EmitUnicodeSurrogate(((c >> 10) & 0x3FF) + 0xD800);
+ EmitUnicodeSurrogate((c & 0x3FF) + 0xDC00);
+ }
+}
+
+void cmWIXRichTextFormatWriter::EmitUnicodeSurrogate(int c)
+{
+ ControlWord("u");
+ if(c <= 32767)
+ {
+ File << c;
+ }
+ else
+ {
+ File << (c - 65536);
+ }
+ File << "?";
+}
+
+void cmWIXRichTextFormatWriter::EmitInvalidCodepoint(int c)
+{
+ ControlWord("cf1 ");
+ File << "[INVALID-BYTE-" << int(c) << "]";
+ ControlWord("cf0 ");
}
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index 10b67c3..2b665d47 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -13,7 +13,7 @@
#ifndef cmWIXRichTextFormatWriter_h
#define cmWIXRichTextFormatWriter_h
-#include <fstream>
+#include <cmsys/FStream.hxx>
/** \class cmWIXRichtTextFormatWriter
* \brief Helper class to generate Rich Text Format (RTF) documents
@@ -30,6 +30,7 @@ public:
private:
void WriteHeader();
void WriteFontTable();
+ void WriteColorTable();
void WriteGenerator();
void WriteDocumentPrefix();
@@ -40,7 +41,12 @@ private:
void StartGroup();
void EndGroup();
- std::ofstream file;
+ void EmitUnicodeCodepoint(int c);
+ void EmitUnicodeSurrogate(int c);
+
+ void EmitInvalidCodepoint(int c);
+
+ cmsys::ofstream File;
};
#endif
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index c8a3922..e83c226 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -20,9 +20,9 @@ cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
const std::string& filename,
bool isIncludeFile):
Logger(logger),
- file(filename.c_str()),
- state(DEFAULT),
- sourceFilename(filename)
+ File(filename.c_str()),
+ State(DEFAULT),
+ SourceFilename(filename)
{
WriteXMLDeclaration();
@@ -40,79 +40,79 @@ cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
cmWIXSourceWriter::~cmWIXSourceWriter()
{
- if(elements.size() > 1)
+ if(Elements.size() > 1)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
- elements.size() - 1 << " WiX elements were still open when closing '" <<
- sourceFilename << "'" << std::endl);
+ Elements.size() - 1 << " WiX elements were still open when closing '" <<
+ SourceFilename << "'" << std::endl);
return;
}
- EndElement(elements.back());
+ EndElement(Elements.back());
}
void cmWIXSourceWriter::BeginElement(const std::string& name)
{
- if(state == BEGIN)
+ if(State == BEGIN)
{
- file << ">";
+ File << ">";
}
- file << "\n";
- Indent(elements.size());
- file << "<" << name;
+ File << "\n";
+ Indent(Elements.size());
+ File << "<" << name;
- elements.push_back(name);
- state = BEGIN;
+ Elements.push_back(name);
+ State = BEGIN;
}
void cmWIXSourceWriter::EndElement(std::string const& name)
{
- if(elements.empty())
+ if(Elements.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"can not end WiX element with no open elements in '" <<
- sourceFilename << "'" << std::endl);
+ SourceFilename << "'" << std::endl);
return;
}
- if(elements.back() != name)
+ if(Elements.back() != name)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "WiX element <" << elements.back() <<
+ "WiX element <" << Elements.back() <<
"> can not be closed by </" << name << "> in '" <<
- sourceFilename << "'" << std::endl);
+ SourceFilename << "'" << std::endl);
return;
}
- if(state == DEFAULT)
+ if(State == DEFAULT)
{
- file << "\n";
- Indent(elements.size()-1);
- file << "</" << elements.back() << ">";
+ File << "\n";
+ Indent(Elements.size()-1);
+ File << "</" << Elements.back() << ">";
}
else
{
- file << "/>";
+ File << "/>";
}
- elements.pop_back();
- state = DEFAULT;
+ Elements.pop_back();
+ State = DEFAULT;
}
void cmWIXSourceWriter::AddProcessingInstruction(
const std::string& target, const std::string& content)
{
- if(state == BEGIN)
+ if(State == BEGIN)
{
- file << ">";
+ File << ">";
}
- file << "\n";
- Indent(elements.size());
- file << "<?" << target << " " << content << "?>";
+ File << "\n";
+ Indent(Elements.size());
+ File << "<?" << target << " " << content << "?>";
- state = DEFAULT;
+ State = DEFAULT;
}
void cmWIXSourceWriter::AddAttribute(
@@ -120,7 +120,7 @@ void cmWIXSourceWriter::AddAttribute(
{
std::string utf8 = WindowsCodepageToUtf8(value);
- file << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"';
+ File << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"';
}
void cmWIXSourceWriter::AddAttributeUnlessEmpty(
@@ -172,14 +172,14 @@ std::string cmWIXSourceWriter::WindowsCodepageToUtf8(const std::string& value)
void cmWIXSourceWriter::WriteXMLDeclaration()
{
- file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+ File << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
}
void cmWIXSourceWriter::Indent(size_t count)
{
for(size_t i = 0; i < count; ++i)
{
- file << " ";
+ File << " ";
}
}
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 670d4c0..894ad78 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -15,7 +15,7 @@
#include <vector>
#include <string>
-#include <fstream>
+#include <cmsys/FStream.hxx>
#include <CPack/cmCPackLog.h>
@@ -60,13 +60,13 @@ private:
cmCPackLog* Logger;
- std::ofstream file;
+ cmsys::ofstream File;
- State state;
+ State State;
- std::vector<std::string> elements;
+ std::vector<std::string> Elements;
- std::string sourceFilename;
+ std::string SourceFilename;
};
#endif
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 4494e8a..0162d55 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -803,7 +803,7 @@ static int put_arobj(CF *cfp, struct stat *sb)
static int ar_append(const char* archive,const std::vector<std::string>& files)
{
int eval = 0;
- FILE* aFile = fopen(archive, "wb+");
+ FILE* aFile = cmSystemTools::Fopen(archive, "wb+");
if (aFile!=NULL) {
fwrite(ARMAG, SARMAG, 1, aFile);
if (fseek(aFile, 0, SEEK_END) != -1) {
@@ -814,7 +814,7 @@ static int ar_append(const char* archive,const std::vector<std::string>& files)
for(std::vector<std::string>::const_iterator fileIt = files.begin();
fileIt!=files.end(); ++fileIt) {
const char* filename = fileIt->c_str();
- FILE* file = fopen(filename, "rb");
+ FILE* file = cmSystemTools::Fopen(filename, "rb");
if (file == NULL) {
eval = -1;
continue;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index dfb2f15..9f0a77e 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmGeneratedFileStream.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
static const char* SLAHeader =
"data 'LPic' (5000) {\n"
@@ -422,7 +423,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
sla_r += "/sla.r";
- std::ifstream ifs;
+ cmsys::ifstream ifs;
ifs.open(cpack_license_file.c_str());
if(ifs.is_open())
{
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index cd2fcc7..96491aa 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -23,6 +23,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
#include <algorithm>
#if defined(__HAIKU__)
@@ -152,7 +153,7 @@ int cmCPackGenerator::PrepareNames()
<< descFileName << "]" << std::endl);
return 0;
}
- std::ifstream ifs(descFileName);
+ cmsys::ifstream ifs(descFileName);
if ( !ifs )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index c617a3e..c5b9c6f 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -22,6 +22,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------
cmCPackPackageMakerGenerator::cmCPackPackageMakerGenerator()
@@ -467,7 +468,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
return 0;
}
- std::ifstream ifs(versionFile.c_str());
+ cmsys::ifstream ifs(versionFile.c_str());
if ( !ifs )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -716,7 +717,7 @@ GenerateComponentPackage(const char *packageFile,
// X packages, which work on Mac OS X 10.3 and newer.
std::string descriptionFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
descriptionFile += '/' + component.Name + "-Description.plist";
- std::ofstream out(descriptionFile.c_str());
+ cmsys::ofstream out(descriptionFile.c_str());
out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl
<< "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
<< "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" << std::endl
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 9b6cf14..8342fee 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -20,6 +20,7 @@
#include "cmCPackLog.h"
#include <cmsys/ios/sstream>
+#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <sys/stat.h>
@@ -91,7 +92,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
std::string line;
- std::ifstream ilfs(inLicFile.c_str());
+ cmsys::ifstream ilfs(inLicFile.c_str());
std::string licenseText;
while ( cmSystemTools::GetLineFromStream(ilfs, line) )
{
@@ -104,7 +105,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
// Create the header
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
- std::ifstream ifs(inFile.c_str());
+ cmsys::ifstream ifs(inFile.c_str());
std::string packageHeaderText;
while ( cmSystemTools::GetLineFromStream(ifs, line) )
{
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 438b16d..a19b778 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -25,6 +25,7 @@
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -97,8 +98,13 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
//----------------------------------------------------------------------------
// this is CPack.
-int main (int argc, char *argv[])
+int main (int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = args.argc();
+ argv = args.argv();
+
cmSystemTools::FindCMakeResources(argv[0]);
cmCPackLog log;
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index e480fff..c5deb96 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -24,6 +24,7 @@
//#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
// used for sleep
#ifdef _WIN32
@@ -751,7 +752,7 @@ void cmCTestBuildHandler::GenerateXMLFooter(std::ostream& os,
void cmCTestBuildHandler::GenerateXMLLaunchedFragment(std::ostream& os,
const char* fname)
{
- std::ifstream fin(fname, std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname, std::ios::in | std::ios::binary);
std::string line;
while(cmSystemTools::GetLineFromStream(fin, line))
{
@@ -885,7 +886,7 @@ cmCTestBuildHandler::LaunchHelper
//----------------------------------------------------------------------
int cmCTestBuildHandler::RunMakeCommand(const char* command,
- int* retVal, const char* dir, int timeout, std::ofstream& ofs)
+ int* retVal, const char* dir, int timeout, std::ostream& ofs)
{
// First generate the command and arguments
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -1049,7 +1050,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
//----------------------------------------------------------------------
void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
- size_t& tick, size_t tick_len, std::ofstream& ofs,
+ size_t& tick, size_t tick_len, std::ostream& ofs,
t_BuildProcessingQueueType* queue)
{
const std::string::size_type tick_line_len = 50;
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 439efd6..ff7cfd6 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -54,7 +54,7 @@ private:
// and retVal is return value or exception.
int RunMakeCommand(const char* command,
int* retVal, const char* dir, int timeout,
- std::ofstream& ofs);
+ std::ostream& ofs);
enum {
b_REGULAR_LINE,
@@ -113,7 +113,7 @@ private:
typedef std::deque<char> t_BuildProcessingQueueType;
void ProcessBuffer(const char* data, int length, size_t& tick,
- size_t tick_len, std::ofstream& ofs, t_BuildProcessingQueueType* queue);
+ size_t tick_len, std::ostream& ofs, t_BuildProcessingQueueType* queue);
int ProcessSingleLine(const char* data);
t_BuildProcessingQueueType BuildProcessingQueue;
diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx
index 7269507..17dbb55 100644
--- a/Source/CTest/cmCTestCVS.cxx
+++ b/Source/CTest/cmCTestCVS.cxx
@@ -16,6 +16,7 @@
#include "cmXMLSafe.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log): cmCTestVC(ct, log)
@@ -231,7 +232,7 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir)
// Lookup the branch in the tag file, if any.
std::string tagLine;
- std::ifstream tagStream(tagFile.c_str());
+ cmsys::ifstream tagStream(tagFile.c_str());
if(tagStream && cmSystemTools::GetLineFromStream(tagStream, tagLine) &&
tagLine.size() > 1 && tagLine[0] == 'T')
{
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 33b084e..3c65c55 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -26,6 +26,7 @@
#include <cmsys/Glob.hxx>
#include <cmsys/stl/iterator>
#include <cmsys/stl/algorithm>
+#include <cmsys/FStream.hxx>
#include <stdlib.h>
#include <math.h>
@@ -511,7 +512,7 @@ int cmCTestCoverageHandler::ProcessHandler()
<< "\" FullPath=\"" << cmXMLSafe(shortFileName) << "\">\n"
<< "\t\t<Report>" << std::endl;
- std::ifstream ifs(fullFileName.c_str());
+ cmsys::ifstream ifs(fullFileName.c_str());
if ( !ifs)
{
cmOStringStream ostr;
@@ -600,7 +601,7 @@ int cmCTestCoverageHandler::ProcessHandler()
<< "\" FullPath=\"" << cmXMLSafe(*i) << "\">\n"
<< "\t\t<Report>" << std::endl;
- std::ifstream ifs(fullPath.c_str());
+ cmsys::ifstream ifs(fullPath.c_str());
if (!ifs)
{
cmOStringStream ostr;
@@ -1158,7 +1159,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: "
<< gcovFile << std::endl);
- std::ifstream ifile(gcovFile.c_str());
+ cmsys::ifstream ifile(gcovFile.c_str());
if ( ! ifile )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: "
@@ -1370,7 +1371,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
= &cont->TotalCoverage[actualSourceFile];
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" in file: " << fileIt->c_str() << std::endl);
- std::ifstream ifile(fileIt->c_str());
+ cmsys::ifstream ifile(fileIt->c_str());
if ( ! ifile )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: "
@@ -1530,7 +1531,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
"covbr output in " << outputFile
<< std::endl);
// open the output file
- std::ifstream fin(outputFile.c_str());
+ cmsys::ifstream fin(outputFile.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -1743,7 +1744,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
std::vector<std::string> coveredFiles;
std::vector<std::string> coveredFilesFullPath;
// Read and parse the summary output file
- std::ifstream fin(outputFile.c_str());
+ cmsys::ifstream fin(outputFile.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -2012,7 +2013,7 @@ void cmCTestCoverageHandler::LoadLabels()
fileList += "/TargetDirectories.txt";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" target directory list [" << fileList << "]\n");
- std::ifstream finList(fileList.c_str());
+ cmsys::ifstream finList(fileList.c_str());
std::string line;
while(cmSystemTools::GetLineFromStream(finList, line))
{
@@ -2026,7 +2027,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
LabelSet& dirLabels = this->TargetDirs[dir];
std::string fname = dir;
fname += "/Labels.txt";
- std::ifstream fin(fname.c_str());
+ cmsys::ifstream fin(fname.c_str());
if(!fin)
{
return;
@@ -2080,7 +2081,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
}
//----------------------------------------------------------------------
-void cmCTestCoverageHandler::WriteXMLLabels(std::ofstream& os,
+void cmCTestCoverageHandler::WriteXMLLabels(std::ostream& os,
std::string const& source)
{
LabelMapType::const_iterator li = this->SourceLabels.find(source);
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 3506928..660f501 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -132,7 +132,7 @@ private:
// Label reading and writing methods.
void LoadLabels();
void LoadLabels(const char* dir);
- void WriteXMLLabels(std::ofstream& os, std::string const& source);
+ void WriteXMLLabels(std::ostream& os, std::string const& source);
// Label-based filtering.
std::set<int> LabelFilter;
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 725f613..0e0e797 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -18,6 +18,7 @@
#include <cmsys/RegularExpression.hxx>
#include <cmsys/ios/sstream>
#include <cmsys/Process.h>
+#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <time.h>
@@ -200,7 +201,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
std::string sha1;
{
std::string fetch_head = this->FindGitDir() + "/FETCH_HEAD";
- std::ifstream fin(fetch_head.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fetch_head.c_str(), std::ios::in | std::ios::binary);
if(!fin)
{
this->Log << "Unable to open " << fetch_head << "\n";
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 8e5fd78..7d9c034 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -19,6 +19,7 @@
#include <cmsys/MD5.h>
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv)
@@ -171,7 +172,7 @@ void cmCTestLaunch::HandleRealArg(const char* arg)
// Expand response file arguments.
if(arg[0] == '@' && cmSystemTools::FileExists(arg+1))
{
- std::ifstream fin(arg+1);
+ cmsys::ifstream fin(arg+1);
std::string line;
while(cmSystemTools::GetLineFromStream(fin, line))
{
@@ -241,8 +242,8 @@ void cmCTestLaunch::RunChild()
cmsysProcess* cp = this->Process;
cmsysProcess_SetCommand(cp, this->RealArgV);
- std::ofstream fout;
- std::ofstream ferr;
+ cmsys::ofstream fout;
+ cmsys::ofstream ferr;
if(this->Passthru)
{
// In passthru mode we just share the output pipes.
@@ -330,7 +331,7 @@ void cmCTestLaunch::LoadLabels()
cmSystemTools::ConvertToUnixSlashes(source);
// Load the labels file.
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
if(!fin) { return; }
bool inTarget = true;
bool inSource = false;
@@ -579,7 +580,7 @@ void cmCTestLaunch::WriteXMLLabels(std::ostream& fxml)
void cmCTestLaunch::DumpFileToXML(std::ostream& fxml,
std::string const& fname)
{
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
const char* sep = "";
@@ -652,7 +653,7 @@ cmCTestLaunch
fname += "Custom";
fname += purpose;
fname += ".txt";
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
cmsys::RegularExpression rex;
while(cmSystemTools::GetLineFromStream(fin, line))
@@ -671,7 +672,7 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname)
// Look for log file lines matching warning expressions but not
// suppression expressions.
- std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary);
std::string line;
while(cmSystemTools::GetLineFromStream(fin, line))
{
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 3ae2ac6..fdce04d 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -18,6 +18,7 @@
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Base64.h>
+#include <cmsys/FStream.hxx>
#include "cmMakefile.h"
#include "cmXMLSafe.h"
@@ -929,7 +930,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res,
}
// put a scope around this to close ifs so the file can be removed
{
- std::ifstream ifs(ofile.c_str());
+ cmsys::ifstream ifs(ofile.c_str());
if ( !ifs )
{
std::string log = "Cannot read memory tester output file: " + ofile;
@@ -984,7 +985,7 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res,
{
return;
}
- std::ifstream ifs(ofile.c_str());
+ cmsys::ifstream ifs(ofile.c_str());
if ( !ifs )
{
std::string log = "Cannot read memory tester output file: " + ofile;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 4c39d10..ddd1707 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <stack>
#include <float.h>
+#include <cmsys/FStream.hxx>
class TestComparator
{
@@ -139,6 +140,13 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
}
else
{
+
+ for(TestMap::iterator j = this->Tests.begin();
+ j != this->Tests.end(); ++j)
+ {
+ j->second.erase(test);
+ }
+
this->UnlockResources(test);
this->Completed++;
this->TestFinishMap[test] = true;
@@ -318,7 +326,7 @@ void cmCTestMultiProcessHandler::UpdateCostData()
if(cmSystemTools::FileExists(fname.c_str()))
{
- std::ifstream fin;
+ cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
@@ -377,7 +385,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
if(cmSystemTools::FileExists(fname.c_str(), true))
{
- std::ifstream fin;
+ cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
while(std::getline(fin, line))
@@ -441,6 +449,19 @@ int cmCTestMultiProcessHandler::SearchByName(std::string name)
//---------------------------------------------------------
void cmCTestMultiProcessHandler::CreateTestCostList()
{
+ if(this->ParallelLevel > 1)
+ {
+ CreateParallelTestCostList();
+ }
+ else
+ {
+ CreateSerialTestCostList();
+ }
+}
+
+//---------------------------------------------------------
+void cmCTestMultiProcessHandler::CreateParallelTestCostList()
+{
TestSet alreadySortedTests;
std::list<TestSet> priorityStack;
@@ -452,8 +473,7 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
for(TestMap::const_iterator i = this->Tests.begin();
i != this->Tests.end(); ++i)
{
- if(this->ParallelLevel > 1 &&
- std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(),
+ if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(),
this->Properties[i->first]->Name) != this->LastTestsFailed.end())
{
//If the test failed last time, it should be run first.
@@ -466,8 +486,9 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
}
}
- // Repeatedly move dependencies of the tests on the current dependency level
- // to the next level until no further dependencies exist.
+ // In parallel test runs repeatedly move dependencies of the tests on
+ // the current dependency level to the next level until no
+ // further dependencies exist.
while(priorityStack.back().size())
{
TestSet &previousSet = priorityStack.back();
@@ -526,6 +547,65 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
}
//---------------------------------------------------------
+void cmCTestMultiProcessHandler::GetAllTestDependencies(
+ int test, TestList& dependencies)
+{
+ TestSet const& dependencySet = this->Tests[test];
+ for(TestSet::const_iterator i = dependencySet.begin();
+ i != dependencySet.end(); ++i)
+ {
+ GetAllTestDependencies(*i, dependencies);
+ dependencies.push_back(*i);
+ }
+}
+
+//---------------------------------------------------------
+void cmCTestMultiProcessHandler::CreateSerialTestCostList()
+{
+ TestList presortedList;
+
+ for(TestMap::iterator i = this->Tests.begin();
+ i != this->Tests.end(); ++i)
+ {
+ presortedList.push_back(i->first);
+ }
+
+ TestComparator comp(this);
+ std::stable_sort(presortedList.begin(), presortedList.end(), comp);
+
+ TestSet alreadySortedTests;
+
+ for(TestList::const_iterator i = presortedList.begin();
+ i != presortedList.end(); ++i)
+ {
+ int test = *i;
+
+ if(alreadySortedTests.find(test) != alreadySortedTests.end())
+ {
+ continue;
+ }
+
+ TestList dependencies;
+ GetAllTestDependencies(test, dependencies);
+
+ for(TestList::const_iterator j = dependencies.begin();
+ j != dependencies.end(); ++j)
+ {
+ int testDependency = *j;
+
+ if(alreadySortedTests.find(testDependency) == alreadySortedTests.end())
+ {
+ alreadySortedTests.insert(testDependency);
+ this->SortedTests.push_back(testDependency);
+ }
+ }
+
+ alreadySortedTests.insert(test);
+ this->SortedTests.push_back(test);
+ }
+}
+
+//---------------------------------------------------------
void cmCTestMultiProcessHandler::WriteCheckpoint(int index)
{
std::string fname = this->CTest->GetBinaryDir()
@@ -642,7 +722,7 @@ void cmCTestMultiProcessHandler::CheckResume()
<< "----------------------------------------------------------"
<< std::endl;
- std::ifstream fin;
+ cmsys::ifstream fin;
fin.open(fname.c_str());
std::string line;
while(std::getline(fin, line))
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 439a8f3..1b53ec7 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -72,6 +72,12 @@ protected:
int SearchByName(std::string name);
void CreateTestCostList();
+
+ void GetAllTestDependencies(int test, TestList& dependencies);
+ void CreateSerialTestCostList();
+
+ void CreateParallelTestCostList();
+
// Removes the checkpoint file
void MarkFinished();
void EraseTest(int index);
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 941d348..139f515 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -235,7 +235,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
return false;
}
- ftpfile = ::fopen(local_file.c_str(), "rb");
+ ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
*this->LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< upload_as.c_str() << std::endl;
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
@@ -476,7 +476,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
return false;
}
- ftpfile = ::fopen(local_file.c_str(), "rb");
+ ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
<< local_file.c_str() << " to "
<< upload_as.c_str() << " Size: " << st.st_size << std::endl);
@@ -566,7 +566,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
<< count << std::endl);
::fclose(ftpfile);
- ftpfile = ::fopen(local_file.c_str(), "rb");
+ ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile);
chunk.clear();
@@ -998,7 +998,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
return false;
}
size_t fileSize = static_cast<size_t>(st.st_size);
- FILE* fp = fopen(local_file.c_str(), "rb");
+ FILE* fp = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
if ( !fp )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot open file: "
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index da24ae4..26f8014 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -21,6 +21,7 @@
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
#include "cmMakefile.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
@@ -931,7 +932,7 @@ void cmCTestTestHandler::UpdateMaxTestNameWidth()
bool cmCTestTestHandler::GetValue(const char* tag,
int& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
bool ret = true;
@@ -953,7 +954,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
double& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -975,7 +976,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
bool& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -1007,7 +1008,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
size_t& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -1029,7 +1030,7 @@ bool cmCTestTestHandler::GetValue(const char* tag,
bool cmCTestTestHandler::GetValue(const char* tag,
std::string& value,
- std::ifstream& fin)
+ std::istream& fin)
{
std::string line;
cmSystemTools::GetLineFromStream(fin, line);
@@ -1798,7 +1799,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
}
// parse the list of tests to rerun from LastTestsFailed.log
- std::ifstream ifs(lastTestsFailedLog.c_str());
+ cmsys::ifstream ifs(lastTestsFailedLog.c_str());
if ( ifs )
{
std::string line;
@@ -1964,7 +1965,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
}
else
{
- std::ifstream ifs(filename.c_str(), std::ios::in
+ cmsys::ifstream ifs(filename.c_str(), std::ios::in
#ifdef _WIN32
| std::ios::binary
#endif
@@ -2054,7 +2055,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in)
// string
if(cmSystemTools::FileExists(in))
{
- std::ifstream fin(in);
+ cmsys::ifstream fin(in);
unsigned long filelen = cmSystemTools::FileLength(in);
char* buff = new char[filelen+1];
fin.getline(buff, filelen);
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 398f052..6dda300 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -227,19 +227,19 @@ private:
bool GetValue(const char* tag,
std::string& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
int& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
size_t& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
bool& value,
- std::ifstream& fin);
+ std::istream& fin);
bool GetValue(const char* tag,
double& value,
- std::ifstream& fin);
+ std::istream& fin);
/**
* Find the executable for a test
*/
diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx
index 137f344..85e07ae 100644
--- a/Source/CTest/cmParseCacheCoverage.cxx
+++ b/Source/CTest/cmParseCacheCoverage.cxx
@@ -5,6 +5,7 @@
#include "cmParseCacheCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
cmParseCacheCoverage::cmParseCacheCoverage(
@@ -106,7 +107,7 @@ bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args,
bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
{
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index 6b4adb4..528d0db 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -5,6 +5,7 @@
#include "cmParseGTMCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
@@ -48,7 +49,7 @@ bool cmParseGTMCoverage::LoadCoverageData(const char* d)
bool cmParseGTMCoverage::ReadMCovFile(const char* file)
{
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
return false;
@@ -127,7 +128,7 @@ bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath,
std::string const& function,
int& lineoffset)
{
- std::ifstream in(filepath.c_str());
+ cmsys::ifstream in(filepath.c_str());
if(!in)
{
return false;
diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx
index 37e8bd0..6226feb 100644
--- a/Source/CTest/cmParseMumpsCoverage.cxx
+++ b/Source/CTest/cmParseMumpsCoverage.cxx
@@ -5,6 +5,7 @@
#include "cmParseGTMCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
cmParseMumpsCoverage::cmParseMumpsCoverage(
@@ -23,7 +24,7 @@ bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
// Read the gtm_coverage.mcov file, that has two lines of data:
// packages:/full/path/to/Vista/Packages
// coverage_dir:/full/path/to/dir/with/*.mcov
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
return false;
@@ -61,7 +62,7 @@ bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file)
{
// initialize the coverage information for a given mumps file
- std::ifstream in(file.c_str());
+ cmsys::ifstream in(file.c_str());
if(!in)
{
return;
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index 593b2d1..1c26c1c 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -2,6 +2,7 @@
#include "cmSystemTools.h"
#include "cmParsePHPCoverage.h"
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
/*
To setup coverage for php.
@@ -20,7 +21,7 @@ cmParsePHPCoverage::cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont,
{
}
-bool cmParsePHPCoverage::ReadUntil(std::ifstream& in, char until)
+bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until)
{
char c = 0;
while(in.get(c) && c != until)
@@ -32,7 +33,7 @@ bool cmParsePHPCoverage::ReadUntil(std::ifstream& in, char until)
}
return true;
}
-bool cmParsePHPCoverage::ReadCoverageArray(std::ifstream& in,
+bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in,
cmStdString const& fileName)
{
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector
@@ -109,7 +110,7 @@ bool cmParsePHPCoverage::ReadCoverageArray(std::ifstream& in,
return true;
}
-bool cmParsePHPCoverage::ReadInt(std::ifstream& in, int& v)
+bool cmParsePHPCoverage::ReadInt(std::istream& in, int& v)
{
std::string s;
char c = 0;
@@ -121,7 +122,7 @@ bool cmParsePHPCoverage::ReadInt(std::ifstream& in, int& v)
return true;
}
-bool cmParsePHPCoverage::ReadArraySize(std::ifstream& in, int& size)
+bool cmParsePHPCoverage::ReadArraySize(std::istream& in, int& size)
{
char c = 0;
in.get(c);
@@ -139,7 +140,7 @@ bool cmParsePHPCoverage::ReadArraySize(std::ifstream& in, int& size)
return false;
}
-bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in)
+bool cmParsePHPCoverage::ReadFileInformation(std::istream& in)
{
char buf[4];
in.read(buf, 2);
@@ -190,7 +191,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in)
bool cmParsePHPCoverage::ReadPHPData(const char* file)
{
- std::ifstream in(file);
+ cmsys::ifstream in(file);
if(!in)
{
return false;
diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h
index d50a83c..035a093 100644
--- a/Source/CTest/cmParsePHPCoverage.h
+++ b/Source/CTest/cmParsePHPCoverage.h
@@ -32,11 +32,11 @@ public:
void PrintCoverage();
private:
bool ReadPHPData(const char* file);
- bool ReadArraySize(std::ifstream& in, int& size);
- bool ReadFileInformation(std::ifstream& in);
- bool ReadInt(std::ifstream& in, int& v);
- bool ReadCoverageArray(std::ifstream& in, cmStdString const&);
- bool ReadUntil(std::ifstream& in, char until);
+ bool ReadArraySize(std::istream& in, int& size);
+ bool ReadFileInformation(std::istream& in);
+ bool ReadInt(std::istream& in, int& v);
+ bool ReadCoverageArray(std::istream& in, cmStdString const&);
+ bool ReadUntil(std::istream& in, char until);
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx
index a086f13..38a770a 100644
--- a/Source/CTest/cmParsePythonCoverage.cxx
+++ b/Source/CTest/cmParsePythonCoverage.cxx
@@ -3,7 +3,7 @@
#include "cmXMLParser.h"
#include "cmParsePythonCoverage.h"
#include <cmsys/Directory.hxx>
-
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
class cmParsePythonCoverage::XMLParser: public cmXMLParser
@@ -35,7 +35,7 @@ protected:
atts[tagCount+1];
FileLinesType& curFileLines =
this->Coverage.TotalCoverage[this->CurFileName];
- std::ifstream fin(this->CurFileName.c_str());
+ cmsys::ifstream fin(this->CurFileName.c_str());
if(!fin)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index ce50845..2d1ef5c 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -19,6 +19,7 @@
#include "cmCursesMainForm.h"
#include "cmCursesStandardIncludes.h"
+#include <cmsys/Encoding.hxx>
#include <form.h>
@@ -78,8 +79,13 @@ void CMakeErrorHandler(const char* message, const char* title, bool&, void* clie
self->AddError(message, title);
}
-int main(int argc, char** argv)
+int main(int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = encoding_args.argc();
+ argv = encoding_args.argv();
+
cmSystemTools::FindCMakeResources(argv[0]);
cmDocumentation doc;
doc.addCMakeStandardDocSections();
diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx
index 72ae5ee..d1b470c 100644
--- a/Source/CursesDialog/cmCursesForm.cxx
+++ b/Source/CursesDialog/cmCursesForm.cxx
@@ -11,7 +11,7 @@
============================================================================*/
#include "cmCursesForm.h"
-std::ofstream cmCursesForm::DebugFile;
+cmsys::ofstream cmCursesForm::DebugFile;
bool cmCursesForm::Debug = false;
cmCursesForm::cmCursesForm()
diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h
index 3cba856..f9317b9 100644
--- a/Source/CursesDialog/cmCursesForm.h
+++ b/Source/CursesDialog/cmCursesForm.h
@@ -14,6 +14,7 @@
#include "../cmStandardIncludes.h"
#include "cmCursesStandardIncludes.h"
+#include <cmsys/FStream.hxx>
class cmCursesForm
{
@@ -63,7 +64,7 @@ public:
protected:
- static std::ofstream DebugFile;
+ static cmsys::ofstream DebugFile;
static bool Debug;
cmCursesForm(const cmCursesForm& form);
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 408bb4c..821121e 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -21,6 +21,7 @@
#include "cmVersion.h"
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
+#include <cmsys/Encoding.hxx>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -48,12 +49,17 @@ static const char * cmDocumentationOptions[][2] =
int main(int argc, char** argv)
{
- cmSystemTools::FindCMakeResources(argv[0]);
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ int argc2 = encoding_args.argc();
+ char const* const* argv2 = encoding_args.argv();
+
+ cmSystemTools::FindCMakeResources(argv2[0]);
// check docs first so that X is not need to get docs
// do docs, if args were given
cmDocumentation doc;
doc.addCMakeStandardDocSections();
- if(argc >1 && doc.CheckOptions(argc, argv))
+ if(argc2 >1 && doc.CheckOptions(argc2, argv2))
{
// Construct and print requested documentation.
cmake hcm;
@@ -80,9 +86,9 @@ int main(int argc, char** argv)
}
// if arg for install
- for(int i =0; i < argc; i++)
+ for(int i =0; i < argc2; i++)
{
- if(strcmp(argv[i], "--mac-install") == 0)
+ if(strcmp(argv2[i], "--mac-install") == 0)
{
QMacInstallDialog setupdialog(0);
setupdialog.exec();
@@ -116,7 +122,7 @@ int main(int argc, char** argv)
dialog.show();
cmsys::CommandLineArguments arg;
- arg.Initialize(argc, argv);
+ arg.Initialize(argc2, argv2);
std::string binaryDirectory;
std::string sourceDirectory;
typedef cmsys::CommandLineArguments argT;
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index e4d7f7f..87bfb3c 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -33,6 +33,15 @@ bool cmAddDependenciesCommand
}
if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str()))
{
+ if (target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "Cannot add target-level dependencies to INTERFACE library "
+ "target \"" << target_name << "\".\n";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
std::vector<std::string>::const_iterator s = args.begin();
++s; // skip over target_name
for (; s != args.end(); ++s)
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 0f98f35..2627445 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -49,47 +49,117 @@ bool cmAddLibraryCommand
std::string libType = *s;
if(libType == "STATIC")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting STATIC type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::STATIC_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "SHARED")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting SHARED type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::SHARED_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "MODULE")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting MODULE type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::MODULE_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "OBJECT")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting OBJECT type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::OBJECT_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "UNKNOWN")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting UNKNOWN type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::UNKNOWN_LIBRARY;
haveSpecifiedType = true;
}
else if(libType == "ALIAS")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting ALIAS type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
isAlias = true;
}
else if(libType == "INTERFACE")
{
+ if (haveSpecifiedType)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting/multiple types.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ if (isAlias)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified with conflicting ALIAS type.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ if (excludeFromAll)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
type = cmTarget::INTERFACE_LIBRARY;
haveSpecifiedType = true;
}
else if(*s == "EXCLUDE_FROM_ALL")
{
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
++s;
excludeFromAll = true;
}
@@ -109,6 +179,24 @@ bool cmAddLibraryCommand
}
}
+ if (type == cmTarget::INTERFACE_LIBRARY)
+ {
+ if (s != args.end())
+ {
+ cmOStringStream e;
+ e << "INTERFACE library requires no source arguments.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ if (importGlobal && !importTarget)
+ {
+ cmOStringStream e;
+ e << "INTERFACE library specified as GLOBAL, but not as IMPORTED.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+
bool nameOk = cmGeneratorExpression::IsValidTargetName(libName) &&
!cmGlobalGenerator::IsReservedTarget(libName);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index b410e44..d5dcd6a 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -14,6 +14,7 @@
#include "cmSystemTools.h"
#include <cmsys/ios/iostream>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
#include <cm_libarchive.h>
//----------------------------------------------------------------------------
@@ -263,7 +264,7 @@ bool cmArchiveWrite::AddFile(const char* file,
//----------------------------------------------------------------------------
bool cmArchiveWrite::AddData(const char* file, size_t size)
{
- std::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
if(!fin)
{
this->Error = "Error opening \"";
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 125a3bf..acedc1a 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -19,6 +19,7 @@
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
#include <cmsys/SystemInformation.hxx>
+#include <cmsys/FStream.hxx>
#include "cmDynamicLoader.h"
#include "cmGeneratedFileStream.h"
#include "cmXMLSafe.h"
@@ -207,7 +208,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
return -1;
}
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
- file = ::fopen(putFile.c_str(), "rb");
+ file = cmsys::SystemTools::Fopen(putFile.c_str(), "rb");
::curl_easy_setopt(curl, CURLOPT_INFILE, file);
//fall through to append GET fields
case cmCTest::HTTP_GET:
@@ -549,7 +550,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
}
std::string tagfile = testingDir + "/TAG";
- std::ifstream tfin(tagfile.c_str());
+ cmsys::ifstream tfin(tagfile.c_str());
std::string tag;
if (createNewTag)
@@ -604,7 +605,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
lctime->tm_hour,
lctime->tm_min);
tag = datestring;
- std::ofstream ofs(tagfile.c_str());
+ cmsys::ofstream ofs(tagfile.c_str());
if ( ofs )
{
ofs << tag << std::endl;
@@ -763,7 +764,7 @@ bool cmCTest::UpdateCTestConfiguration()
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Parse Config file:"
<< fileName.c_str() << "\n");
// parse the dart test file
- std::ifstream fin(fileName.c_str());
+ cmsys::ifstream fin(fileName.c_str());
if(!fin)
{
@@ -1149,7 +1150,7 @@ int cmCTest::GetTestModelFromString(const char* str)
//----------------------------------------------------------------------
int cmCTest::RunMakeCommand(const char* command, std::string* output,
- int* retVal, const char* dir, int timeout, std::ofstream& ofs)
+ int* retVal, const char* dir, int timeout, std::ostream& ofs)
{
// First generate the command and arguments
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@@ -1611,7 +1612,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os,
<< "<Time>" << cmSystemTools::GetTime() << "</Time>\n"
<< "<DateTime>" << note_time << "</DateTime>\n"
<< "<Text>" << std::endl;
- std::ifstream ifs(it->c_str());
+ cmsys::ifstream ifs(it->c_str());
if ( ifs )
{
std::string line;
@@ -1692,7 +1693,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file)
std::string cmCTest::Base64EncodeFile(std::string file)
{
long len = cmSystemTools::FileLength(file.c_str());
- std::ifstream ifs(file.c_str(), std::ios::in
+ cmsys::ifstream ifs(file.c_str(), std::ios::in
#ifdef _WIN32
| std::ios::binary
#endif
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index c0a06c5..becb0f5 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -273,7 +273,7 @@ public:
// and retVal is return value or exception.
int RunMakeCommand(const char* command, std::string* output,
int* retVal, const char* dir, int timeout,
- std::ofstream& ofs);
+ std::ostream& ofs);
/*
* return the current tag
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index a2baa80..d3d8f3f 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -20,7 +20,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
-
+#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
const char* cmCacheManagerTypes[] =
@@ -211,7 +211,7 @@ bool cmCacheManager::LoadCache(const char* path,
return false;
}
- std::ifstream fin(cacheFile.c_str());
+ cmsys::ifstream fin(cacheFile.c_str());
if(!fin)
{
return false;
@@ -566,7 +566,7 @@ bool cmCacheManager::SaveCache(const char* path)
checkCacheFile += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(checkCacheFile.c_str());
checkCacheFile += "/cmake.check_cache";
- std::ofstream checkCache(checkCacheFile.c_str());
+ cmsys::ofstream checkCache(checkCacheFile.c_str());
if(!checkCache)
{
cmSystemTools::Error("Unable to open check cache file for write. ",
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 31cc393..1be5980 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -619,19 +619,19 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index,
}
//----------------------------------------------------------------------------
-cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index,
+cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
const char* name)
{
// Look for a target in the scope of the depender.
cmMakefile* mf = this->Makefile;
if(depender_index >= 0)
{
- if(cmTarget* depender = this->EntryList[depender_index].Target)
+ if(cmTarget const* depender = this->EntryList[depender_index].Target)
{
mf = depender->GetMakefile();
}
}
- cmTarget* tgt = mf->FindTargetToUse(name);
+ cmTarget const* tgt = mf->FindTargetToUse(name);
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
@@ -950,7 +950,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
int count = 2;
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- if(cmTarget* target = this->EntryList[*ni].Target)
+ if(cmTarget const* target = this->EntryList[*ni].Target)
{
if(cmTarget::LinkInterface const* iface =
target->GetLinkInterface(this->Config, this->HeadTarget))
@@ -997,7 +997,8 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index,
// For CMake 2.4 bug-compatibility we need to consider the output
// directories of targets linked in another configuration as link
// directories.
- if(cmTarget* tgt = this->FindTargetToLink(depender_index, item.c_str()))
+ if(cmTarget const* tgt
+ = this->FindTargetToLink(depender_index, item.c_str()))
{
if(!tgt->IsImported())
{
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index b86c9b2..cf227fb 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -40,7 +40,7 @@ public:
struct LinkEntry
{
std::string Item;
- cmTarget* Target;
+ cmTarget const* Target;
bool IsSharedDep;
bool IsFlag;
LinkEntry(): Item(), Target(0), IsSharedDep(false), IsFlag(false) {}
@@ -53,7 +53,7 @@ public:
EntryVector const& Compute();
void SetOldLinkDirMode(bool b);
- std::set<cmTarget*> const& GetOldWrongConfigItems() const
+ std::set<cmTarget const*> const& GetOldWrongConfigItems() const
{ return this->OldWrongConfigItems; }
private:
@@ -83,7 +83,7 @@ private:
void AddDirectLinkEntries();
void AddLinkEntries(int depender_index,
std::vector<std::string> const& libs);
- cmTarget* FindTargetToLink(int depender_index, const char* name);
+ cmTarget const* FindTargetToLink(int depender_index, const char* name);
// One entry for each unique item.
std::vector<LinkEntry> EntryList;
@@ -164,7 +164,7 @@ private:
// Compatibility help.
bool OldLinkDirMode;
void CheckWrongConfigItem(int depender_index, std::string const& item);
- std::set<cmTarget*> OldWrongConfigItems;
+ std::set<cmTarget const*> OldWrongConfigItems;
};
#endif
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 0ef3d2e..6986965 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -477,7 +477,7 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths()
}
//----------------------------------------------------------------------------
-std::set<cmTarget*> const&
+std::set<cmTarget const*> const&
cmComputeLinkInformation::GetSharedLibrariesLinked()
{
return this->SharedLibrariesLinked;
@@ -542,11 +542,11 @@ bool cmComputeLinkInformation::Compute()
// For CMake 2.4 bug-compatibility we need to consider the output
// directories of targets linked in another configuration as link
// directories.
- std::set<cmTarget*> const& wrongItems = cld.GetOldWrongConfigItems();
- for(std::set<cmTarget*>::const_iterator i = wrongItems.begin();
+ std::set<cmTarget const*> const& wrongItems = cld.GetOldWrongConfigItems();
+ for(std::set<cmTarget const*>::const_iterator i = wrongItems.begin();
i != wrongItems.end(); ++i)
{
- cmTarget* tgt = *i;
+ cmTarget const* tgt = *i;
bool implib =
(this->UseImportLibrary &&
(tgt->GetType() == cmTarget::SHARED_LIBRARY));
@@ -620,7 +620,8 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
}
//----------------------------------------------------------------------------
-void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
+void cmComputeLinkInformation::AddItem(std::string const& item,
+ cmTarget const* tgt)
{
// Compute the proper name to use to link this library.
const char* config = this->Config;
@@ -700,7 +701,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
//----------------------------------------------------------------------------
void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
- cmTarget* tgt)
+ cmTarget const* tgt)
{
// If dropping shared library dependencies, ignore them.
if(this->SharedDependencyMode == SharedDepModeNone)
@@ -1062,7 +1063,7 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt)
//----------------------------------------------------------------------------
void cmComputeLinkInformation::AddTargetItem(std::string const& item,
- cmTarget* target)
+ cmTarget const* target)
{
// This is called to handle a link item that is a full path to a target.
// If the target is not a static library make sure the link type is
@@ -1744,14 +1745,14 @@ cmComputeLinkInformation::GetRuntimeSearchPath()
//----------------------------------------------------------------------------
void
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
- cmTarget* target)
+ cmTarget const* target)
{
// Ignore targets on Apple where install_name is not @rpath.
// The dependenty library can be found with other means such as
// @loader_path or full paths.
if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
- if(!target->HasMacOSXRpath(this->Config))
+ if(!target->HasMacOSXRpathInstallNameDir(this->Config))
{
return;
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 1da5495..356e6ed 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -39,11 +39,11 @@ public:
Item(): Value(), IsPath(true), Target(0) {}
Item(Item const& item):
Value(item.Value), IsPath(item.IsPath), Target(item.Target) {}
- Item(std::string const& v, bool p, cmTarget* target = 0):
+ Item(std::string const& v, bool p, cmTarget const* target = 0):
Value(v), IsPath(p), Target(target) {}
std::string Value;
bool IsPath;
- cmTarget* Target;
+ cmTarget const* Target;
};
typedef std::vector<Item> ItemVector;
ItemVector const& GetItems();
@@ -57,13 +57,13 @@ public:
void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install);
std::string GetRPathString(bool for_install);
std::string GetChrpathString();
- std::set<cmTarget*> const& GetSharedLibrariesLinked();
+ std::set<cmTarget const*> const& GetSharedLibrariesLinked();
std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; }
std::string GetRPathLinkString();
private:
- void AddItem(std::string const& item, cmTarget* tgt);
- void AddSharedDepItem(std::string const& item, cmTarget* tgt);
+ void AddItem(std::string const& item, cmTarget const* tgt);
+ void AddSharedDepItem(std::string const& item, cmTarget const* tgt);
// Output information.
ItemVector Items;
@@ -71,7 +71,7 @@ private:
std::vector<std::string> Depends;
std::vector<std::string> FrameworkPaths;
std::vector<std::string> RuntimeSearchPath;
- std::set<cmTarget*> SharedLibrariesLinked;
+ std::set<cmTarget const*> SharedLibrariesLinked;
// Context information.
cmTarget const* Target;
@@ -139,7 +139,7 @@ private:
std::string NoCaseExpression(const char* str);
// Handling of link items.
- void AddTargetItem(std::string const& item, cmTarget* target);
+ void AddTargetItem(std::string const& item, cmTarget const* target);
void AddFullItem(std::string const& item);
bool CheckImplicitDirItem(std::string const& item);
void AddUserItem(std::string const& item, bool pathNotKnown);
@@ -179,7 +179,8 @@ private:
// Runtime path computation.
cmOrderDirectories* OrderRuntimeSearchPath;
- void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target);
+ void AddLibraryRuntimeInfo(std::string const& fullPath,
+ cmTarget const* target);
void AddLibraryRuntimeInfo(std::string const& fullPath);
// Dependent library path computation.
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index cb9e37e..73a8e27 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -143,12 +143,13 @@ bool cmComputeTargetDepends::Compute()
//----------------------------------------------------------------------------
void
-cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t,
+cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
cmTargetDependSet& deps)
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget*, int>::const_iterator tii = this->TargetIndex.find(t);
+ std::map<cmTarget const*, int>::const_iterator tii
+ = this->TargetIndex.find(t);
assert(tii != this->TargetIndex.end());
int i = tii->second;
@@ -156,7 +157,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t,
EdgeList const& nl = this->FinalGraph[i];
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- cmTarget* dep = this->Targets[*ni];
+ cmTarget const* dep = this->Targets[*ni];
cmTargetDependSet::iterator di = deps.insert(dep).first;
di->SetType(ni->IsStrong());
}
@@ -170,10 +171,11 @@ void cmComputeTargetDepends::CollectTargets()
this->GlobalGenerator->GetLocalGenerators();
for(unsigned int i = 0; i < lgens.size(); ++i)
{
- cmTargets& targets = lgens[i]->GetMakefile()->GetTargets();
- for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti)
+ const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets();
+ for(cmTargets::const_iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
{
- cmTarget* target = &ti->second;
+ cmTarget const* target = &ti->second;
int index = static_cast<int>(this->Targets.size());
this->TargetIndex[target] = index;
this->Targets.push_back(target);
@@ -198,7 +200,11 @@ void cmComputeTargetDepends::CollectDepends()
void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
{
// Get the depender.
- cmTarget* depender = this->Targets[depender_index];
+ cmTarget const* depender = this->Targets[depender_index];
+ if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
// Loop over all targets linked directly in all configs.
// We need to make targets depend on the union of all config-specific
@@ -208,15 +214,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
std::set<cmStdString> emitted;
{
std::vector<std::string> tlibs;
- if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- // For INTERFACE_LIBRARY depend on the interface instead.
- depender->GetInterfaceLinkLibraries(0, tlibs, depender);
- }
- else
- {
- depender->GetDirectLinkLibraries(0, tlibs, depender);
- }
+ depender->GetDirectLinkLibraries(0, tlibs, depender);
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
@@ -237,15 +235,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
it != configs.end(); ++it)
{
std::vector<std::string> tlibs;
- if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- // For INTERFACE_LIBRARY depend on the interface instead.
- depender->GetInterfaceLinkLibraries(it->c_str(), tlibs, depender);
- }
- else
- {
- depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
- }
+ depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
+
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
@@ -282,11 +273,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
- cmTarget* dependee,
+ cmTarget const* dependee,
const char *config,
std::set<cmStdString> &emitted)
{
- cmTarget* depender = this->Targets[depender_index];
+ cmTarget const* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
dependee->GetLinkInterface(config, depender))
{
@@ -311,8 +302,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
bool linking,
std::set<cmStdString> &emitted)
{
- cmTarget* depender = this->Targets[depender_index];
- cmTarget* dependee =
+ cmTarget const* depender = this->Targets[depender_index];
+ cmTarget const* dependee =
depender->GetMakefile()->FindTargetToUse(dependee_name);
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
@@ -346,10 +337,10 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
bool linking)
{
// Get the depender.
- cmTarget* depender = this->Targets[depender_index];
+ cmTarget const* depender = this->Targets[depender_index];
// Check the target's makefile first.
- cmTarget* dependee =
+ cmTarget const* dependee =
depender->GetMakefile()->FindTargetToUse(dependee_name);
// Skip targets that will not really be linked. This is probably a
@@ -370,7 +361,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index,
- cmTarget* dependee,
+ cmTarget const* dependee,
bool linking)
{
if(dependee->IsImported())
@@ -380,7 +371,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
for(std::set<cmStdString>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
- if(cmTarget* transitive_dependee =
+ if(cmTarget const* transitive_dependee =
dependee->GetMakefile()->FindTargetToUse(i->c_str()))
{
this->AddTargetDepend(depender_index, transitive_dependee, false);
@@ -391,7 +382,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget*, int>::const_iterator tii =
+ std::map<cmTarget const*, int>::const_iterator tii =
this->TargetIndex.find(dependee);
assert(tii != this->TargetIndex.end());
int dependee_index = tii->second;
@@ -411,13 +402,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name)
for(int depender_index = 0; depender_index < n; ++depender_index)
{
EdgeList const& nl = graph[depender_index];
- cmTarget* depender = this->Targets[depender_index];
+ cmTarget const* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n",
depender_index, depender->GetName());
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_index = *ni;
- cmTarget* dependee = this->Targets[dependee_index];
+ cmTarget const* dependee = this->Targets[dependee_index];
fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
dependee->GetName(), ni->IsStrong()? "strong" : "weak");
}
@@ -504,7 +495,7 @@ cmComputeTargetDepends
{
// Get the depender.
int i = *ci;
- cmTarget* depender = this->Targets[i];
+ cmTarget const* depender = this->Targets[i];
// Describe the depender.
e << " \"" << depender->GetName() << "\" of type "
@@ -517,7 +508,7 @@ cmComputeTargetDepends
int j = *ni;
if(cmap[j] == c)
{
- cmTarget* dependee = this->Targets[j];
+ cmTarget const* dependee = this->Targets[j];
e << " depends on \"" << dependee->GetName() << "\""
<< " (" << (ni->IsStrong()? "strong" : "weak") << ")\n";
}
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index d6131cf..6cd6da0 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -38,19 +38,21 @@ public:
bool Compute();
- std::vector<cmTarget*> const& GetTargets() const { return this->Targets; }
- void GetTargetDirectDepends(cmTarget* t, cmTargetDependSet& deps);
+ std::vector<cmTarget const*> const&
+ GetTargets() const { return this->Targets; }
+ void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps);
private:
void CollectTargets();
void CollectDepends();
void CollectTargetDepends(int depender_index);
void AddTargetDepend(int depender_index, const char* dependee_name,
bool linking);
- void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking);
+ void AddTargetDepend(int depender_index, cmTarget const* dependee,
+ bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
void AddInterfaceDepends(int depender_index, const char* dependee_name,
bool linking, std::set<cmStdString> &emitted);
- void AddInterfaceDepends(int depender_index, cmTarget* dependee,
+ void AddInterfaceDepends(int depender_index, cmTarget const* dependee,
const char *config,
std::set<cmStdString> &emitted);
cmGlobalGenerator* GlobalGenerator;
@@ -58,8 +60,8 @@ private:
bool NoCycles;
// Collect all targets.
- std::vector<cmTarget*> Targets;
- std::map<cmTarget*, int> TargetIndex;
+ std::vector<cmTarget const*> Targets;
+ std::map<cmTarget const*, int> TargetIndex;
// Represent the target dependency graph. The entry at each
// top-level index corresponds to a depender whose dependencies are
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index bbfc427..78bb9a6 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -278,7 +278,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
sourceDirectory = this->BinaryDirectory.c_str();
// now create a CMakeLists.txt file in that directory
- FILE *fout = fopen(outFileName.c_str(),"w");
+ FILE *fout = cmsys::SystemTools::Fopen(outFileName.c_str(),"w");
if (!fout)
{
cmOStringStream e;
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index a4f6ac4..7f4b10f 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -12,6 +12,7 @@
#include "cmCryptoHash.h"
#include <cmsys/MD5.h>
+#include <cmsys/FStream.hxx>
#include "cm_sha2.h"
//----------------------------------------------------------------------------
@@ -45,7 +46,7 @@ std::string cmCryptoHash::HashString(const char* input)
//----------------------------------------------------------------------------
std::string cmCryptoHash::HashFile(const char* file)
{
- std::ifstream fin(file, std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary);
if(!fin)
{
return "";
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 74a0ccb..1a0e93f 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -17,6 +17,7 @@
#include "cmSystemTools.h"
#include "cmFileTimeComparison.h"
#include <string.h>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir):
@@ -103,7 +104,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile,
// Check whether dependencies must be regenerated.
bool okay = true;
- std::ifstream fin(internalFile);
+ cmsys::ifstream fin(internalFile);
if(!(fin && this->CheckDependencies(fin, internalFile, validDeps)))
{
// Clear all dependencies so they will be regenerated.
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index a252a1a..4fc5efb 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -15,6 +15,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
+#include <cmsys/FStream.hxx>
#include <ctype.h> // isspace
@@ -246,7 +247,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// Try to scan the file. Just leave it out if we cannot find
// it.
- std::ifstream fin(fullName.c_str());
+ cmsys::ifstream fin(fullName.c_str());
if(fin)
{
// Add this file as a dependency.
@@ -291,7 +292,7 @@ void cmDependsC::ReadCacheFile()
{
return;
}
- std::ifstream fin(this->CacheFileName.c_str());
+ cmsys::ifstream fin(this->CacheFileName.c_str());
if(!fin)
{
return;
@@ -380,7 +381,7 @@ void cmDependsC::WriteCacheFile() const
{
return;
}
- std::ofstream cacheOut(this->CacheFileName.c_str());
+ cmsys::ofstream cacheOut(this->CacheFileName.c_str());
if(!cacheOut)
{
return;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index e41e5ea..d5472a1 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -17,7 +17,7 @@
#include "cmGeneratedFileStream.h"
#include "cmDependsFortranParser.h" /* Interface to parser object. */
-
+#include <cmsys/FStream.hxx>
#include <assert.h>
#include <stack>
@@ -356,7 +356,7 @@ void cmDependsFortran::LocateModules()
{
std::string targetDir = cmSystemTools::GetFilenamePath(*i);
std::string fname = targetDir + "/fortran.internal";
- std::ifstream fin(fname.c_str());
+ cmsys::ifstream fin(fname.c_str());
if(fin)
{
this->MatchRemoteModules(fin, targetDir.c_str());
@@ -700,7 +700,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
// is later used for longer sequences it should be re-written using an
// efficient string search algorithm such as Boyer-Moore.
static
-bool cmDependsFortranStreamContainsSequence(std::ifstream& ifs,
+bool cmDependsFortranStreamContainsSequence(std::istream& ifs,
const char* seq, int len)
{
assert(len > 0);
@@ -733,8 +733,8 @@ bool cmDependsFortranStreamContainsSequence(std::ifstream& ifs,
//----------------------------------------------------------------------------
// Helper function to compare the remaining content in two streams.
-static bool cmDependsFortranStreamsDiffer(std::ifstream& ifs1,
- std::ifstream& ifs2)
+static bool cmDependsFortranStreamsDiffer(std::istream& ifs1,
+ std::istream& ifs2)
{
// Compare the remaining content.
for(;;)
@@ -799,11 +799,11 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
}
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream finModFile(modFile, std::ios::in | std::ios::binary);
- std::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary);
+ cmsys::ifstream finModFile(modFile, std::ios::in | std::ios::binary);
+ cmsys::ifstream finStampFile(stampFile, std::ios::in | std::ios::binary);
#else
- std::ifstream finModFile(modFile, std::ios::in);
- std::ifstream finStampFile(stampFile, std::ios::in);
+ cmsys::ifstream finModFile(modFile, std::ios::in);
+ cmsys::ifstream finStampFile(stampFile, std::ios::in);
#endif
if(!finModFile || !finStampFile)
{
@@ -944,7 +944,7 @@ bool cmDependsFortranParser_FilePush(cmDependsFortranParser* parser,
{
// Open the new file and push it onto the stack. Save the old
// buffer with it on the stack.
- if(FILE* file = fopen(fname, "rb"))
+ if(FILE* file = cmsys::SystemTools::Fopen(fname, "rb"))
{
YY_BUFFER_STATE current =
cmDependsFortranLexer_GetCurrentBuffer(parser->Scanner);
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 6136baa..c30d4bd 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include "cmDependsJavaLexer.h"
+#include <cmsys/FStream.hxx>
int cmDependsJava_yyparse( yyscan_t yyscanner );
@@ -412,7 +413,7 @@ int cmDependsJavaParserHelper::ParseFile(const char* file)
{
return 0;
}
- std::ifstream ifs(file);
+ cmsys::ifstream ifs(file);
if ( !ifs )
{
return 0;
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 8576bf2..01f7a20 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -17,6 +17,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
+#include <cmsys/FStream.hxx>
#include <ctype.h>
@@ -156,11 +157,11 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
this->CurrentArgument = i->Argument;
// If a file name was given, use it. Otherwise, default to the
// given stream.
- std::ofstream* fout = 0;
+ cmsys::ofstream* fout = 0;
std::ostream* s = &os;
if(i->Filename.length() > 0)
{
- fout = new std::ofstream(i->Filename.c_str(), std::ios::out);
+ fout = new cmsys::ofstream(i->Filename.c_str(), std::ios::out);
if(fout)
{
s = fout;
@@ -631,7 +632,7 @@ void cmDocumentation::PrintNames(std::ostream& os,
i != files.end(); ++i)
{
std::string line;
- std::ifstream fin(i->c_str());
+ cmsys::ifstream fin(i->c_str());
while(fin && cmSystemTools::GetLineFromStream(fin, line))
{
if(!line.empty() && (isalnum(line[0]) || line[0] == '<'))
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 30de9a8..353f2e9 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -13,6 +13,7 @@
#include "cmELF.h"
#include <cmsys/auto_ptr.hxx>
+#include <cmsys/FStream.hxx>
// Need the native byte order of the running CPU.
#define cmsys_CPU_UNKNOWN_OKAY // We can decide at runtime if not known.
@@ -71,7 +72,7 @@ public:
// Construct and take ownership of the file stream object.
cmELFInternal(cmELF* external,
- cmsys::auto_ptr<std::ifstream>& fin,
+ cmsys::auto_ptr<cmsys::ifstream>& fin,
ByteOrderType order):
External(external),
Stream(*fin.release()),
@@ -204,7 +205,7 @@ public:
// Construct with a stream and byte swap indicator.
cmELFInternalImpl(cmELF* external,
- cmsys::auto_ptr<std::ifstream>& fin,
+ cmsys::auto_ptr<cmsys::ifstream>& fin,
ByteOrderType order);
// Return the number of sections as specified by the ELF header.
@@ -462,7 +463,7 @@ private:
template <class Types>
cmELFInternalImpl<Types>
::cmELFInternalImpl(cmELF* external,
- cmsys::auto_ptr<std::ifstream>& fin,
+ cmsys::auto_ptr<cmsys::ifstream>& fin,
ByteOrderType order):
cmELFInternal(external, fin, order)
{
@@ -707,7 +708,7 @@ cmELFInternalImpl<Types>::GetDynamicSectionString(int tag)
cmELF::cmELF(const char* fname): Internal(0)
{
// Try to open the file.
- cmsys::auto_ptr<std::ifstream> fin(new std::ifstream(fname));
+ cmsys::auto_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname));
// Quit now if the file could not be opened.
if(!fin.get() || !*fin)
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 0d0d05b..b669cd1 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -13,11 +13,14 @@
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
+#include "cmExportSet.h"
+#include "cmTargetExport.h"
//----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
{
this->Makefile = 0;
+ this->ExportSet = 0;
}
//----------------------------------------------------------------------------
@@ -26,9 +29,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
{
std::string expectedTargets;
std::string sep;
+ std::vector<std::string> targets;
+ this->GetTargets(targets);
for(std::vector<std::string>::const_iterator
- tei = this->Targets.begin();
- tei != this->Targets.end(); ++tei)
+ tei = targets.begin();
+ tei != targets.end(); ++tei)
{
cmTarget *te = this->Makefile->FindTargetToUse(tei->c_str());
expectedTargets += sep + this->Namespace + te->GetExportName();
@@ -153,6 +158,12 @@ cmExportBuildFileGenerator
}
//----------------------------------------------------------------------------
+void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet)
+{
+ this->ExportSet = exportSet;
+}
+
+//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
@@ -229,9 +240,24 @@ cmExportBuildFileGenerator::HandleMissingTarget(
// Append it with the export namespace.
link_libs += this->Namespace;
link_libs += dependee->GetExportName();
-// if generate time {}
}
+//----------------------------------------------------------------------------
+void cmExportBuildFileGenerator
+::GetTargets(std::vector<std::string> &targets) const
+{
+ if (this->ExportSet)
+ {
+ for(std::vector<cmTargetExport*>::const_iterator
+ tei = this->ExportSet->GetTargetExports()->begin();
+ tei != this->ExportSet->GetTargetExports()->end(); ++tei)
+ {
+ targets.push_back((*tei)->Target->GetName());
+ }
+ return;
+ }
+ targets = this->Targets;
+}
//----------------------------------------------------------------------------
std::vector<std::string>
@@ -248,8 +274,8 @@ cmExportBuildFileGenerator
expIt = exportSets.begin(); expIt != exportSets.end(); ++expIt)
{
const cmExportBuildFileGenerator* exportSet = expIt->second;
- std::vector<std::string> const& targets = exportSet->GetTargets();
-
+ std::vector<std::string> targets;
+ exportSet->GetTargets(targets);
if (std::find(targets.begin(), targets.end(), name) != targets.end())
{
namespaces.push_back(exportSet->GetNamespace());
diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h
index 2fbd98f..cea2099 100644
--- a/Source/cmExportBuildFileGenerator.h
+++ b/Source/cmExportBuildFileGenerator.h
@@ -15,6 +15,8 @@
#include "cmExportFileGenerator.h"
#include "cmListFileCache.h"
+class cmExportSet;
+
/** \class cmExportBuildFileGenerator
* \brief Generate a file exporting targets from a build tree.
*
@@ -32,11 +34,11 @@ public:
/** Set the list of targets to export. */
void SetTargets(std::vector<std::string> const& targets)
{ this->Targets = targets; }
- std::vector<std::string> const& GetTargets() const
- { return this->Targets; }
+ void GetTargets(std::vector<std::string> &targets) const;
void AppendTargets(std::vector<std::string> const& targets)
{ this->Targets.insert(this->Targets.end(),
targets.begin(), targets.end()); }
+ void SetExportSet(cmExportSet*);
/** Set whether to append generated code to the output file. */
void SetAppendMode(bool append) { this->AppendMode = append; }
@@ -75,6 +77,7 @@ protected:
FindNamespaces(cmMakefile* mf, const std::string& name);
std::vector<std::string> Targets;
+ cmExportSet *ExportSet;
std::vector<cmTarget*> Exports;
cmMakefile* Makefile;
cmListFileBacktrace Backtrace;
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 0a67ccf..7c97d8d 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -30,14 +30,12 @@ cmExportCommand::cmExportCommand()
,ArgumentGroup()
,Targets(&Helper, "TARGETS")
,Append(&Helper, "APPEND", &ArgumentGroup)
+,ExportSetName(&Helper, "EXPORT", &ArgumentGroup)
,Namespace(&Helper, "NAMESPACE", &ArgumentGroup)
,Filename(&Helper, "FILE", &ArgumentGroup)
,ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup)
{
- // at first TARGETS
- this->Targets.Follows(0);
- // and after that the other options in any order
- this->ArgumentGroup.Follows(&this->Targets);
+ this->ExportSet = 0;
}
@@ -55,6 +53,16 @@ bool cmExportCommand
{
return this->HandlePackage(args);
}
+ else if (args[0] == "EXPORT")
+ {
+ this->ExportSetName.Follows(0);
+ this->ArgumentGroup.Follows(&this->ExportSetName);
+ }
+ else
+ {
+ this->Targets.Follows(0);
+ this->ArgumentGroup.Follows(&this->Targets);
+ }
std::vector<std::string> unknownArgs;
this->Helper.Parse(&args, &unknownArgs);
@@ -65,31 +73,32 @@ bool cmExportCommand
return false;
}
- if (this->Targets.WasFound() == false)
- {
- this->SetError("TARGETS option missing.");
- return false;
- }
-
+ std::string fname;
if(!this->Filename.WasFound())
{
- this->SetError("FILE <filename> option missing.");
- return false;
+ if (args[0] != "EXPORT")
+ {
+ this->SetError("FILE <filename> option missing.");
+ return false;
+ }
+ fname = this->ExportSetName.GetString() + ".cmake";
}
-
- // Make sure the file has a .cmake extension.
- if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString())
- != ".cmake")
+ else
{
- cmOStringStream e;
- e << "FILE option given filename \"" << this->Filename.GetString()
- << "\" which does not have an extension of \".cmake\".\n";
- this->SetError(e.str().c_str());
- return false;
+ // Make sure the file has a .cmake extension.
+ if(cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString())
+ != ".cmake")
+ {
+ cmOStringStream e;
+ e << "FILE option given filename \"" << this->Filename.GetString()
+ << "\" which does not have an extension of \".cmake\".\n";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ fname = this->Filename.GetString();
}
// Get the file to write.
- std::string fname = this->Filename.GetString();
if(cmSystemTools::FileIsFullPath(fname.c_str()))
{
if(!this->Makefile->CanIWriteThisFile(fname.c_str()))
@@ -104,57 +113,95 @@ bool cmExportCommand
else
{
// Interpret relative paths with respect to the current build dir.
- fname = this->Makefile->GetCurrentOutputDirectory();
- fname += "/";
- fname += this->Filename.GetString();
+ std::string dir = this->Makefile->GetCurrentOutputDirectory();
+ fname = dir + "/" + fname;
}
- for(std::vector<std::string>::const_iterator
- currentTarget = this->Targets.GetVector().begin();
- currentTarget != this->Targets.GetVector().end();
- ++currentTarget)
+ std::vector<std::string> targets;
+
+ cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator();
+
+ if(args[0] == "EXPORT")
{
- if (this->Makefile->IsAlias(currentTarget->c_str()))
+ if (this->Append.IsEnabled())
+ {
+ cmOStringStream e;
+ e << "EXPORT signature does not recognise the APPEND option.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ if (this->ExportOld.IsEnabled())
{
cmOStringStream e;
- e << "given ALIAS target \"" << *currentTarget
- << "\" which may not be exported.";
+ e << "EXPORT signature does not recognise the "
+ "EXPORT_LINK_INTERFACE_LIBRARIES option.";
this->SetError(e.str().c_str());
return false;
}
- if(cmTarget* target =
- this->Makefile->GetLocalGenerator()->
- GetGlobalGenerator()->FindTarget(0, currentTarget->c_str()))
+ cmExportSetMap &setMap = gg->GetExportSets();
+ std::string setName = this->ExportSetName.GetString();
+ if (setMap.find(setName) == setMap.end())
{
- if(target->GetType() == cmTarget::OBJECT_LIBRARY)
+ cmOStringStream e;
+ e << "Export set \"" << setName << "\" not found.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ this->ExportSet = setMap[setName];
+ }
+ else if (this->Targets.WasFound())
+ {
+ for(std::vector<std::string>::const_iterator
+ currentTarget = this->Targets.GetVector().begin();
+ currentTarget != this->Targets.GetVector().end();
+ ++currentTarget)
+ {
+ if (this->Makefile->IsAlias(currentTarget->c_str()))
{
cmOStringStream e;
- e << "given OBJECT library \"" << *currentTarget
+ e << "given ALIAS target \"" << *currentTarget
<< "\" which may not be exported.";
this->SetError(e.str().c_str());
return false;
}
+
+ if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str()))
+ {
+ if(target->GetType() == cmTarget::OBJECT_LIBRARY)
+ {
+ cmOStringStream e;
+ e << "given OBJECT library \"" << *currentTarget
+ << "\" which may not be exported.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "given target \"" << *currentTarget
+ << "\" which is not built by this project.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ targets.push_back(*currentTarget);
}
- else
+ if (this->Append.IsEnabled())
{
- cmOStringStream e;
- e << "given target \"" << *currentTarget
- << "\" which is not built by this project.";
- this->SetError(e.str().c_str());
- return false;
+ if (cmExportBuildFileGenerator *ebfg = gg->GetExportedTargetsFile(fname))
+ {
+ ebfg->AppendTargets(targets);
+ return true;
+ }
}
}
-
- cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator();
- if (this->Append.IsEnabled())
+ else
{
- if (cmExportBuildFileGenerator *ebfg = gg->GetExportedTargetsFile(fname))
- {
- ebfg->AppendTargets(this->Targets.GetVector());
- return true;
- }
+ this->SetError("EXPORT or TARGETS specifier missing.");
+ return false;
}
// Setup export file generation.
@@ -162,7 +209,14 @@ bool cmExportCommand
ebfg->SetExportFile(fname.c_str());
ebfg->SetNamespace(this->Namespace.GetCString());
ebfg->SetAppendMode(this->Append.IsEnabled());
- ebfg->SetTargets(this->Targets.GetVector());
+ if (this->ExportSet)
+ {
+ ebfg->SetExportSet(this->ExportSet);
+ }
+ else
+ {
+ ebfg->SetTargets(targets);
+ }
ebfg->SetMakefile(this->Makefile);
ebfg->SetExportOld(this->ExportOld.IsEnabled());
@@ -182,8 +236,14 @@ bool cmExportCommand
{
ebfg->AddConfiguration("");
}
-
- gg->AddBuildExportSet(ebfg);
+ if (this->ExportSet)
+ {
+ gg->AddBuildExportExportSet(ebfg);
+ }
+ else
+ {
+ gg->AddBuildExportSet(ebfg);
+ }
return true;
}
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index ea7c3a3..c0e445f 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -15,6 +15,7 @@
#include "cmCommand.h"
class cmExportBuildFileGenerator;
+class cmExportSet;
/** \class cmExportLibraryDependenciesCommand
* \brief Add a test to the lists of tests to run.
@@ -52,10 +53,13 @@ private:
cmCommandArgumentGroup ArgumentGroup;
cmCAStringVector Targets;
cmCAEnabler Append;
+ cmCAString ExportSetName;
cmCAString Namespace;
cmCAString Filename;
cmCAEnabler ExportOld;
+ cmExportSet *ExportSet;
+
friend class cmExportBuildFileGenerator;
std::string ErrorMessage;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index f8b4e28..13bff19 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -24,6 +24,7 @@
#include "cmComputeLinkInformation.h"
#include <cmsys/auto_ptr.hxx>
+#include <cmsys/FStream.hxx>
#include <assert.h>
//----------------------------------------------------------------------------
@@ -61,12 +62,12 @@ const char* cmExportFileGenerator::GetMainExportFileName() const
bool cmExportFileGenerator::GenerateImportFile()
{
// Open the output file to generate it.
- cmsys::auto_ptr<std::ofstream> foutPtr;
+ cmsys::auto_ptr<cmsys::ofstream> foutPtr;
if(this->AppendMode)
{
// Open for append.
- cmsys::auto_ptr<std::ofstream>
- ap(new std::ofstream(this->MainImportFile.c_str(), std::ios::app));
+ cmsys::auto_ptr<cmsys::ofstream>
+ ap(new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app));
foutPtr = ap;
}
else
@@ -402,7 +403,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
//----------------------------------------------------------------------------
-void getPropertyContents(cmTarget *tgt, const char *prop,
+void getPropertyContents(cmTarget const* tgt, const char *prop,
std::set<std::string> &ifaceProperties)
{
const char *p = tgt->GetProperty(prop);
@@ -825,36 +826,36 @@ cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix,
cmTarget* target,
const char* propName,
- std::vector<std::string> const& libs,
+ std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
)
{
- // Skip the property if there are no libraries.
- if(libs.empty())
+ // Skip the property if there are no entries.
+ if(entries.empty())
{
return;
}
// Construct the property value.
- std::string link_libs;
+ std::string link_entries;
const char* sep = "";
- for(std::vector<std::string>::const_iterator li = libs.begin();
- li != libs.end(); ++li)
+ for(std::vector<std::string>::const_iterator li = entries.begin();
+ li != entries.end(); ++li)
{
// Separate this from the previous entry.
- link_libs += sep;
+ link_entries += sep;
sep = ";";
std::string temp = *li;
this->AddTargetNamespace(temp, target, missingTargets);
- link_libs += temp;
+ link_entries += temp;
}
// Store the property.
std::string prop = propName;
prop += suffix;
- properties[prop] = link_libs;
+ properties[prop] = link_entries;
}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 6fd23b0..1438f4d 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -82,7 +82,7 @@ protected:
std::vector<std::string>& missingTargets);
void SetImportLinkProperty(std::string const& suffix,
cmTarget* target, const char* propName,
- std::vector<std::string> const& libs,
+ std::vector<std::string> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 79e78df..73e9b31 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -114,13 +114,18 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
bool require2_8_12 = false;
- bool require2_8_13 = false;
+ bool require3_0_0 = false;
+ bool requiresConfigFiles = false;
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
cmTarget* te = (*tei)->Target;
+
+ requiresConfigFiles = requiresConfigFiles
+ || te->GetType() != cmTarget::INTERFACE_LIBRARY;
+
this->GenerateImportTargetCode(os, te);
ImportPropertyMap properties;
@@ -160,7 +165,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
{
- require2_8_13 = true;
+ require3_0_0 = true;
}
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
@@ -169,7 +174,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
- if (require2_8_13)
+ if (require3_0_0)
{
this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007");
}
@@ -197,15 +202,19 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
this->GenerateImportedFileCheckLoop(os);
- // Generate an import file for each configuration.
bool result = true;
- for(std::vector<std::string>::const_iterator
- ci = this->Configurations.begin();
- ci != this->Configurations.end(); ++ci)
+ // Generate an import file for each configuration.
+ // Don't do this if we only export INTERFACE_LIBRARY targets.
+ if (requiresConfigFiles)
{
- if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets))
+ for(std::vector<std::string>::const_iterator
+ ci = this->Configurations.begin();
+ ci != this->Configurations.end(); ++ci)
{
- result = false;
+ if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets))
+ {
+ result = false;
+ }
}
}
@@ -297,16 +306,14 @@ cmExportInstallFileGenerator
{
// Collect import properties for this target.
cmTargetExport const* te = *tei;
- ImportPropertyMap properties;
- std::set<std::string> importedLocations;
- if (!properties.empty()
- && te->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ if (te->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
- this->GenerateImportPropertyCode(os, config, te->Target, properties);
- this->GenerateImportedFileChecksCode(os, te->Target, properties,
- importedLocations);
continue;
}
+
+ ImportPropertyMap properties;
+ std::set<std::string> importedLocations;
+
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index 064ffa3..4624e92 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -55,11 +55,11 @@ void cmExportLibraryDependenciesCommand::FinalPass()
void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
// Use copy-if-different if not appending.
- cmsys::auto_ptr<std::ofstream> foutPtr;
+ cmsys::auto_ptr<cmsys::ofstream> foutPtr;
if(this->Append)
{
- cmsys::auto_ptr<std::ofstream> ap(
- new std::ofstream(this->Filename.c_str(), std::ios::app));
+ cmsys::auto_ptr<cmsys::ofstream> ap(
+ new cmsys::ofstream(this->Filename.c_str(), std::ios::app));
foutPtr = ap;
}
else
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index d9bc04c..8d37b62 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -36,6 +36,8 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(FIND_TARGETS)
+#undef FIND_TARGETS
+
this->PopulateProperties(te, properties, emittedDeps);
this->GenerateInterfaceProperties(te, os, properties);
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 755b445..c93187e 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -40,6 +40,7 @@ cmExtraEclipseCDT4Generator
this->SupportsVirtualFolders = true;
this->GenerateLinkedResources = true;
this->SupportsGmakeErrorParser = true;
+ this->SupportsMachO64Parser = true;
}
//----------------------------------------------------------------------------
@@ -93,6 +94,7 @@ void cmExtraEclipseCDT4Generator::Generate()
if (version < 3006) // 3.6 is Helios
{
this->SupportsVirtualFolders = false;
+ this->SupportsMachO64Parser = false;
}
if (version < 3007) // 3.7 is Indigo
{
@@ -754,7 +756,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
else if (systemName == "Darwin")
{
- fout << "<extension id=\"org.eclipse.cdt.core.MachO\""
+ fout << "<extension id=\"" <<
+ (this->SupportsMachO64Parser ? "org.eclipse.cdt.core.MachO64"
+ : "org.eclipse.cdt.core.MachO") << "\""
" point=\"org.eclipse.cdt.core.BinaryParser\">\n"
"<attribute key=\"c++filt\" value=\"c++filt\"/>\n"
"</extension>\n"
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 9c89f85..d88b247 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -115,6 +115,7 @@ private:
bool GenerateLinkedResources;
bool SupportsVirtualFolders;
bool SupportsGmakeErrorParser;
+ bool SupportsMachO64Parser;
};
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index f020ddb..0312488 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -52,6 +52,8 @@ void cmExtraKateGenerator::Generate()
this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(mf->GetHomeOutputDirectory()));
+ this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0);
+
this->CreateKateProjectFile(mf);
this->CreateDummyKateProjectFile(mf);
}
@@ -84,22 +86,33 @@ void
cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
cmGeneratedFileStream& fout) const
{
+ const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ const std::string makeArgs = mf->GetSafeDefinition(
+ "CMAKE_KATE_MAKE_ARGUMENTS");
+ const char* homeOutputDir = mf->GetHomeOutputDirectory();
+
fout <<
"\t\"build\": {\n"
"\t\t\"directory\": \"" << mf->GetHomeOutputDirectory() << "\",\n"
"\t\t\"default_target\": \"all\",\n"
- "\t\t\"prev_target\": \"all\",\n"
- "\t\t\"clean_target\": \"clean\",\n"
- "\t\t\"targets\":[\n";
+ "\t\t\"clean_target\": \"clean\",\n";
- const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
- const std::string makeArgs = mf->GetSafeDefinition(
- "CMAKE_KATE_MAKE_ARGUMENTS");
+ // build, clean and quick are for the build plugin kate <= 4.12:
+ fout << "\t\t\"build\": \"" << make << " -C " << homeOutputDir
+ << " " << makeArgs << " " << "all\",\n";
+ fout << "\t\t\"clean\": \"" << make << " -C " << homeOutputDir
+ << " " << makeArgs << " " << "clean\",\n";
+ fout << "\t\t\"quick\": \"" << make << " -C " << homeOutputDir
+ << " " << makeArgs << " " << "install\",\n";
+
+ // this is for kate >= 4.13:
+ fout <<
+ "\t\t\"targets\":[\n";
this->AppendTarget(fout, "all", make, makeArgs,
- mf->GetHomeOutputDirectory());
+ homeOutputDir, homeOutputDir);
this->AppendTarget(fout, "clean", make, makeArgs,
- mf->GetHomeOutputDirectory());
+ homeOutputDir, homeOutputDir);
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
@@ -143,7 +156,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
}
if (insertTarget)
{
- this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
+ this->AppendTarget(fout, ti->first, make, makeArgs,
+ currentDir, homeOutputDir);
}
}
break;
@@ -158,7 +172,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
break;
}
- this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
+ this->AppendTarget(fout, ti->first, make, makeArgs,
+ currentDir, homeOutputDir);
break;
case cmTarget::EXECUTABLE:
case cmTarget::STATIC_LIBRARY:
@@ -166,10 +181,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
case cmTarget::MODULE_LIBRARY:
case cmTarget::OBJECT_LIBRARY:
{
- this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
+ this->AppendTarget(fout, ti->first, make, makeArgs,
+ currentDir, homeOutputDir);
std::string fastTarget = ti->first;
fastTarget += "/fast";
- this->AppendTarget(fout, fastTarget, make, makeArgs, currentDir);
+ this->AppendTarget(fout, fastTarget, make, makeArgs,
+ currentDir, homeOutputDir);
}
break;
@@ -185,7 +202,7 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
fit != objectFileTargets.end();
++fit)
{
- this->AppendTarget(fout, *fit, make, makeArgs, currentDir);
+ this->AppendTarget(fout, *fit, make, makeArgs, currentDir,homeOutputDir);
}
}
@@ -199,14 +216,18 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& target,
const std::string& make,
const std::string& makeArgs,
- const std::string& path) const
+ const std::string& path,
+ const char* homeOutputDir
+ ) const
{
static char JsonSep = ' ';
fout <<
"\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", "
- "\"build_cmd\":\"" << make << " -C " << path << " " << makeArgs << " "
- << target << "\"}\n";
+ "\"build_cmd\":\"" << make
+ << " -C " << (this->UseNinja ? homeOutputDir : path.c_str())
+ << " " << makeArgs << " "
+ << target << "\"}\n";
JsonSep = ',';
}
@@ -226,7 +247,8 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const
return;
}
- fout << "#Generated by cmake, do not edit.\n";
+ fout << "#Generated by " << mf->GetRequiredDefinition("CMAKE_COMMAND")
+ << ", do not edit.\n";
}
@@ -326,47 +348,3 @@ std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const
return outputBasename;
}
-
-
-// Create the command line for building the given target using the selected
-// make
-std::string cmExtraKateGenerator::BuildMakeCommand(const std::string& make,
- const char* makefile, const char* target) const
-{
- std::string command = make;
- if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0)
- {
- std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
- command += " /NOLOGO /f &quot;";
- command += makefileName;
- command += "&quot; ";
- command += " VERBOSE=1 ";
- command += target;
- }
- else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
- {
- // no escaping of spaces in this case, see
- // http://public.kitware.com/Bug/view.php?id=10014
- std::string makefileName = makefile;
- command += " -f &quot;";
- command += makefileName;
- command += "&quot; ";
- command += " VERBOSE=1 ";
- command += target;
- }
- else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
- {
- command += " -v ";
- command += target;
- }
- else
- {
- std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
- command += " -f &quot;";
- command += makefileName;
- command += "&quot; ";
- command += " VERBOSE=1 ";
- command += target;
- }
- return command;
-}
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 4979eff..6ced5fe 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -46,17 +46,17 @@ private:
const std::string& target,
const std::string& make,
const std::string& makeArgs,
- const std::string& path) const;
+ const std::string& path,
+ const char* homeOutputDir) const;
std::string GenerateFilesString(const cmMakefile* mf) const;
std::string GetPathBasename(const std::string& path) const;
std::string GenerateProjectName(const std::string& name,
const std::string& type,
const std::string& path) const;
- std::string BuildMakeCommand(const std::string& make,
- const char* makefile, const char* target) const;
std::string ProjectName;
+ bool UseNinja;
};
#endif
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4446f72..311763b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -32,6 +32,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
// Table of permissions flags.
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -228,7 +229,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
}
// If GetPermissions fails, pretend like it is ok. File open will fail if
// the file is not writable
- std::ofstream file(fileName.c_str(), append?std::ios::app: std::ios::out);
+ cmsys::ofstream file(fileName.c_str(), append?std::ios::app: std::ios::out);
if ( !file )
{
std::string error = "Internal CMake error when trying to open file: ";
@@ -283,10 +284,10 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
// Open the specified file.
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream file(fileName.c_str(), std::ios::in |
+ cmsys::ifstream file(fileName.c_str(), std::ios::in |
(hexOutputArg.IsEnabled() ? std::ios::binary : std::ios::in));
#else
- std::ifstream file(fileName.c_str(), std::ios::in);
+ cmsys::ifstream file(fileName.c_str(), std::ios::in);
#endif
if ( !file )
@@ -577,9 +578,9 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// Open the specified file.
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary);
#else
- std::ifstream fin(fileName.c_str(), std::ios::in);
+ cmsys::ifstream fin(fileName.c_str(), std::ios::in);
#endif
if(!fin)
{
@@ -2490,7 +2491,7 @@ namespace {
void *data)
{
int realsize = (int)(size * nmemb);
- std::ofstream* fout = static_cast<std::ofstream*>(data);
+ cmsys::ofstream* fout = static_cast<cmsys::ofstream*>(data);
const char* chPtr = static_cast<char*>(ptr);
fout->write(chPtr, realsize);
return realsize;
@@ -2838,7 +2839,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
return false;
}
- std::ofstream fout(file.c_str(), std::ios::binary);
+ cmsys::ofstream fout(file.c_str(), std::ios::binary);
if(!fout)
{
this->SetError("DOWNLOAD cannot open file for write.");
@@ -3094,7 +3095,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
// Open file for reading:
//
- FILE *fin = fopen(filename.c_str(), "rb");
+ FILE *fin = cmsys::SystemTools::Fopen(filename.c_str(), "rb");
if(!fin)
{
std::string errStr = "UPLOAD cannot open file '";
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 55c20d6..c59aafd 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1151,8 +1151,8 @@ void cmFindPackageCommand::AddPrefixesSystemEnvironment()
std::string const& d = *i;
// If the path is a PREFIX/bin case then add its parent instead.
- if((d.size() >= 4 && strcmp(d.c_str()+d.size()-4, "/bin") == 0) ||
- (d.size() >= 5 && strcmp(d.c_str()+d.size()-5, "/sbin") == 0))
+ if((cmHasLiteralSuffix(d, "/bin")) ||
+ (cmHasLiteralSuffix(d, "/sbin")))
{
this->AddPathInternal(cmSystemTools::GetFilenamePath(d), EnvPath);
}
@@ -1334,7 +1334,7 @@ void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir)
cmFindPackageCommandHoldFile holdFile(fname.c_str());
// Load the file.
- std::ifstream fin(fname.c_str(), std::ios::in | cmsys_ios_binary);
+ cmsys::ifstream fin(fname.c_str(), std::ios::in | cmsys_ios_binary);
if(fin && this->CheckPackageRegistryEntry(fin))
{
// The file references an existing package, so release it.
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 0af0753..34efc15 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -213,7 +213,7 @@ int cmGeneratedFileStreamBase::CompressFile(const char* oldname,
{
return 0;
}
- FILE* ifs = fopen(oldname, "r");
+ FILE* ifs = cmsys::SystemTools::Fopen(oldname, "r");
if ( !ifs )
{
return 0;
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index dac9c7b..99f3b47 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -13,6 +13,7 @@
#define cmGeneratedFileStream_h
#include "cmStandardIncludes.h"
+#include <cmsys/FStream.hxx>
#if defined(__sgi) && !defined(__GNUC__)
# pragma set woff 1375 /* base class destructor not virtual */
@@ -77,10 +78,10 @@ protected:
* being updated.
*/
class cmGeneratedFileStream: private cmGeneratedFileStreamBase,
- public std::ofstream
+ public cmsys::ofstream
{
public:
- typedef std::ofstream Stream;
+ typedef cmsys::ofstream Stream;
/**
* This constructor prepares a default stream. The open method must
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 92f74f3..e7e1d34 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -31,7 +31,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
top = p;
p = p->Parent;
}
- this->CheckResult = this->checkGraph();
+ this->CheckResult = this->CheckGraph();
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) \
top->METHOD () ||
@@ -40,6 +40,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(TEST_TRANSITIVE_PROPERTY_METHOD)
false)
)
+#undef TEST_TRANSITIVE_PROPERTY_METHOD
{
std::map<cmStdString, std::set<cmStdString> >::const_iterator it
= top->Seen.find(target);
@@ -60,13 +61,13 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
//----------------------------------------------------------------------------
cmGeneratorExpressionDAGChecker::Result
-cmGeneratorExpressionDAGChecker::check() const
+cmGeneratorExpressionDAGChecker::Check() const
{
return this->CheckResult;
}
//----------------------------------------------------------------------------
-void cmGeneratorExpressionDAGChecker::reportError(
+void cmGeneratorExpressionDAGChecker::ReportError(
cmGeneratorExpressionContext *context,
const std::string &expr)
{
@@ -124,7 +125,7 @@ void cmGeneratorExpressionDAGChecker::reportError(
//----------------------------------------------------------------------------
cmGeneratorExpressionDAGChecker::Result
-cmGeneratorExpressionDAGChecker::checkGraph() const
+cmGeneratorExpressionDAGChecker::CheckGraph() const
{
const cmGeneratorExpressionDAGChecker *parent = this->Parent;
while (parent)
@@ -178,43 +179,37 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
|| strcmp(prop, "INTERFACE_LINK_LIBRARIES") == 0;
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories() const
-{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "INCLUDE_DIRECTORIES") == 0
- || strcmp(prop, "INTERFACE_INCLUDE_DIRECTORIES") == 0 );
-}
+enum TransitiveProperty {
+#define DEFINE_ENUM_ENTRY(NAME) NAME,
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(DEFINE_ENUM_ENTRY)
+#undef DEFINE_ENUM_ENTRY
+ TransitivePropertyTerminal
+};
-//----------------------------------------------------------------------------
-bool
-cmGeneratorExpressionDAGChecker::EvaluatingSystemIncludeDirectories() const
+template<TransitiveProperty>
+bool additionalTest(const char* const)
{
- const char *prop = this->Property.c_str();
- return strcmp(prop, "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES") == 0;
+ return false;
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingCompileDefinitions() const
+template<>
+bool additionalTest<COMPILE_DEFINITIONS>(const char* const prop)
{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "COMPILE_DEFINITIONS") == 0
- || strcmp(prop, "INTERFACE_COMPILE_DEFINITIONS") == 0
- || cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_"));
+ return cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_");
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingCompileOptions() const
-{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "COMPILE_OPTIONS") == 0
- || strcmp(prop, "INTERFACE_COMPILE_OPTIONS") == 0 );
+#define DEFINE_TRANSITIVE_PROPERTY_METHOD(METHOD, PROPERTY) \
+bool cmGeneratorExpressionDAGChecker::METHOD() const \
+{ \
+ const char* const prop = this->Property.c_str(); \
+ if (strcmp(prop, #PROPERTY) == 0 \
+ || strcmp(prop, "INTERFACE_" #PROPERTY) == 0) \
+ { \
+ return true; \
+ } \
+ return additionalTest<PROPERTY>(prop); \
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingAutoUicOptions() const
-{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "AUTOUIC_OPTIONS") == 0
- || strcmp(prop, "INTERFACE_AUTOUIC_OPTIONS") == 0 );
-}
+CM_FOR_EACH_TRANSITIVE_PROPERTY(DEFINE_TRANSITIVE_PROPERTY_METHOD)
+
+#undef DEFINE_TRANSITIVE_PROPERTY_METHOD
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index fd47ad7..b6effa1 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -16,19 +16,25 @@
#include "cmGeneratorExpressionEvaluator.h"
+#define CM_SELECT_BOTH(F, A1, A2) F(A1, A2)
+#define CM_SELECT_FIRST(F, A1, A2) F(A1)
+#define CM_SELECT_SECOND(F, A1, A2) F(A2)
+
+#define CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, SELECT) \
+ SELECT(F, EvaluatingIncludeDirectories, INCLUDE_DIRECTORIES) \
+ SELECT(F, EvaluatingSystemIncludeDirectories, SYSTEM_INCLUDE_DIRECTORIES) \
+ SELECT(F, EvaluatingCompileDefinitions, COMPILE_DEFINITIONS) \
+ SELECT(F, EvaluatingCompileOptions, COMPILE_OPTIONS) \
+ SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS)
+
+#define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH)
+
#define CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(F) \
- F(EvaluatingIncludeDirectories) \
- F(EvaluatingSystemIncludeDirectories) \
- F(EvaluatingCompileDefinitions) \
- F(EvaluatingCompileOptions) \
- F(EvaluatingAutoUicOptions)
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_FIRST)
#define CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(F) \
- F(INCLUDE_DIRECTORIES) \
- F(SYSTEM_INCLUDE_DIRECTORIES) \
- F(COMPILE_DEFINITIONS) \
- F(COMPILE_OPTIONS) \
- F(AUTOUIC_OPTIONS)
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_SECOND)
//----------------------------------------------------------------------------
struct cmGeneratorExpressionDAGChecker
@@ -46,9 +52,9 @@ struct cmGeneratorExpressionDAGChecker
ALREADY_SEEN
};
- Result check() const;
+ Result Check() const;
- void reportError(cmGeneratorExpressionContext *context,
+ void ReportError(cmGeneratorExpressionContext *context,
const std::string &expr);
bool EvaluatingLinkLibraries(const char *tgt = 0);
@@ -56,14 +62,16 @@ struct cmGeneratorExpressionDAGChecker
#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) \
bool METHOD () const;
-CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
+
+#undef DECLARE_TRANSITIVE_PROPERTY_METHOD
bool GetTransitivePropertiesOnly();
void SetTransitivePropertiesOnly()
{ this->TransitivePropertiesOnly = true; }
private:
- Result checkGraph() const;
+ Result CheckGraph() const;
private:
const cmGeneratorExpressionDAGChecker * const Parent;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index cab99ed..bf85870 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -13,6 +13,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmMakefile.h"
+#include <cmsys/FStream.hxx>
#include <assert.h>
@@ -78,7 +79,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const char *config,
this->Files.push_back(outputFileName);
outputFiles[outputFileName] = outputContent;
- std::ofstream fout(outputFileName.c_str());
+ cmsys::ofstream fout(outputFileName.c_str());
if(!fout)
{
@@ -103,7 +104,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
}
else
{
- std::ifstream fin(this->Input.c_str());
+ cmsys::ifstream fin(this->Input.c_str());
if(!fin)
{
cmOStringStream e;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 0f8c4e3..5edea86 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -19,6 +19,7 @@
#include <cmsys/String.h>
#include <assert.h>
+#include <errno.h>
//----------------------------------------------------------------------------
#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
@@ -48,7 +49,7 @@ struct cmGeneratorExpressionNode
enum {
DynamicParameters = 0,
OneOrMoreParameters = -1,
- ZeroOrMoreParameters = -2
+ OneOrZeroParameters = -2
};
virtual ~cmGeneratorExpressionNode() {}
@@ -82,7 +83,6 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
- // Unreachable
return std::string();
}
} zeroNode;
@@ -94,13 +94,12 @@ static const struct OneNode : public cmGeneratorExpressionNode
virtual bool AcceptsArbitraryContentParameter() const { return true; }
- std::string Evaluate(const std::vector<std::string> &,
+ std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
- // Unreachable
- return std::string();
+ return parameters.front();
}
} oneNode;
@@ -199,10 +198,98 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
} strEqualNode;
//----------------------------------------------------------------------------
+static const struct EqualNode : public cmGeneratorExpressionNode
+{
+ EqualNode() {}
+
+ virtual int NumExpectedParameters() const { return 2; }
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *content,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ char *pEnd;
+
+ int base = 0;
+ bool flipSign = false;
+
+ const char *lhs = parameters[0].c_str();
+ if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B"))
+ {
+ base = 2;
+ lhs += 2;
+ }
+ if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B"))
+ {
+ base = 2;
+ lhs += 3;
+ flipSign = true;
+ }
+ if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B"))
+ {
+ base = 2;
+ lhs += 3;
+ }
+
+ long lnum = strtol(lhs, &pEnd, base);
+ if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<EQUAL> parameter " + parameters[0] + " is not a valid integer.");
+ return std::string();
+ }
+
+ if (flipSign)
+ {
+ lnum = -lnum;
+ }
+
+ base = 0;
+ flipSign = false;
+
+ const char *rhs = parameters[1].c_str();
+ if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B"))
+ {
+ base = 2;
+ rhs += 2;
+ }
+ if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B"))
+ {
+ base = 2;
+ rhs += 3;
+ flipSign = true;
+ }
+ if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B"))
+ {
+ base = 2;
+ rhs += 3;
+ }
+
+ long rnum = strtol(rhs, &pEnd, base);
+ if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "$<EQUAL> parameter " + parameters[1] + " is not a valid integer.");
+ return std::string();
+ }
+
+ if (flipSign)
+ {
+ rnum = -rnum;
+ }
+
+ return lnum == rnum ? "1" : "0";
+ }
+} equalNode;
+
+//----------------------------------------------------------------------------
static const struct LowerCaseNode : public cmGeneratorExpressionNode
{
LowerCaseNode() {}
+ bool AcceptsArbitraryContentParameter() const { return true; }
+
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
@@ -217,6 +304,8 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode
{
UpperCaseNode() {}
+ bool AcceptsArbitraryContentParameter() const { return true; }
+
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
@@ -231,6 +320,8 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
{
MakeCIdentifierNode() {}
+ bool AcceptsArbitraryContentParameter() const { return true; }
+
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
@@ -293,7 +384,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
CompilerIdNode() {}
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string EvaluateWithLanguage(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
@@ -339,17 +430,12 @@ static const struct CCompilerIdNode : public CompilerIdNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<C_COMPILER_ID> expression requires one or two parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
"$<C_COMPILER_ID> may only be used with targets. It may not "
"be used with add_custom_command.");
+ return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "C");
@@ -366,17 +452,12 @@ static const struct CXXCompilerIdNode : public CompilerIdNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<CXX_COMPILER_ID> expression requires one or two parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
"$<CXX_COMPILER_ID> may only be used with targets. It may not "
"be used with add_custom_command.");
+ return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "CXX");
@@ -388,7 +469,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
{
CompilerVersionNode() {}
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string EvaluateWithLanguage(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
@@ -433,17 +514,12 @@ static const struct CCompilerVersionNode : public CompilerVersionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<C_COMPILER_VERSION> expression requires one or two parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
"$<C_COMPILER_VERSION> may only be used with targets. It may not "
"be used with add_custom_command.");
+ return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "C");
@@ -460,18 +536,12 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<CXX_COMPILER_VERSION> expression requires one or two "
- "parameters");
- return std::string();
- }
if (!context->HeadTarget)
{
reportError(context, content->GetOriginalExpression(),
"$<CXX_COMPILER_VERSION> may only be used with targets. It may "
"not be used with add_custom_command.");
+ return std::string();
}
return this->EvaluateWithLanguage(parameters, context, content,
dagChecker, "CXX");
@@ -484,7 +554,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
{
PlatformIdNode() {}
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
@@ -504,7 +574,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
return parameters.front().empty() ? "1" : "0";
}
- if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0)
+ if (strcmp(parameters.begin()->c_str(), platformId) == 0)
{
return "1";
}
@@ -606,13 +676,17 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
{
ConfigurationTestNode() {}
- virtual int NumExpectedParameters() const { return 1; }
+ virtual int NumExpectedParameters() const { return OneOrZeroParameters; }
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *) const
{
+ if (parameters.empty())
+ {
+ return configurationNode.Evaluate(parameters, context, content, 0);
+ }
cmsys::RegularExpression configValidator;
configValidator.compile("^[A-Za-z0-9_]*$");
if (!configValidator.find(parameters.begin()->c_str()))
@@ -702,6 +776,8 @@ static const char* targetPropertyTransitiveWhitelist[] = {
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_NAME)
};
+#undef TRANSITIVE_PROPERTY_NAME
+
std::string getLinkedTargetsContent(const std::vector<std::string> &libraries,
cmTarget const* target,
cmTarget const* headTarget,
@@ -885,10 +961,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
content,
dagCheckerParent);
- switch (dagChecker.check())
+ switch (dagChecker.Check())
{
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
- dagChecker.reportError(context, content->GetOriginalExpression());
+ dagChecker.ReportError(context, content->GetOriginalExpression());
return std::string();
case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
// No error. We just skip cyclic references.
@@ -929,6 +1005,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
ASSERT_TRANSITIVE_PROPERTY_METHOD)
false);
}
+#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
}
std::string linkedTargetsContent;
@@ -1484,6 +1561,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &targetSoNameFileDirNode;
else if (identifier == "STREQUAL")
return &strEqualNode;
+ else if (identifier == "EQUAL")
+ return &equalNode;
else if (identifier == "LOWER_CASE")
return &lowerCaseNode;
else if (identifier == "UPPER_CASE")
@@ -1634,14 +1713,6 @@ std::string GeneratorExpressionContent::Evaluate(
return std::string();
}
- if (node->NumExpectedParameters() == 1
- && node->AcceptsArbitraryContentParameter())
- {
- return this->ProcessArbitraryContent(node, identifier, context,
- dagChecker,
- this->ParamChildren.begin());
- }
-
std::vector<std::string> parameters;
this->EvaluateParameters(node, identifier, context, dagChecker, parameters);
if (context->HadError)
@@ -1669,33 +1740,35 @@ std::string GeneratorExpressionContent::EvaluateParameters(
pend = this->ParamChildren.end();
const bool acceptsArbitraryContent
= node->AcceptsArbitraryContentParameter();
- for ( ; pit != pend; ++pit)
+ int counter = 1;
+ for ( ; pit != pend; ++pit, ++counter)
{
- std::string parameter;
- std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
- pit->begin();
- const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end =
- pit->end();
- for ( ; it != end; ++it)
- {
- parameter += (*it)->Evaluate(context, dagChecker);
- if (context->HadError)
- {
- return std::string();
- }
- }
- parameters.push_back(parameter);
- if (acceptsArbitraryContent
- && parameters.size() == (unsigned int)numExpected - 1)
+ if (acceptsArbitraryContent && counter == numExpected)
{
- assert(pit != pend);
std::string lastParam = this->ProcessArbitraryContent(node, identifier,
context,
dagChecker,
- pit + 1);
+ pit);
parameters.push_back(lastParam);
return std::string();
}
+ else
+ {
+ std::string parameter;
+ std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it =
+ pit->begin();
+ const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end =
+ pit->end();
+ for ( ; it != end; ++it)
+ {
+ parameter += (*it)->Evaluate(context, dagChecker);
+ if (context->HadError)
+ {
+ return std::string();
+ }
+ }
+ parameters.push_back(parameter);
+ }
}
}
@@ -1731,6 +1804,12 @@ std::string GeneratorExpressionContent::EvaluateParameters(
reportError(context, this->GetOriginalExpression(), "$<" + identifier
+ "> expression requires at least one parameter.");
}
+ if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters
+ && parameters.size() > 1)
+ {
+ reportError(context, this->GetOriginalExpression(), "$<" + identifier
+ + "> expression requires one or zero parameters.");
+ }
return std::string();
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index fdd4e6d..6894cfc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -18,9 +18,12 @@
#include "cmSourceFile.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorExpressionDAGChecker.h"
+#include "cmComputeLinkInformation.h"
#include <queue>
+#include "assert.h"
+
//----------------------------------------------------------------------------
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
{
@@ -59,10 +62,50 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
return 0;
}
+static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name,
+ const char *config, cmTarget *headTarget,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ std::vector<std::string>& result)
+{
+ cmTarget* depTgt = mf->FindTargetToUse(name.c_str());
+
+ if (!depTgt)
+ {
+ return;
+ }
+
+ cmListFileBacktrace lfbt;
+
+ if (const char* dirs =
+ depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"))
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmSystemTools::ExpandListArgument(ge.Parse(dirs)
+ ->Evaluate(mf,
+ config, false, headTarget,
+ depTgt, dagChecker), result);
+ }
+ if (!depTgt->IsImported())
+ {
+ return;
+ }
+
+ if (const char* dirs =
+ depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES"))
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmSystemTools::ExpandListArgument(ge.Parse(dirs)
+ ->Evaluate(mf,
+ config, false, headTarget,
+ depTgt, dagChecker), result);
+ }
+}
+
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
const char *config) const
{
+ assert(this->GetType() != cmTarget::INTERFACE_LIBRARY);
std::string config_upper;
if(config && *config)
{
@@ -75,39 +118,81 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
if (iter == this->SystemIncludesCache.end())
{
+ cmTarget::LinkImplementation const* impl
+ = this->Target->GetLinkImplementation(config, this->Target);
+ if(!impl)
+ {
+ return false;
+ }
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+
std::vector<std::string> result;
for (std::set<cmStdString>::const_iterator
it = this->Target->GetSystemIncludeDirectories().begin();
it != this->Target->GetSystemIncludeDirectories().end(); ++it)
{
- cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
+ cmSystemTools::ExpandListArgument(ge.Parse(*it)
+ ->Evaluate(this->Makefile,
+ config, false, this->Target,
+ &dagChecker), result);
+ }
+
+ std::set<cmStdString> uniqueDeps;
+ for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
+ li != impl->Libraries.end(); ++li)
+ {
+ if (uniqueDeps.insert(*li).second)
+ {
+ cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str());
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+ if (!tgt)
+ {
+ continue;
+ }
- cmSystemTools::ExpandListArgument(ge.Parse(*it)
- ->Evaluate(this->Makefile,
- config, false, this->Target,
- &dagChecker), result);
+ handleSystemIncludesDep(this->Makefile, *li, config, this->Target,
+ &dagChecker, result);
+
+ std::vector<std::string> deps;
+ tgt->GetTransitivePropertyLinkLibraries(config, this->Target, deps);
+
+ for(std::vector<std::string>::const_iterator di = deps.begin();
+ di != deps.end(); ++di)
+ {
+ if (uniqueDeps.insert(*di).second)
+ {
+ handleSystemIncludesDep(this->Makefile, *di, config, this->Target,
+ &dagChecker, result);
+ }
+ }
+ }
}
+ std::set<cmStdString> unique;
for(std::vector<std::string>::iterator li = result.begin();
li != result.end(); ++li)
{
cmSystemTools::ConvertToUnixSlashes(*li);
+ unique.insert(*li);
+ }
+ result.clear();
+ for(std::set<cmStdString>::iterator li = unique.begin();
+ li != unique.end(); ++li)
+ {
+ result.push_back(*li);
}
IncludeCacheType::value_type entry(config_upper, result);
iter = this->SystemIncludesCache.insert(entry).first;
}
- if (std::find(iter->second.begin(),
- iter->second.end(), dir) != iter->second.end())
- {
- return true;
- }
- return false;
+ std::string dirString = dir;
+ return std::binary_search(iter->second.begin(), iter->second.end(),
+ dirString);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6aff5f0..8b760f1 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -104,7 +104,7 @@ struct cmStrictTargetComparison {
bool operator()(cmTarget const* t1, cmTarget const* t2) const;
};
-typedef std::map<cmTarget*,
+typedef std::map<cmTarget const*,
cmGeneratorTarget*,
cmStrictTargetComparison> cmGeneratorTargetsType;
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index faba7cd..a1454a3 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -298,7 +298,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
return this->StoreResult(target->GetName());
}
}
- return false;
+ return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
}
if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name.c_str()))
{
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index bd3db3e..70004ea 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -44,6 +44,8 @@ public:
*/
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
+
+ virtual bool AllowNotParallel() const { return false; }
};
#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index e6f3d94..82c9155 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -30,6 +30,7 @@
#include "cmExportBuildFileGenerator.h"
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include <cmsys/MD5.h>
@@ -187,6 +188,13 @@ void cmGlobalGenerator::AddBuildExportSet(cmExportBuildFileGenerator* gen)
this->BuildExportSets[gen->GetMainExportFileName()] = gen;
}
+void
+cmGlobalGenerator::AddBuildExportExportSet(cmExportBuildFileGenerator* gen)
+{
+ this->BuildExportSets[gen->GetMainExportFileName()] = gen;
+ this->BuildExportExportSets[gen->GetMainExportFileName()] = gen;
+}
+
bool cmGlobalGenerator::GenerateImportFile(const std::string &file)
{
std::map<std::string, cmExportBuildFileGenerator*>::iterator it
@@ -207,7 +215,12 @@ cmGlobalGenerator::IsExportedTargetsFile(const std::string &filename) const
{
const std::map<std::string, cmExportBuildFileGenerator*>::const_iterator it
= this->BuildExportSets.find(filename);
- return it != this->BuildExportSets.end();
+ if (it == this->BuildExportSets.end())
+ {
+ return false;
+ }
+ return this->BuildExportExportSets.find(filename)
+ == this->BuildExportExportSets.end();
}
// Find the make program for the generator, required for try compiles
@@ -950,7 +963,7 @@ void cmGlobalGenerator::ClearEnabledLanguages()
}
bool cmGlobalGenerator::IsDependedOn(const char* project,
- cmTarget* targetIn)
+ cmTarget const* targetIn)
{
// Get all local gens for this project
std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
@@ -1045,6 +1058,12 @@ cmGlobalGenerator::GetExportedTargetsFile(const std::string &filename) const
return it == this->BuildExportSets.end() ? 0 : it->second;
}
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target)
+{
+ this->CMP0042WarnTargets.insert(target);
+}
+
bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
{
// If the property is not enabled then okay.
@@ -1072,6 +1091,9 @@ void cmGlobalGenerator::Generate()
// Start with an empty vector:
this->FilesReplacedDuringGenerate.clear();
+ // clear targets to issue warning CMP0042 for
+ this->CMP0042WarnTargets.clear();
+
// Check whether this generator is allowed to run.
if(!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS())
{
@@ -1155,17 +1177,6 @@ void cmGlobalGenerator::Generate()
// it builds by default.
this->FillLocalGeneratorToTargetMap();
- for (i = 0; i < this->LocalGenerators.size(); ++i)
- {
- cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
- cmTargets* targets = &(mf->GetTargets());
- for ( cmTargets::iterator it = targets->begin();
- it != targets->end(); ++ it )
- {
- it->second.FinalizeSystemIncludeDirectories();
- }
- }
-
// Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -1203,6 +1214,25 @@ void cmGlobalGenerator::Generate()
this->ExtraGenerator->Generate();
}
+ if(!this->CMP0042WarnTargets.empty())
+ {
+ cmOStringStream w;
+ w <<
+ (this->GetCMakeInstance()->GetPolicies()->
+ GetPolicyWarning(cmPolicies::CMP0042)) << "\n";
+ w << "MACOSX_RPATH is not specified for"
+ " the following targets:\n";
+ for(std::set<std::string>::iterator
+ iter = this->CMP0042WarnTargets.begin();
+ iter != this->CMP0042WarnTargets.end();
+ ++iter)
+ {
+ w << " " << *iter << "\n";
+ }
+ this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
+ cmListFileBacktrace());
+ }
+
this->CMakeInstance->UpdateProgress("Generating done", -1);
}
@@ -1214,8 +1244,8 @@ bool cmGlobalGenerator::ComputeTargetDepends()
{
return false;
}
- std::vector<cmTarget*> const& targets = ctd.GetTargets();
- for(std::vector<cmTarget*>::const_iterator ti = targets.begin();
+ std::vector<cmTarget const*> const& targets = ctd.GetTargets();
+ for(std::vector<cmTarget const*>::const_iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
@@ -1278,7 +1308,7 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
cmQtAutoGenerators autogen;
if(autogen.InitializeAutogenTarget(&target))
{
- autogens.push_back(std::make_pair(autogen, &target));
+ autogens.push_back(AutogensType::value_type(autogen, &target));
}
}
}
@@ -1309,13 +1339,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
cmTarget* t = &ti->second;
+ t->AppendBuildInterfaceIncludes();
+
if (t->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
- t->AppendBuildInterfaceIncludes();
-
for (std::vector<cmValueWithOrigin>::const_iterator it
= noconfig_compile_definitions.begin();
it != noconfig_compile_definitions.end(); ++it)
@@ -1379,6 +1409,10 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects()
for(cmGeneratorTargetsType::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
+ if (ti->second->Target->IsImported())
+ {
+ continue;
+ }
cmGeneratorTarget* gt = ti->second;
gt->ClassifySources();
gt->LookupObjectLibraries();
@@ -1432,7 +1466,8 @@ void cmGlobalGenerator::ClearGeneratorMembers()
}
//----------------------------------------------------------------------------
-cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const
+cmGeneratorTarget*
+cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
{
cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
if(ti == this->GeneratorTargets.end())
@@ -1875,7 +1910,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
cmTarget& target)
{
- if(target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ if(target.GetType() == cmTarget::INTERFACE_LIBRARY
+ || target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
// This target is excluded from its directory.
return true;
@@ -1954,7 +1990,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
clg = clg->GetParent())
{
// This local generator includes the target.
- std::set<cmTarget*>& targetSet =
+ std::set<cmTarget const*>& targetSet =
this->LocalGeneratorToTargetMap[clg];
targetSet.insert(&target);
@@ -1965,7 +2001,8 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti)
{
- targetSet.insert(*ti);
+ cmTarget const* ttt = *ti;
+ targetSet.insert(ttt);
}
}
}
@@ -2478,7 +2515,7 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
//----------------------------------------------------------------------------
cmGlobalGenerator::TargetDependSet const&
-cmGlobalGenerator::GetTargetDirectDepends(cmTarget & target)
+cmGlobalGenerator::GetTargetDirectDepends(cmTarget const& target)
{
return this->TargetDependencies[&target];
}
@@ -2600,7 +2637,7 @@ bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target)
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddTargetDepends(cmTarget* target,
+void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
TargetDependSet& projectTargets)
{
// add the target itself
@@ -2611,7 +2648,7 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget* target,
TargetDependSet const& ts = this->GetTargetDirectDepends(*target);
for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i)
{
- cmTarget* dtarget = *i;
+ cmTarget const* dtarget = *i;
this->AddTargetDepends(dtarget, projectTargets);
}
}
@@ -2713,9 +2750,9 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile,
std::string const& home)
{
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary);
#else
- std::ifstream fin(pfile.c_str(), std::ios::in);
+ cmsys::ifstream fin(pfile.c_str(), std::ios::in);
#endif
if(!fin)
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index eb720a8..fc5cab9 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -218,7 +218,7 @@ public:
/** If check to see if the target is linked to by any other
target in the project */
- bool IsDependedOn(const char* project, cmTarget* target);
+ bool IsDependedOn(const char* project, cmTarget const* target);
///! Find a local generator by its startdirectory
cmLocalGenerator* FindLocalGenerator(const char* start_dir);
@@ -266,10 +266,10 @@ public:
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
- TargetDependSet const& GetTargetDirectDepends(cmTarget & target);
+ TargetDependSet const& GetTargetDirectDepends(cmTarget const& target);
/** Get per-target generator information. */
- cmGeneratorTarget* GetGeneratorTarget(cmTarget*) const;
+ cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;}
@@ -311,10 +311,13 @@ public:
std::map<std::string, cmExportBuildFileGenerator*>& GetBuildExportSets()
{return this->BuildExportSets;}
void AddBuildExportSet(cmExportBuildFileGenerator*);
+ void AddBuildExportExportSet(cmExportBuildFileGenerator*);
bool IsExportedTargetsFile(const std::string &filename) const;
bool GenerateImportFile(const std::string &file);
cmExportBuildFileGenerator*
GetExportedTargetsFile(const std::string &filename) const;
+ void AddCMP0042WarnTarget(const std::string& target);
+
protected:
typedef std::vector<cmLocalGenerator*> GeneratorVector;
// for a project collect all its targets by following depend
@@ -323,7 +326,8 @@ protected:
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
virtual bool IsRootOnlyTarget(cmTarget* target);
- void AddTargetDepends(cmTarget* target, TargetDependSet& projectTargets);
+ void AddTargetDepends(cmTarget const* target,
+ TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
void FillExtensionToLanguageMap(const char* l, cmMakefile* mf);
@@ -333,7 +337,8 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
bool CheckTargets();
- typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > AutogensType;
+ typedef std::vector<std::pair<cmQtAutoGenerators,
+ cmTarget const*> > AutogensType;
void CreateQtAutoGeneratorsTargets(AutogensType& autogens);
std::string SelectMakeProgram(const char* makeProgram,
@@ -362,7 +367,8 @@ protected:
cmLocalGenerator* CurrentLocalGenerator;
// map from project name to vector of local generators in that project
std::map<cmStdString, std::vector<cmLocalGenerator*> > ProjectMap;
- std::map<cmLocalGenerator*, std::set<cmTarget *> > LocalGeneratorToTargetMap;
+ std::map<cmLocalGenerator*, std::set<cmTarget const*> >
+ LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
std::set<cmStdString> InstallComponents;
@@ -370,6 +376,7 @@ protected:
// Sets of named target exports
cmExportSetMap ExportSets;
std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
+ std::map<std::string, cmExportBuildFileGenerator*> BuildExportExportSets;
// Manifest of all targets that will be built for each configuration.
// This is computed just before local generators generate.
@@ -420,7 +427,7 @@ private:
std::vector<std::string> FilesReplacedDuringGenerate;
// Store computed inter-target dependencies.
- typedef std::map<cmTarget *, TargetDependSet> TargetDependMap;
+ typedef std::map<cmTarget const*, TargetDependSet> TargetDependMap;
TargetDependMap TargetDependencies;
// Per-target generator information.
@@ -446,6 +453,9 @@ private:
// Set of binary directories on disk.
std::set<cmStdString> BinaryDirectories;
+
+ // track targets to issue CMP0042 warning for.
+ std::set<std::string> CMP0042WarnTargets;
};
#endif
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index ab7db51..61ff45b 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -21,6 +21,7 @@
#include <cmsys/SystemTools.hxx>
#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
//----------------------------------------------------------------------------
void cmGlobalKdevelopGenerator
@@ -189,7 +190,7 @@ bool cmGlobalKdevelopGenerator
//check if the output file already exists and read it
//insert all files which exist into the set of files
- std::ifstream oldFilelist(filename.c_str());
+ cmsys::ifstream oldFilelist(filename.c_str());
if (oldFilelist)
{
while (cmSystemTools::GetLineFromStream(oldFilelist, tmp))
@@ -310,7 +311,7 @@ void cmGlobalKdevelopGenerator
const std::string& fileToOpen,
const std::string& sessionFilename)
{
- std::ifstream oldProjectFile(filename.c_str());
+ cmsys::ifstream oldProjectFile(filename.c_str());
if (!oldProjectFile)
{
this->CreateNewProjectFile(outputDir, projectDir, filename,
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 539d2af..16f05e5 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -13,6 +13,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmake.h"
+#include <cmsys/FStream.hxx>
cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
{
@@ -27,7 +28,7 @@ cmGlobalMSYSMakefileGenerator::FindMinGW(std::string const& makeloc)
{
std::string fstab = makeloc;
fstab += "/../etc/fstab";
- std::ifstream fin(fstab.c_str());
+ cmsys::ifstream fin(fstab.c_str());
std::string path;
std::string mount;
std::string mingwBin;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 77571b2..4b92058 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -830,7 +830,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
void
cmGlobalNinjaGenerator
-::AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs)
+::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs)
{
const char* configName =
target->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE");
@@ -879,7 +879,7 @@ cmGlobalNinjaGenerator
void
cmGlobalNinjaGenerator
-::AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs)
+::AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs)
{
if (target->GetType() == cmTarget::GLOBAL_TARGET) {
// Global targets only depend on other utilities, which may not appear in
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 4fd0d5c..de38923 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -283,8 +283,8 @@ public:
ASD.insert(deps.begin(), deps.end());
}
- void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs);
- void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs);
+ void AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs);
+ void AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs);
void AddDependencyToAll(cmTarget* target);
void AddDependencyToAll(const std::string& input);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 6333873..622a7c5 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -480,7 +480,6 @@ cmGlobalUnixMakefileGenerator3
(l->second->GetType() == cmTarget::SHARED_LIBRARY) ||
(l->second->GetType() == cmTarget::MODULE_LIBRARY) ||
(l->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
- (l->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
(l->second->GetType() == cmTarget::UTILITY))
{
if(l->second->Target->IsImported())
@@ -658,7 +657,6 @@ cmGlobalUnixMakefileGenerator3
(t->second->GetType() == cmTarget::SHARED_LIBRARY) ||
(t->second->GetType() == cmTarget::MODULE_LIBRARY) ||
(t->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
- (t->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
(t->second->GetType() == cmTarget::UTILITY)))
{
// Add a rule to build the target by name.
@@ -680,10 +678,6 @@ cmGlobalUnixMakefileGenerator3
t->second->GetName(), depends, commands,
true);
- if (t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- continue;
- }
// Add a fast rule to build the target
std::string localName =
lg->GetRelativeTargetDirectory(*t->second->Target);
@@ -757,7 +751,6 @@ cmGlobalUnixMakefileGenerator3
|| (t->second->GetType() == cmTarget::SHARED_LIBRARY)
|| (t->second->GetType() == cmTarget::MODULE_LIBRARY)
|| (t->second->GetType() == cmTarget::OBJECT_LIBRARY)
- || (t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
|| (t->second->GetType() == cmTarget::UTILITY)))
{
std::string makefileName;
@@ -774,64 +767,53 @@ cmGlobalUnixMakefileGenerator3
<< localName << "\n\n";
commands.clear();
+ makeTargetName = localName;
+ makeTargetName += "/depend";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(),makeTargetName.c_str()));
- if(t->second->GetType() != cmTarget::INTERFACE_LIBRARY)
+ // add requires if we need it for this generator
+ if (needRequiresStep)
{
makeTargetName = localName;
- makeTargetName += "/depend";
+ makeTargetName += "/requires";
commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(),makeTargetName.c_str()));
+ }
+ makeTargetName = localName;
+ makeTargetName += "/build";
+ commands.push_back(lg->GetRecursiveMakeCall
+ (makefileName.c_str(),makeTargetName.c_str()));
- // add requires if we need it for this generator
- if (needRequiresStep)
- {
- makeTargetName = localName;
- makeTargetName += "/requires";
- commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(),makeTargetName.c_str()));
- }
- makeTargetName = localName;
- makeTargetName += "/build";
- commands.push_back(lg->GetRecursiveMakeCall
- (makefileName.c_str(),makeTargetName.c_str()));
-
- // Write the rule.
- localName += "/all";
- depends.clear();
+ // Write the rule.
+ localName += "/all";
+ depends.clear();
- std::string progressDir =
- lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
+ std::string progressDir =
+ lg->GetMakefile()->GetHomeOutputDirectory();
+ progressDir += cmake::GetCMakeFilesDirectory();
+ {
+ cmOStringStream progCmd;
+ progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
+ // all target counts
+ progCmd << lg->Convert(progressDir.c_str(),
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::SHELL);
+ progCmd << " ";
+ std::vector<unsigned long>& progFiles =
+ this->ProgressMap[t->second->Target].Marks;
+ for (std::vector<unsigned long>::iterator i = progFiles.begin();
+ i != progFiles.end(); ++i)
{
- cmOStringStream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
- // all target counts
- progCmd << lg->Convert(progressDir.c_str(),
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " ";
- std::vector<unsigned long>& progFiles =
- this->ProgressMap[t->second->Target].Marks;
- for (std::vector<unsigned long>::iterator i = progFiles.begin();
- i != progFiles.end(); ++i)
- {
- progCmd << " " << *i;
- }
- commands.push_back(progCmd.str());
+ progCmd << " " << *i;
}
- progressDir = "Built target ";
- progressDir += t->second->GetName();
- lg->AppendEcho(commands,progressDir.c_str());
- }
- else
- {
- depends.clear();
+ commands.push_back(progCmd.str());
}
+ progressDir = "Built target ";
+ progressDir += t->second->GetName();
+ lg->AppendEcho(commands,progressDir.c_str());
+
this->AppendGlobalTargetDepends(depends,*t->second->Target);
- if(depends.empty() && this->EmptyRuleHackDepends != "")
- {
- depends.push_back(this->EmptyRuleHackDepends);
- }
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
localName.c_str(), depends, commands, true);
@@ -847,7 +829,7 @@ cmGlobalUnixMakefileGenerator3
// Write the rule.
commands.clear();
- std::string progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
+ progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
progressDir += cmake::GetCMakeFilesDirectory();
{
@@ -859,7 +841,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
//
- std::set<cmTarget *> emitted;
+ std::set<cmTarget const*> emitted;
progCmd << " "
<< this->CountProgressMarksInTarget(t->second->Target, emitted);
commands.push_back(progCmd.str());
@@ -937,8 +919,8 @@ cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
size_t
cmGlobalUnixMakefileGenerator3
-::CountProgressMarksInTarget(cmTarget* target,
- std::set<cmTarget*>& emitted)
+::CountProgressMarksInTarget(cmTarget const* target,
+ std::set<cmTarget const*>& emitted)
{
size_t count = 0;
if(emitted.insert(target).second)
@@ -964,9 +946,10 @@ cmGlobalUnixMakefileGenerator3
::CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg)
{
size_t count = 0;
- std::set<cmTarget*> emitted;
- std::set<cmTarget*> const& targets = this->LocalGeneratorToTargetMap[lg];
- for(std::set<cmTarget*>::const_iterator t = targets.begin();
+ std::set<cmTarget const*> emitted;
+ std::set<cmTarget const*> const& targets
+ = this->LocalGeneratorToTargetMap[lg];
+ for(std::set<cmTarget const*>::const_iterator t = targets.begin();
t != targets.end(); ++t)
{
count += this->CountProgressMarksInTarget(*t, emitted);
@@ -987,7 +970,7 @@ cmGlobalUnixMakefileGenerator3::RecordTargetProgress(
//----------------------------------------------------------------------------
bool
cmGlobalUnixMakefileGenerator3::ProgressMapCompare
-::operator()(cmTarget* l, cmTarget* r) const
+::operator()(cmTarget const* l, cmTarget const* r) const
{
// Order by target name.
if(int c = strcmp(l->GetName(), r->GetName()))
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 284f5d1..00a86eb 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -125,6 +125,9 @@ public:
const std::string &workingDirectory,
const std::string &compileCommand);
+ /** Does the make tool tolerate .NOTPARALLEL? */
+ virtual bool AllowNotParallel() const { return true; }
+
protected:
void WriteMainMakefile2();
void WriteMainCMakefile();
@@ -181,13 +184,14 @@ protected:
std::vector<unsigned long> Marks;
void WriteProgressVariables(unsigned long total, unsigned long& current);
};
- struct ProgressMapCompare { bool operator()(cmTarget*,cmTarget*) const; };
- typedef std::map<cmTarget*, TargetProgress,
+ struct ProgressMapCompare { bool operator()(cmTarget const*,
+ cmTarget const*) const; };
+ typedef std::map<cmTarget const*, TargetProgress,
ProgressMapCompare> ProgressMapType;
ProgressMapType ProgressMap;
- size_t CountProgressMarksInTarget(cmTarget* target,
- std::set<cmTarget*>& emitted);
+ size_t CountProgressMarksInTarget(cmTarget const* target,
+ std::set<cmTarget const*>& emitted);
size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg);
cmGeneratedFileStream *CommandDatabase;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 614a79a..6c458c3 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmake.h"
#include "cmGeneratedFileStream.h"
+#include <cmsys/FStream.hxx>
// Utility function to make a valid VS6 *.dsp filename out
// of a CMake target name:
@@ -205,7 +206,7 @@ void cmGlobalVisualStudio6Generator
tt = orderedProjectTargets.begin();
tt != orderedProjectTargets.end(); ++tt)
{
- cmTarget* target = *tt;
+ cmTarget const* target = *tt;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -244,7 +245,7 @@ void cmGlobalVisualStudio6Generator
fname += "/";
fname += root->GetMakefile()->GetProjectName();
fname += ".dsw";
- std::ofstream fout(fname.c_str());
+ cmsys::ofstream fout(fname.c_str());
if(!fout)
{
cmSystemTools::Error("Error can not open DSW file for write: ",
@@ -271,7 +272,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
const char* dspname,
const char* dir,
- cmTarget& target)
+ cmTarget const& target)
{
fout << "#########################################################"
"######################\n\n";
@@ -364,7 +365,7 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout)
//----------------------------------------------------------------------------
std::string
-cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target)
+cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget const* target)
{
std::string pname = target->GetName();
pname += "_UTILITY";
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index cb6cb8b..5521410 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -99,12 +99,12 @@ private:
void WriteDSWFile(std::ostream& fout);
void WriteDSWHeader(std::ostream& fout);
void WriteProject(std::ostream& fout,
- const char* name, const char* path, cmTarget &t);
+ const char* name, const char* path, cmTarget const& t);
void WriteExternalProject(std::ostream& fout,
const char* name, const char* path,
const std::set<cmStdString>& dependencies);
void WriteDSWFooter(std::ostream& fout);
- virtual std::string WriteUtilityDepend(cmTarget* target);
+ virtual std::string WriteUtilityDepend(cmTarget const* target);
std::string MSDevCommand;
bool MSDevCommandInitialized;
std::string const& GetMSDevCommand();
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 61d3c4c..22e4f08 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -157,7 +157,7 @@ void
cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const char* dspname,
const char* dir,
- cmTarget& t)
+ cmTarget const& t)
{
// check to see if this is a fortran build
const char* ext = ".vcproj";
@@ -209,7 +209,7 @@ void
cmGlobalVisualStudio71Generator
::WriteProjectDepends(std::ostream& fout,
const char*,
- const char*, cmTarget& target)
+ const char*, cmTarget const& target)
{
VSDependSet const& depends = this->VSTargetDepends[&target];
for(VSDependSet::const_iterator di = depends.begin();
@@ -240,7 +240,7 @@ void cmGlobalVisualStudio71Generator
const std::set<cmStdString>& depends)
{
fout << "Project(\"{"
- << (typeGuid ? typeGuid : "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942")
+ << (typeGuid ? typeGuid : this->ExternalProjectType(location))
<< "}\") = \""
<< name << "\", \""
<< this->ConvertToSolutionPath(location) << "\", \"{"
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index e136db7..04e3a55 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -59,9 +59,11 @@ protected:
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProject(std::ostream& fout,
- const char* name, const char* path, cmTarget &t);
+ const char* name, const char* path,
+ cmTarget const& t);
virtual void WriteProjectDepends(std::ostream& fout,
- const char* name, const char* path, cmTarget &t);
+ const char* name, const char* path,
+ cmTarget const& t);
virtual void WriteProjectConfigurations(
std::ostream& fout, const char* name, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index a217d8c..bb63289 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -146,6 +146,41 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
}
//----------------------------------------------------------------------------
+const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
+ const char* location)
+{
+ std::string extension = cmSystemTools::GetFilenameLastExtension(location);
+ if (extension == ".vbproj")
+ {
+ return "F184B08F-C81C-45F6-A57F-5ABD9991F28F";
+ }
+ else if (extension == ".csproj")
+ {
+ return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
+ }
+ else if (extension == ".fsproj")
+ {
+ return "F2A71F9B-5D33-465A-A702-920D77279786";
+ }
+ else if (extension == ".vdproj")
+ {
+ return "54435603-DBB4-11D2-8724-00A0C9A8B90C";
+ }
+ else if (extension == ".dbproj")
+ {
+ return "C8D11400-126E-41CD-887F-60BD40844F9E";
+ }
+ else if (extension == ".wixproj")
+ {
+ return "930C7802-8A8C-48F9-8165-68863BCCD9DD";
+ }
+ else if (extension == ".pyproj")
+ {
+ return "888888A0-9F3D-457C-B088-3A5042F75D52";
+ }
+ return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942";
+}
+//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const char* makeProgram,
@@ -335,7 +370,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget* target = *tt;
+ cmTarget const* target = *tt;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -376,7 +411,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget* target = *tt;
+ cmTarget const* target = *tt;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -470,7 +505,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget* target = *tt;
+ cmTarget const* target = *tt;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -619,7 +654,7 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
// the libraries it uses are also done here
void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
const char* dspname,
- const char* dir, cmTarget& target)
+ const char* dir, cmTarget const& target)
{
// check to see if this is a fortran build
const char* ext = ".vcproj";
@@ -659,7 +694,7 @@ void
cmGlobalVisualStudio7Generator
::WriteProjectDepends(std::ostream& fout,
const char* dspname,
- const char*, cmTarget& target)
+ const char*, cmTarget const& target)
{
int depcount = 0;
std::string dspguid = this->GetGUID(dspname);
@@ -730,7 +765,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
std::string d = cmSystemTools::ConvertToOutputPath(location);
fout << "Project("
<< "\"{"
- << (typeGuid ? typeGuid : "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942")
+ << (typeGuid ? typeGuid : this->ExternalProjectType(location))
<< "}\") = \""
<< name << "\", \""
<< this->ConvertToSolutionPath(location) << "\", \"{"
@@ -819,7 +854,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout)
//----------------------------------------------------------------------------
std::string
-cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget* target)
+cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
{
std::string pname = target->GetName();
pname += "_UTILITY";
@@ -940,7 +975,7 @@ cmGlobalVisualStudio7Generator
std::set<std::string>
cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
- cmTarget* target)
+ cmTarget const* target)
{
std::set<std::string> activeConfigs;
// if it is a utilitiy target then only make it part of the
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 59e74ba..f69bd84 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -115,15 +115,19 @@ protected:
std::string const& GetDevEnvCommand();
virtual std::string FindDevEnvCommand();
+ static const char* ExternalProjectType(const char* location);
+
static cmIDEFlagTable const* GetExtraFlagTableVS7();
virtual void OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteProject(std::ostream& fout,
- const char* name, const char* path, cmTarget &t);
+ const char* name, const char* path,
+ cmTarget const& t);
virtual void WriteProjectDepends(std::ostream& fout,
- const char* name, const char* path, cmTarget &t);
+ const char* name, const char* path,
+ cmTarget const&t);
virtual void WriteProjectConfigurations(
std::ostream& fout, const char* name, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
@@ -132,7 +136,7 @@ protected:
cmLocalGenerator* root);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
- virtual std::string WriteUtilityDepend(cmTarget* target);
+ virtual std::string WriteUtilityDepend(cmTarget const* target);
virtual void WriteTargetsToSolution(
std::ostream& fout,
@@ -158,7 +162,7 @@ protected:
std::string ConvertToSolutionPath(const char* path);
std::set<std::string> IsPartOfDefaultBuild(const char* project,
- cmTarget* target);
+ cmTarget const* target);
std::vector<std::string> Configurations;
std::map<cmStdString, cmStdString> GUIDMap;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index e4ce13f..12c240b 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -415,7 +415,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
- std::ostream& fout, const char*, const char*, cmTarget& t)
+ std::ostream& fout, const char*, const char*, cmTarget const& t)
{
TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
OrderedTargetDependSet depends(unordered);
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index ad01a24..5b952c4 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -84,7 +84,7 @@ protected:
const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
virtual void WriteProjectDepends(std::ostream& fout, const char* name,
- const char* path, cmTarget &t);
+ const char* path, cmTarget const& t);
std::string Name;
std::string WindowsCEVersion;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6c782e4..93a597c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -315,7 +315,7 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
}
//----------------------------------------------------------------------------
-void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget* target,
+void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target,
TargetSet& linked)
{
if(linked.insert(target).second)
@@ -348,7 +348,7 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target)
//----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::FollowLinkDepends(
- cmTarget* target, std::set<cmTarget*>& linked)
+ cmTarget const* target, std::set<cmTarget const*>& linked)
{
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
@@ -397,7 +397,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
}
//----------------------------------------------------------------------------
-static bool VSLinkable(cmTarget* t)
+static bool VSLinkable(cmTarget const* t)
{
return t->IsLinkable() || t->GetType() == cmTarget::OBJECT_LIBRARY;
}
@@ -439,7 +439,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
// Collect implicit link dependencies (target_link_libraries).
// Static libraries cannot depend on their link implementation
// due to behavior (2), but they do not really need to.
- std::set<cmTarget*> linkDepends;
+ std::set<cmTarget const*> linkDepends;
if(target.GetType() != cmTarget::STATIC_LIBRARY)
{
for(TargetDependSet::const_iterator di = depends.begin();
@@ -454,7 +454,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
}
// Collect explicit util dependencies (add_dependencies).
- std::set<cmTarget*> utilDepends;
+ std::set<cmTarget const*> utilDepends;
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
@@ -474,18 +474,18 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
}
// Emit link dependencies.
- for(std::set<cmTarget*>::iterator di = linkDepends.begin();
+ for(std::set<cmTarget const*>::iterator di = linkDepends.begin();
di != linkDepends.end(); ++di)
{
- cmTarget* dep = *di;
+ cmTarget const* dep = *di;
vsTargetDepend.insert(dep->GetName());
}
// Emit util dependencies. Possibly use intermediate targets.
- for(std::set<cmTarget*>::iterator di = utilDepends.begin();
+ for(std::set<cmTarget const*>::iterator di = utilDepends.begin();
di != utilDepends.end(); ++di)
{
- cmTarget* dep = *di;
+ cmTarget const* dep = *di;
if(allowLinkable || !VSLinkable(dep) || linked.count(dep))
{
// Direct dependency allowed.
@@ -523,7 +523,8 @@ void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
}
//----------------------------------------------------------------------------
-std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target)
+std::string
+cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target)
{
UtilityDependsMap::iterator i = this->UtilityDepends.find(target);
if(i == this->UtilityDepends.end())
@@ -845,7 +846,8 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
}
}
}
-bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget& target)
+bool
+cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
{
// check to see if this is a fortran build
std::set<cmStdString> languages;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index da2d021..54e3c28 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -60,7 +60,7 @@ public:
const char* vsSolutionFile = 0);
// return true if target is fortran only
- bool TargetIsFortranOnly(cmTarget& t);
+ bool TargetIsFortranOnly(cmTarget const& t);
/** Get the top-level registry key for this VS version. */
std::string GetRegistryBase();
@@ -75,7 +75,7 @@ public:
/** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { return false; }
- class TargetSet: public std::set<cmTarget*> {};
+ class TargetSet: public std::set<cmTarget const*> {};
struct TargetCompare
{
bool operator()(cmTarget const* l, cmTarget const* r) const;
@@ -96,15 +96,15 @@ protected:
virtual bool ComputeTargetDepends();
class VSDependSet: public std::set<cmStdString> {};
- class VSDependMap: public std::map<cmTarget*, VSDependSet> {};
+ class VSDependMap: public std::map<cmTarget const*, VSDependSet> {};
VSDependMap VSTargetDepends;
void ComputeVSTargetDepends(cmTarget&);
bool CheckTargetLinks(cmTarget& target, const char* name);
std::string GetUtilityForTarget(cmTarget& target, const char*);
- virtual std::string WriteUtilityDepend(cmTarget*) = 0;
- std::string GetUtilityDepend(cmTarget* target);
- typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
+ virtual std::string WriteUtilityDepend(cmTarget const*) = 0;
+ std::string GetUtilityDepend(cmTarget const* target);
+ typedef std::map<cmTarget const*, cmStdString> UtilityDependsMap;
UtilityDependsMap UtilityDepends;
const char* AdditionalPlatformDefinition;
@@ -113,11 +113,12 @@ private:
void PrintCompilerAdvice(std::ostream&, std::string, const char*) {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
- void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked);
+ void FollowLinkDepends(cmTarget const* target,
+ std::set<cmTarget const*>& linked);
class TargetSetMap: public std::map<cmTarget*, TargetSet> {};
TargetSetMap TargetLinkClosure;
- void FillLinkClosure(cmTarget* target, TargetSet& linked);
+ void FillLinkClosure(cmTarget const* target, TargetSet& linked);
TargetSet const& GetTargetLinkClosure(cmTarget* target);
};
diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h
index 23e60a1..d5350ef 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.h
+++ b/Source/cmGlobalWatcomWMakeGenerator.h
@@ -43,6 +43,8 @@ public:
*/
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
+
+ virtual bool AllowNotParallel() const { return false; }
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 215d483..eef49db 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -488,7 +488,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
dir.c_str());
}
- if(!target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ if(target.GetType() != cmTarget::INTERFACE_LIBRARY
+ && !target.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
allbuild->AddUtility(target.GetName());
}
@@ -875,7 +876,10 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
else
{
std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, lang);
- fileRef->AddAttribute("explicitFileType",
+ const char* attribute = (sourcecode == "file.storyboard") ?
+ "lastKnownFileType" :
+ "explicitFileType";
+ fileRef->AddAttribute(attribute,
this->CreateString(sourcecode.c_str()));
}
@@ -2622,7 +2626,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
}
//----------------------------------------------------------------------------
-cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget* t)
+cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t)
{
if(!t)
{
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index e8cbd14..6281c3b 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -125,7 +125,7 @@ private:
multipleOutputPairs
);
- cmXCodeObject* FindXCodeTarget(cmTarget*);
+ cmXCodeObject* FindXCodeTarget(cmTarget const*);
std::string GetOrCreateId(const char* name, const char* id);
// create cmXCodeObject from these functions so that memory can be managed
diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx
index a540825..6ea597e 100644
--- a/Source/cmHexFileConverter.cxx
+++ b/Source/cmHexFileConverter.cxx
@@ -166,7 +166,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
const char* inFileName)
{
char buf[1024];
- FILE* inFile = fopen(inFileName, "rb");
+ FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
if (inFile == 0)
{
return Binary;
@@ -223,8 +223,8 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
}
// try to open the file
- FILE* inFile = fopen(inFileName, "rb");
- FILE* outFile = fopen(outFileName, "wb");
+ FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb");
+ FILE* outFile = cmsys::SystemTools::Fopen(outFileName, "wb");
if ((inFile == 0) || (outFile == 0))
{
if (inFile != 0)
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index 30c1743..e20fe02 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -55,7 +55,7 @@ bool cmIncludeDirectoryCommand
std::vector<std::string> includes;
- GetIncludes(*i, includes);
+ this->GetIncludes(*i, includes);
if (before)
{
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7b9109e..68f45a6 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -328,9 +328,10 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const
}
//----------------------------------------------------------------------------
-std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target,
- const char* config,
- NameType nameType)
+std::string
+cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
+ const char* config,
+ NameType nameType)
{
std::string fname;
// Compute the name of the library.
@@ -515,11 +516,12 @@ cmInstallTargetGenerator
std::map<cmStdString, cmStdString> install_name_remap;
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
{
- std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked();
- for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin();
+ std::set<cmTarget const*> const& sharedLibs
+ = cli->GetSharedLibrariesLinked();
+ for(std::set<cmTarget const*>::const_iterator j = sharedLibs.begin();
j != sharedLibs.end(); ++j)
{
- cmTarget* tgt = *j;
+ cmTarget const* tgt = *j;
// The install_name of an imported target does not change.
if(tgt->IsImported())
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 8cf72f9..18c3957 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -53,7 +53,8 @@ public:
NameReal
};
- static std::string GetInstallFilename(cmTarget*target, const char* config,
+ static std::string GetInstallFilename(cmTarget const* target,
+ const char* config,
NameType nameType = NameNormal);
cmTarget* GetTarget() const { return this->Target; }
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index be27884..bfa388e 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -569,6 +569,9 @@ Modify cmListFileLexer.c:
*/
#include "cmStandardLexer.h"
+#ifdef WIN32
+#include <cmsys/Encoding.h>
+#endif
/* Setup the proper cmListFileLexer_yylex declaration. */
#define YY_EXTRA_TYPE cmListFileLexer*
@@ -612,7 +615,7 @@ static void cmListFileLexerDestroy(cmListFileLexer* lexer);
-#line 618 "cmListFileLexer.c"
+#line 621 "cmListFileLexer.c"
#define INITIAL 0
#define STRING 1
@@ -844,10 +847,10 @@ YY_DECL
int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 88 "cmListFileLexer.in.l"
+#line 91 "cmListFileLexer.in.l"
-#line 855 "cmListFileLexer.c"
+#line 858 "cmListFileLexer.c"
if ( !yyg->yy_init )
{
@@ -945,7 +948,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
-#line 90 "cmListFileLexer.in.l"
+#line 93 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Newline;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -957,7 +960,7 @@ YY_RULE_SETUP
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
-#line 99 "cmListFileLexer.in.l"
+#line 102 "cmListFileLexer.in.l"
{
const char* bracket = yytext;
lexer->comment = yytext[0] == '#';
@@ -986,7 +989,7 @@ YY_RULE_SETUP
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 125 "cmListFileLexer.in.l"
+#line 128 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(COMMENT);
@@ -994,14 +997,14 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 130 "cmListFileLexer.in.l"
+#line 133 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
}
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 134 "cmListFileLexer.in.l"
+#line 137 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenLeft;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1010,7 +1013,7 @@ YY_RULE_SETUP
}
case 6:
YY_RULE_SETUP
-#line 141 "cmListFileLexer.in.l"
+#line 144 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ParenRight;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1019,7 +1022,7 @@ YY_RULE_SETUP
}
case 7:
YY_RULE_SETUP
-#line 148 "cmListFileLexer.in.l"
+#line 151 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Identifier;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1028,7 +1031,7 @@ YY_RULE_SETUP
}
case 8:
YY_RULE_SETUP
-#line 155 "cmListFileLexer.in.l"
+#line 158 "cmListFileLexer.in.l"
{
/* Handle ]]====]=======]*/
cmListFileLexerAppend(lexer, yytext, yyleng);
@@ -1041,7 +1044,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 165 "cmListFileLexer.in.l"
+#line 168 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
/* Erase the partial bracket from the token. */
@@ -1052,7 +1055,7 @@ YY_RULE_SETUP
}
case 10:
YY_RULE_SETUP
-#line 174 "cmListFileLexer.in.l"
+#line 177 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
@@ -1061,7 +1064,7 @@ YY_RULE_SETUP
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 179 "cmListFileLexer.in.l"
+#line 182 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
@@ -1071,7 +1074,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 186 "cmListFileLexer.in.l"
+#line 189 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
@@ -1080,7 +1083,7 @@ YY_RULE_SETUP
YY_BREAK
case YY_STATE_EOF(BRACKET):
case YY_STATE_EOF(BRACKETEND):
-#line 192 "cmListFileLexer.in.l"
+#line 195 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadBracket;
BEGIN(INITIAL);
@@ -1088,7 +1091,7 @@ case YY_STATE_EOF(BRACKETEND):
}
case 13:
YY_RULE_SETUP
-#line 198 "cmListFileLexer.in.l"
+#line 201 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1097,7 +1100,7 @@ YY_RULE_SETUP
}
case 14:
YY_RULE_SETUP
-#line 205 "cmListFileLexer.in.l"
+#line 208 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1106,7 +1109,7 @@ YY_RULE_SETUP
}
case 15:
YY_RULE_SETUP
-#line 212 "cmListFileLexer.in.l"
+#line 215 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
cmListFileLexerSetToken(lexer, "", 0);
@@ -1116,7 +1119,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 219 "cmListFileLexer.in.l"
+#line 222 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
@@ -1125,7 +1128,7 @@ YY_RULE_SETUP
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
-#line 224 "cmListFileLexer.in.l"
+#line 227 "cmListFileLexer.in.l"
{
/* Continuation: text is not part of string */
++lexer->line;
@@ -1135,7 +1138,7 @@ YY_RULE_SETUP
case 18:
/* rule 18 can match eol */
YY_RULE_SETUP
-#line 230 "cmListFileLexer.in.l"
+#line 233 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
++lexer->line;
@@ -1144,7 +1147,7 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 236 "cmListFileLexer.in.l"
+#line 239 "cmListFileLexer.in.l"
{
lexer->column += yyleng;
BEGIN(INITIAL);
@@ -1152,14 +1155,14 @@ YY_RULE_SETUP
}
case 20:
YY_RULE_SETUP
-#line 242 "cmListFileLexer.in.l"
+#line 245 "cmListFileLexer.in.l"
{
cmListFileLexerAppend(lexer, yytext, yyleng);
lexer->column += yyleng;
}
YY_BREAK
case YY_STATE_EOF(STRING):
-#line 247 "cmListFileLexer.in.l"
+#line 250 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadString;
BEGIN(INITIAL);
@@ -1167,7 +1170,7 @@ case YY_STATE_EOF(STRING):
}
case 21:
YY_RULE_SETUP
-#line 253 "cmListFileLexer.in.l"
+#line 256 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_Space;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1176,7 +1179,7 @@ YY_RULE_SETUP
}
case 22:
YY_RULE_SETUP
-#line 260 "cmListFileLexer.in.l"
+#line 263 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_BadCharacter;
cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1185,7 +1188,7 @@ YY_RULE_SETUP
}
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT):
-#line 267 "cmListFileLexer.in.l"
+#line 270 "cmListFileLexer.in.l"
{
lexer->token.type = cmListFileLexer_Token_None;
cmListFileLexerSetToken(lexer, 0, 0);
@@ -1193,10 +1196,10 @@ case YY_STATE_EOF(COMMENT):
}
case 23:
YY_RULE_SETUP
-#line 273 "cmListFileLexer.in.l"
+#line 276 "cmListFileLexer.in.l"
ECHO;
YY_BREAK
-#line 1217 "cmListFileLexer.c"
+#line 1220 "cmListFileLexer.c"
case YY_END_OF_BUFFER:
{
@@ -2317,7 +2320,7 @@ void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 273 "cmListFileLexer.in.l"
+#line 276 "cmListFileLexer.in.l"
@@ -2542,7 +2545,13 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
cmListFileLexerDestroy(lexer);
if(name)
{
+#ifdef _WIN32
+ wchar_t* wname = cmsysEncoding_DupToWide(name);
+ lexer->file = _wfopen(wname, L"rb");
+ free(wname);
+#else
lexer->file = fopen(name, "rb");
+#endif
if(lexer->file)
{
if(bom)
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index d45a8ea..ed4bf6b 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -31,6 +31,9 @@ Modify cmListFileLexer.c:
*/
#include "cmStandardLexer.h"
+#ifdef WIN32
+#include <cmsys/Encoding.h>
+#endif
/* Setup the proper cmListFileLexer_yylex declaration. */
#define YY_EXTRA_TYPE cmListFileLexer*
@@ -493,7 +496,13 @@ int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
cmListFileLexerDestroy(lexer);
if(name)
{
+#ifdef _WIN32
+ wchar_t* wname = cmsysEncoding_DupToWide(name);
+ lexer->file = _wfopen(wname, L"rb");
+ free(wname);
+#else
lexer->file = fopen(name, "rb");
+#endif
if(lexer->file)
{
if(bom)
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 462e086..dfd98fa 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -12,6 +12,7 @@
#include "cmLoadCacheCommand.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
// cmLoadCacheCommand
bool cmLoadCacheCommand
@@ -115,7 +116,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
}
// Read the cache file.
- std::ifstream fin(cacheFile.c_str());
+ cmsys::ifstream fin(cacheFile.c_str());
// This is a big hack read loop to overcome a buggy ifstream
// implementation on HP-UX. This should work on all platforms even
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c3c5299..455f542 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -261,6 +261,10 @@ void cmLocalGenerator::TraceDependencies()
for(cmGeneratorTargetsType::iterator t = targets.begin();
t != targets.end(); ++t)
{
+ if (t->second->Target->IsImported())
+ {
+ continue;
+ }
t->second->TraceDependencies();
}
}
@@ -545,6 +549,10 @@ void cmLocalGenerator::GenerateTargetManifest()
{
continue;
}
+ if (target.Target->IsImported())
+ {
+ continue;
+ }
if(configNames.empty())
{
target.GenerateTargetManifest(0);
@@ -1386,7 +1394,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
- cmTarget* target,
+ cmTarget const* target,
const char* config)
{
std::vector<std::string> targetDefines;
@@ -1469,27 +1477,6 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
includeBinaryDir = true;
}
- // Hack for VTK 4.0 - 4.4 which depend on the old behavior but do
- // not set the backwards compatibility level automatically.
- const char* vtkSourceDir =
- this->Makefile->GetDefinition("VTK_SOURCE_DIR");
- if(vtkSourceDir)
- {
- const char* vtk_major =
- this->Makefile->GetDefinition("VTK_MAJOR_VERSION");
- const char* vtk_minor =
- this->Makefile->GetDefinition("VTK_MINOR_VERSION");
- vtk_major = vtk_major? vtk_major : "4";
- vtk_minor = vtk_minor? vtk_minor : "4";
- int vmajor = 0;
- int vminor = 0;
- if(sscanf(vtk_major, "%d", &vmajor) &&
- sscanf(vtk_minor, "%d", &vminor) && vmajor == 4 && vminor <= 4)
- {
- includeSourceDir = true;
- }
- }
-
// Do not repeat an include path.
std::set<cmStdString> emitted;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 9a89f0f..ad662d5 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -224,8 +224,9 @@ public:
bool stripImplicitInclDirs = true);
void AddCompileOptions(std::string& flags, cmTarget* target,
const char* lang, const char* config);
- void AddCompileDefinitions(std::set<std::string>& defines, cmTarget* target,
- const char* config);
+ void AddCompileDefinitions(std::set<std::string>& defines,
+ cmTarget const* target,
+ const char* config);
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 6ca386c..93722d1 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -388,7 +388,6 @@ void cmLocalUnixMakefileGenerator3
(t->second->GetType() == cmTarget::SHARED_LIBRARY) ||
(t->second->GetType() == cmTarget::MODULE_LIBRARY) ||
(t->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
- (t->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
(t->second->GetType() == cmTarget::UTILITY))
{
if (t->second->Target->IsImported())
@@ -1173,7 +1172,7 @@ cmLocalUnixMakefileGenerator3
}
cleanfile += ".cmake";
std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL);
- std::ofstream fout(cleanfilePath.c_str());
+ cmsys::ofstream fout(cleanfilePath.c_str());
if(!fout)
{
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
@@ -1686,6 +1685,17 @@ void cmLocalUnixMakefileGenerator3
"default_target",
depends,
no_commands, true);
+
+ // Help out users that try "gmake target1 target2 -j".
+ cmGlobalUnixMakefileGenerator3* gg =
+ static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
+ if(gg->AllowNotParallel())
+ {
+ std::vector<std::string> no_depends;
+ this->WriteMakeRule(ruleFileStream,
+ "Allow only one \"make -f Makefile2\" at a time, but pass parallelism.",
+ ".NOTPARALLEL", no_depends, no_commands, true);
+ }
}
this->WriteSpecialTargetsTop(ruleFileStream);
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index a665b93..8eeb89a 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -21,6 +21,7 @@
#include "cmComputeLinkInformation.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator::cmLocalVisualStudio6Generator():
cmLocalVisualStudioGenerator(VS6)
@@ -200,7 +201,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname,
// save the name of the real dsp file
std::string realDSP = fname;
fname += ".cmake";
- std::ofstream fout(fname.c_str());
+ cmsys::ofstream fout(fname.c_str());
if(!fout)
{
cmSystemTools::Error("Error Writing ", fname.c_str());
@@ -336,11 +337,11 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
std::string path = cmSystemTools::GetFilenamePath(source);
cmSystemTools::MakeDirectory(path.c_str());
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ofstream sourceFout(source.c_str(),
+ cmsys::ofstream sourceFout(source.c_str(),
std::ios::binary | std::ios::out
| std::ios::trunc);
#else
- std::ofstream sourceFout(source.c_str(),
+ cmsys::ofstream sourceFout(source.c_str(),
std::ios::out | std::ios::trunc);
#endif
if(sourceFout)
@@ -758,7 +759,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
// once the build type is set, determine what configurations are
// possible
- std::ifstream fin(this->DSPHeaderTemplate.c_str());
+ cmsys::ifstream fin(this->DSPHeaderTemplate.c_str());
cmsys::RegularExpression reg("# Name ");
if(!fin)
@@ -1452,7 +1453,7 @@ void cmLocalVisualStudio6Generator
std::string customRuleCodeRelWithDebInfo
= this->CreateTargetRules(target, "RELWITHDEBINFO", libName);
- std::ifstream fin(this->DSPHeaderTemplate.c_str());
+ cmsys::ifstream fin(this->DSPHeaderTemplate.c_str());
if(!fin)
{
cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str());
@@ -1785,7 +1786,7 @@ void cmLocalVisualStudio6Generator
void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout)
{
- std::ifstream fin(this->DSPFooterTemplate.c_str());
+ cmsys::ifstream fin(this->DSPFooterTemplate.c_str());
if(!fin)
{
cmSystemTools::Error("Error Reading ",
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 14832e5..b645f8f 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -205,7 +205,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
cmSystemTools::MakeDirectory(stampName.c_str());
stampName += "/";
stampName += "generate.stamp";
- std::ofstream stamp(stampName.c_str());
+ cmsys::ofstream stamp(stampName.c_str());
stamp << "# CMake generation timestamp file for this directory.\n";
// Create a helper file so CMake can determine when it is run
@@ -216,7 +216,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
// the stamp file can just be touched.
std::string depName = stampName;
depName += ".depend";
- std::ofstream depFile(depName.c_str());
+ cmsys::ofstream depFile(depName.c_str());
depFile << "# CMake generation dependency list for this directory.\n";
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
for(std::vector<std::string>::const_iterator lf = listFiles.begin();
@@ -1826,7 +1826,7 @@ WriteCustomRule(std::ostream& fout,
// make sure the rule runs reliably.
if(!cmSystemTools::FileExists(source))
{
- std::ofstream depout(source);
+ cmsys::ofstream depout(source);
depout << "Artificial dependency for a custom command.\n";
}
fout << this->ConvertToXMLOutputPath(source);
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 7c5f69d..a9a27b9 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmLocalXCodeGenerator.h"
#include "cmGlobalXCodeGenerator.h"
#include "cmSourceFile.h"
+#include "cmMakefile.h"
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator()
@@ -42,3 +43,31 @@ void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags,
static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator);
gg->AppendFlag(flags, rawFlag);
}
+
+//----------------------------------------------------------------------------
+void cmLocalXCodeGenerator::Generate()
+{
+ cmLocalGenerator::Generate();
+
+ cmTargets& targets = this->Makefile->GetTargets();
+ for(cmTargets::iterator iter = targets.begin();
+ iter != targets.end(); ++iter)
+ {
+ cmTarget* t = &iter->second;
+ t->HasMacOSXRpathInstallNameDir(NULL);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalXCodeGenerator::GenerateInstallRules()
+{
+ cmLocalGenerator::GenerateInstallRules();
+
+ cmTargets& targets = this->Makefile->GetTargets();
+ for(cmTargets::iterator iter = targets.begin();
+ iter != targets.end(); ++iter)
+ {
+ cmTarget* t = &iter->second;
+ t->HasMacOSXRpathInstallNameDir(NULL);
+ }
+}
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index d97a41c..edd2f5b 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -29,6 +29,8 @@ public:
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;
virtual void AppendFlagEscape(std::string& flags, const char* rawFlag);
+ virtual void Generate();
+ virtual void GenerateInstallRules();
private:
};
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 2ae35ef..615e6f2 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -14,6 +14,7 @@
#include "cmGeneratorExpression.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
void cmDependInformation::AddDependencies(cmDependInformation* info)
{
@@ -217,7 +218,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info)
{
cmsys::RegularExpression includeLine
("^[ \t]*#[ \t]*include[ \t]*[<\"]([^\">]+)[\">]");
- std::ifstream fin(info->FullPath.c_str());
+ cmsys::ifstream fin(info->FullPath.c_str());
if(!fin)
{
cmSystemTools::Error("Cannot open ", info->FullPath.c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 30a1557..35b65b4 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -34,7 +34,7 @@
#include <stdlib.h> // required for atoi
#include <cmsys/RegularExpression.hxx>
-
+#include <cmsys/FStream.hxx>
#include <cmsys/auto_ptr.hxx>
#include <stack>
@@ -3499,7 +3499,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
}
std::string tempOutputFile = soutfile;
tempOutputFile += ".tmp";
- std::ofstream fout(tempOutputFile.c_str(), omode);
+ cmsys::ofstream fout(tempOutputFile.c_str(), omode);
if(!fout)
{
cmSystemTools::Error(
@@ -3508,7 +3508,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
cmSystemTools::ReportLastSystemError("");
return 0;
}
- std::ifstream fin(sinfile.c_str());
+ cmsys::ifstream fin(sinfile.c_str());
if(!fin)
{
cmSystemTools::Error("Could not open file for read in copy operation ",
@@ -4045,8 +4045,8 @@ cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type,
// Create the target.
cmsys::auto_ptr<cmTarget> target(new cmTarget);
target->SetType(type, name);
- target->SetMakefile(this);
target->MarkAsImported();
+ target->SetMakefile(this);
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 44aaa66..d9fc93c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -957,7 +957,6 @@ private:
bool EnforceUniqueDir(const char* srcPath, const char* binPath);
- void ReadSources(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
// to the Sources array
void PrintStringVector(const char* s, const
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 69fe444..69b8092 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -338,13 +338,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.CMTarget = this->Target;
vars.Language = linkLanguage;
vars.Objects = buildObjs.c_str();
- std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash();
- objdir += this->Target->GetName();
- objdir += ".dir";
- objdir = this->Convert(objdir.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
- vars.ObjectDir = objdir.c_str();
+ std::string objectDir = this->Target->GetSupportDirectory();
+ objectDir = this->Convert(objectDir.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ vars.ObjectDir = objectDir.c_str();
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 35818ee..d6a0cd4 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -85,9 +85,6 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
case cmTarget::OBJECT_LIBRARY:
this->WriteObjectLibraryRules();
break;
- case cmTarget::INTERFACE_LIBRARY:
- // Nothing to do.
- break;
default:
// If language is not known, this is an error.
cmSystemTools::Error("Unknown Library Type");
@@ -583,13 +580,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.CMTarget = this->Target;
vars.Language = linkLanguage;
vars.Objects = buildObjs.c_str();
- std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash();
- objdir += this->Target->GetName();
- objdir += ".dir";
- objdir = this->Convert(objdir.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
- vars.ObjectDir = objdir.c_str();
+ std::string objectDir = this->Target->GetSupportDirectory();
+ objectDir = this->Convert(objectDir.c_str(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ vars.ObjectDir = objectDir.c_str();
vars.Target = targetOutPathReal.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2063a24..f82b808 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -76,7 +76,6 @@ cmMakefileTargetGenerator::New(cmGeneratorTarget *tgt)
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
case cmTarget::OBJECT_LIBRARY:
- case cmTarget::INTERFACE_LIBRARY:
result = new cmMakefileLibraryTargetGenerator(tgt);
break;
case cmTarget::UTILITY:
@@ -648,7 +647,7 @@ cmMakefileTargetGenerator
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL).c_str();
vars.Object = shellObj.c_str();
- std::string objectDir = cmSystemTools::GetFilenamePath(obj);
+ std::string objectDir = this->Target->GetSupportDirectory();
objectDir = this->Convert(objectDir.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index e3c058f..c8b03e1 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -568,7 +568,7 @@ cmNinjaTargetGenerator
}
EnsureParentDirectoryExists(objectFileName);
- std::string objectDir = cmSystemTools::GetFilenamePath(objectFileName);
+ std::string objectDir = this->Target->GetSupportDirectory();
vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
ConvertToNinjaPath(objectDir.c_str()).c_str(),
cmLocalGenerator::SHELL);
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 5de36ed..c0d9e99 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmOutputRequiredFilesCommand.h"
#include "cmMakeDepend.h"
+#include <cmsys/FStream.hxx>
class cmLBDepend : public cmMakeDepend
{
@@ -22,7 +23,7 @@ class cmLBDepend : public cmMakeDepend
void cmLBDepend::DependWalk(cmDependInformation* info)
{
- std::ifstream fin(info->FullPath.c_str());
+ cmsys::ifstream fin(info->FullPath.c_str());
if(!fin)
{
cmSystemTools::Error("error can not open ", info->FullPath.c_str());
@@ -196,7 +197,7 @@ bool cmOutputRequiredFilesCommand
if (info)
{
// write them out
- FILE *fout = fopen(this->OutputFile.c_str(),"w");
+ FILE *fout = cmsys::SystemTools::Fopen(this->OutputFile.c_str(),"w");
if(!fout)
{
std::string err = "Can not open output file: ";
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 0b3018e..987c663 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -311,6 +311,11 @@ cmPolicies::cmPolicies()
CMP0041, "CMP0041",
"Error on relative include with generator expression.",
3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0042, "CMP0042",
+ "MACOSX_RPATH is enabled by default.",
+ 3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 245ec4b..66eaf87 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -95,6 +95,7 @@ public:
CMP0040, ///< The target in the TARGET signature of
/// add_custom_command() must exist.
CMP0041, ///< Error on relative include with generator expression
+ CMP0042, ///< Enable MACOSX_RPATH by default
/** \brief Always the last entry.
*
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 835e3b4..bd7e75a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -23,6 +23,7 @@
#include <cmsys/Terminal.h>
#include <cmsys/ios/sstream>
+#include <cmsys/FStream.hxx>
#include <assert.h>
#include <string.h>
@@ -138,14 +139,14 @@ cmQtAutoGenerators::cmQtAutoGenerators()
}
}
-static std::string getAutogenTargetName(cmTarget *target)
+static std::string getAutogenTargetName(cmTarget const* target)
{
std::string autogenTargetName = target->GetName();
autogenTargetName += "_automoc";
return autogenTargetName;
}
-static std::string getAutogenTargetDir(cmTarget *target)
+static std::string getAutogenTargetDir(cmTarget const* target)
{
cmMakefile* makefile = target->GetMakefile();
std::string targetDir = makefile->GetCurrentOutputDirectory();
@@ -221,6 +222,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
if (target->GetPropertyAsBool("AUTORCC"))
{
toolNames.push_back("rcc");
+ this->InitializeAutoRccTarget(target);
}
std::string tools = toolNames[0];
@@ -295,7 +297,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
return true;
}
-static void GetCompileDefinitionsAndDirectories(cmTarget *target,
+static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
const char * config,
std::string &incs,
std::string &defs)
@@ -303,10 +305,12 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
cmMakefile* makefile = target->GetMakefile();
cmLocalGenerator* localGen = makefile->GetLocalGenerator();
std::vector<std::string> includeDirs;
- cmGeneratorTarget gtgt(target);
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
// Get the include dirs for this target, without stripping the implicit
// include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
- localGen->GetIncludeDirectories(includeDirs, &gtgt, "CXX", config, false);
+ localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false);
const char* sep = "";
incs = "";
for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
@@ -332,7 +336,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
}
}
-void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
+void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
{
cmMakefile* makefile = target->GetMakefile();
@@ -393,7 +397,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
|| !configIncludes.empty()
|| !configUicOptions.empty())
{
- std::ofstream infoFile(outputFile.c_str(), std::ios::app);
+ cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if ( !infoFile )
{
std::string error = "Internal CMake error when trying to open file: ";
@@ -435,7 +439,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
}
}
-void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget* target,
+void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
const std::string &autogenTargetName,
std::map<std::string, std::string> &configIncludes,
std::map<std::string, std::string> &configDefines)
@@ -614,7 +618,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-static void GetUicOpts(cmTarget *target, const char * config,
+static void GetUicOpts(cmTarget const* target, const char * config,
std::string &optString)
{
std::vector<std::string> opts;
@@ -631,7 +635,7 @@ static void GetUicOpts(cmTarget *target, const char * config,
}
}
-void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target,
+void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::map<std::string, std::string> &configUicOptions)
{
cmMakefile *makefile = target->GetMakefile();
@@ -801,14 +805,56 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
+void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target)
{
- std::string _rcc_files;
- const char* sepRccFiles = "";
cmMakefile *makefile = target->GetMakefile();
+ const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
+
std::vector<cmSourceFile*> newFiles;
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+ fileIt != srcFiles.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string ext = sf->GetExtension();
+ if (ext == "qrc")
+ {
+ std::string absFile = cmsys::SystemTools::GetRealPath(
+ sf->GetFullPath().c_str());
+ bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
+
+ if (!skip)
+ {
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFile);
+
+ std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
+ rcc_output_file += "/qrc_" + basename + ".cpp";
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+ rcc_output_file.c_str(), false);
+ cmSourceFile* rccCppSource
+ = makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
+ newFiles.push_back(rccCppSource);
+ }
+ }
+ }
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = newFiles.begin();
+ fileIt != newFiles.end();
+ ++fileIt)
+ {
+ target->AddSourceFile(*fileIt);
+ }
+}
+
+void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
+{
+ std::string _rcc_files;
+ const char* sepRccFiles = "";
+ cmMakefile *makefile = target->GetMakefile();
+
const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
std::string rccFileFiles;
@@ -841,17 +887,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
_rcc_files += absFile;
sepRccFiles = ";";
- std::string basename = cmsys::SystemTools::
- GetFilenameWithoutLastExtension(absFile);
-
- std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
- rcc_output_file += "/qrc_" + basename + ".cpp";
- makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
- rcc_output_file.c_str(), false);
- cmSourceFile* rccCppSource
- = makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
- newFiles.push_back(rccCppSource);
-
if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
{
std::vector<std::string> optsVec;
@@ -880,13 +915,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
}
}
- for(std::vector<cmSourceFile*>::const_iterator fileIt = newFiles.begin();
- fileIt != newFiles.end();
- ++fileIt)
- {
- target->AddSourceFile(*fileIt);
- }
-
makefile->AddDefinition("_rcc_files",
cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str());
@@ -1361,18 +1389,18 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
if (this->RunMocFailed)
{
- std::cerr << "moc failed..."<< std::endl;
+ std::cerr << "moc failed..." << std::endl;
return false;
}
if (this->RunUicFailed)
{
- std::cerr << "uic failed..."<< std::endl;
+ std::cerr << "uic failed..." << std::endl;
return false;
}
if (this->RunRccFailed)
{
- std::cerr << "rcc failed..."<< std::endl;
+ std::cerr << "rcc failed..." << std::endl;
return false;
}
outStream.flush();
@@ -2084,7 +2112,7 @@ bool cmQtAutoGenerators::EndsWith(const std::string& str,
std::string cmQtAutoGenerators::ReadAll(const std::string& filename)
{
- std::ifstream file(filename.c_str());
+ cmsys::ifstream file(filename.c_str());
cmsys_ios::stringstream stream;
stream << file.rdbuf();
file.close();
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index e877f7d..80123d8 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -24,16 +24,17 @@ public:
bool Run(const char* targetDirectory, const char *config);
bool InitializeAutogenTarget(cmTarget* target);
- void SetupAutoGenerateTarget(cmTarget* target);
+ void SetupAutoGenerateTarget(cmTarget const* target);
private:
- void SetupAutoMocTarget(cmTarget* target,
+ void SetupAutoMocTarget(cmTarget const* target,
const std::string &autogenTargetName,
std::map<std::string, std::string> &configIncludes,
std::map<std::string, std::string> &configDefines);
- void SetupAutoUicTarget(cmTarget* target,
+ void SetupAutoUicTarget(cmTarget const* target,
std::map<std::string, std::string> &configUicOptions);
- void SetupAutoRccTarget(cmTarget* target);
+ void InitializeAutoRccTarget(cmTarget* target);
+ void SetupAutoRccTarget(cmTarget const* target);
cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
const char* targetDirectory);
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index 3aa8e1b..11a9913 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -13,7 +13,7 @@
#include "cmSystemTools.h"
#include "cmVersion.h"
-
+#include <cmsys/FStream.hxx>
#include <ctype.h>
//----------------------------------------------------------------------------
@@ -52,7 +52,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot):
//----------------------------------------------------------------------------
bool cmRST::ProcessFile(std::string const& fname, bool isModule)
{
- std::ifstream fin(fname.c_str());
+ cmsys::ifstream fin(fname.c_str());
if(fin)
{
this->DocDir = cmSystemTools::GetFilenamePath(fname);
diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 7369fe6..ebfa8f9 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -391,6 +391,22 @@ inline bool cmHasLiteralPrefixImpl(const char* str1,
return strncmp(str1, str2, N) == 0;
}
+inline bool cmHasLiteralSuffixImpl(const std::string &str1,
+ const char *str2,
+ size_t N)
+{
+ size_t len = str1.size();
+ return len >= N && strcmp(str1.c_str() + len - N, str2) == 0;
+}
+
+inline bool cmHasLiteralSuffixImpl(const char* str1,
+ const char* str2,
+ size_t N)
+{
+ size_t len = strlen(str1);
+ return len >= N && strcmp(str1 + len - N, str2) == 0;
+}
+
#if defined(_MSC_VER) && _MSC_VER < 1300 \
|| defined(__GNUC__) && __GNUC__ < 3 \
|| defined(__BORLANDC__)
@@ -402,6 +418,9 @@ inline bool cmHasLiteralPrefixImpl(const char* str1,
#define cmHasLiteralPrefix(STR1, STR2) \
cmHasLiteralPrefixImpl(STR1, "" STR2 "", sizeof(STR2) - 1)
+#define cmHasLiteralSuffix(STR1, STR2) \
+ cmHasLiteralSuffixImpl(STR1, "" STR2 "", sizeof(STR2) - 1)
+
#else
template<typename T, size_t N>
@@ -417,25 +436,31 @@ bool cmHasLiteralPrefix(T str1, const char (&str2)[N])
return cmHasLiteralPrefixImpl(str1, str2, N - 1);
}
+template<typename T, size_t N>
+bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
+{
+ return cmHasLiteralSuffixImpl(str1, str2, N - 1);
+}
+
#endif
struct cmStrCmp {
cmStrCmp(const char *test) : m_test(test) {}
cmStrCmp(std::string &test) : m_test(test.c_str()) {}
- bool operator()(const char * input)
+ bool operator()(const char * input) const
{
return strcmp(input, m_test) == 0;
}
// For use with binary_search
- bool operator()(const char *str1, const char *str2)
+ bool operator()(const char *str1, const char *str2) const
{
return strcmp(str1, str2) < 0;
}
private:
- const char *m_test;
+ const char * const m_test;
};
#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index b8163c8..41c7509 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -32,6 +32,7 @@
# include <cmsys/Terminal.h>
#endif
#include <cmsys/stl/algorithm>
+#include <cmsys/FStream.hxx>
#if defined(_WIN32)
# include <windows.h>
@@ -359,18 +360,11 @@ bool cmSystemTools::IsOn(const char* val)
bool cmSystemTools::IsNOTFOUND(const char* val)
{
- size_t len = strlen(val);
- const char* notfound = "-NOTFOUND";
- const size_t lenNotFound = 9;
- if(len < lenNotFound-1)
+ if(strcmp(val, "NOTFOUND") == 0)
{
- return false;
- }
- if(len == lenNotFound-1)
- {
- return ( strcmp(val, "NOTFOUND") == 0);
+ return true;
}
- return ((strncmp((val + (len - lenNotFound)), notfound, lenNotFound) == 0));
+ return cmHasLiteralSuffix(val, "-NOTFOUND");
}
@@ -1432,7 +1426,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
- std::ofstream fout(outFileName, std::ios::out | cmsys_ios_binary);
+ cmsys::ofstream fout(outFileName, std::ios::out | cmsys_ios_binary);
if(!fout)
{
std::string e = "Cannot open output file \"";
@@ -2037,7 +2031,7 @@ unsigned int cmSystemTools::RandomSeed()
} seed;
// Try using a real random source.
- std::ifstream fin("/dev/urandom");
+ cmsys::ifstream fin("/dev/urandom");
if(fin && fin.read(seed.bytes, sizeof(seed)) &&
fin.gcount() == sizeof(seed))
{
@@ -2160,7 +2154,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
// Build tree has "<build>/bin[/<config>]/cmake" and
// "<build>/CMakeFiles/CMakeSourceDir.txt".
std::string src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
- std::ifstream fin(src_dir_txt.c_str());
+ cmsys::ifstream fin(src_dir_txt.c_str());
std::string src_dir;
if(fin && cmSystemTools::GetLineFromStream(fin, src_dir) &&
cmSystemTools::FileIsDirectory(src_dir.c_str()))
@@ -2171,7 +2165,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
{
dir = cmSystemTools::GetFilenamePath(dir);
src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt";
- std::ifstream fin2(src_dir_txt.c_str());
+ cmsys::ifstream fin2(src_dir_txt.c_str());
if(fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) &&
cmSystemTools::FileIsDirectory(src_dir.c_str()))
{
@@ -2506,7 +2500,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
{
// Open the file for update.
- std::ofstream f(file.c_str(),
+ cmsys::ofstream f(file.c_str(),
std::ios::in | std::ios::out | std::ios::binary);
if(!f)
{
@@ -2704,7 +2698,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
}
// Open the file for update.
- std::ofstream f(file.c_str(),
+ cmsys::ofstream f(file.c_str(),
std::ios::in | std::ios::out | std::ios::binary);
if(!f)
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 38fe945..b06480b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -24,6 +24,7 @@
#include <set>
#include <stdlib.h> // required for atof
#include <assert.h>
+#include <errno.h>
const char* cmTarget::GetTargetTypeName(TargetType targetType)
{
@@ -136,7 +137,7 @@ public:
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
- std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
+ std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
mutable std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceIncludeDirectoriesEntries;
@@ -330,34 +331,36 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Save the backtrace of target construction.
this->Makefile->GetBacktrace(this->Internal->Backtrace);
- // Initialize the INCLUDE_DIRECTORIES property based on the current value
- // of the same directory property:
- const std::vector<cmValueWithOrigin> parentIncludes =
- this->Makefile->GetIncludeDirectoriesEntries();
-
- for (std::vector<cmValueWithOrigin>::const_iterator it
- = parentIncludes.begin(); it != parentIncludes.end(); ++it)
+ if (!this->IsImported())
{
- this->InsertInclude(*it);
- }
+ // Initialize the INCLUDE_DIRECTORIES property based on the current value
+ // of the same directory property:
+ const std::vector<cmValueWithOrigin> parentIncludes =
+ this->Makefile->GetIncludeDirectoriesEntries();
- const std::set<cmStdString> parentSystemIncludes =
- this->Makefile->GetSystemIncludeDirectories();
+ for (std::vector<cmValueWithOrigin>::const_iterator it
+ = parentIncludes.begin(); it != parentIncludes.end(); ++it)
+ {
+ this->InsertInclude(*it);
+ }
+ const std::set<cmStdString> parentSystemIncludes =
+ this->Makefile->GetSystemIncludeDirectories();
- for (std::set<cmStdString>::const_iterator it
- = parentSystemIncludes.begin();
- it != parentSystemIncludes.end(); ++it)
- {
- this->SystemIncludeDirectories.insert(*it);
- }
+ for (std::set<cmStdString>::const_iterator it
+ = parentSystemIncludes.begin();
+ it != parentSystemIncludes.end(); ++it)
+ {
+ this->SystemIncludeDirectories.insert(*it);
+ }
- const std::vector<cmValueWithOrigin> parentOptions =
- this->Makefile->GetCompileOptionsEntries();
+ const std::vector<cmValueWithOrigin> parentOptions =
+ this->Makefile->GetCompileOptionsEntries();
- for (std::vector<cmValueWithOrigin>::const_iterator it
- = parentOptions.begin(); it != parentOptions.end(); ++it)
- {
- this->InsertCompileOption(*it);
+ for (std::vector<cmValueWithOrigin>::const_iterator it
+ = parentOptions.begin(); it != parentOptions.end(); ++it)
+ {
+ this->InsertCompileOption(*it);
+ }
}
if (this->GetType() != INTERFACE_LIBRARY)
@@ -828,7 +831,8 @@ void cmTarget::GetDirectLinkLibraries(const char *config,
//----------------------------------------------------------------------------
void cmTarget::GetInterfaceLinkLibraries(const char *config,
- std::vector<std::string> &libs, cmTarget *head) const
+ std::vector<std::string> &libs,
+ cmTarget const* head) const
{
const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES");
if (prop)
@@ -1038,62 +1042,6 @@ cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
}
//----------------------------------------------------------------------------
-void cmTarget::FinalizeSystemIncludeDirectories()
-{
- for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
- it != end; ++it)
- {
- if (!cmGeneratorExpression::IsValidTargetName(it->Value)
- && cmGeneratorExpression::Find(it->Value) == std::string::npos)
- {
- continue;
- }
- {
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(it->Value);
- std::string targetName = cge->Evaluate(this->Makefile, 0,
- false, this, 0, 0);
- cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str());
- if (!tgt || tgt == this)
- {
- continue;
- }
- if (tgt->IsImported()
- && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")
- && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"))
- {
- std::string includeGenex = "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
- if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
- {
- // Because it->Value is a generator expression, ensure that it
- // evaluates to the non-empty string before being used in the
- // TARGET_PROPERTY expression.
- includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
- }
- this->SystemIncludeDirectories.insert(includeGenex);
- return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset
- // of the INTERFACE_INCLUDE_DIRECTORIES
- }
- }
- std::string includeGenex = "$<TARGET_PROPERTY:" +
- it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>";
- if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
- {
- // Because it->Value is a generator expression, ensure that it
- // evaluates to the non-empty string before being used in the
- // TARGET_PROPERTY expression.
- includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
- }
- this->SystemIncludeDirectories.insert(includeGenex);
- }
-}
-
-//----------------------------------------------------------------------------
void
cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
{
@@ -1399,14 +1347,10 @@ static bool whiteListedInterfaceProperty(const char *prop)
"COMPATIBLE_INTERFACE_NUMBER_MAX",
"COMPATIBLE_INTERFACE_NUMBER_MIN",
"COMPATIBLE_INTERFACE_STRING",
- "EXCLUDE_FROM_ALL",
- "EXCLUDE_FROM_DEFAULT_BUILD",
"EXPORT_NAME",
- "IMPORTED_LINK_INTERFACE_LANGUAGES",
"IMPORTED",
"NAME",
- "TYPE",
- "VERSION"
+ "TYPE"
};
if (std::binary_search(cmArrayBegin(builtIns),
@@ -1417,9 +1361,7 @@ static bool whiteListedInterfaceProperty(const char *prop)
return true;
}
- if (cmHasLiteralPrefix(prop, "EXCLUDE_FROM_DEFAULT_BUILD_")
- || cmHasLiteralPrefix(prop, "IMPORTED_LINK_INTERFACE_LANGUAGES_")
- || cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_"))
+ if (cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_"))
{
return true;
}
@@ -1494,11 +1436,11 @@ void cmTarget::SetProperty(const char* prop, const char* value)
}
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
- this->Internal->LinkInterfacePropertyEntries.clear();
+ this->Internal->LinkImplementationPropertyEntries.clear();
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
return;
}
this->Properties.SetProperty(prop, value, cmProperty::TARGET);
@@ -1569,7 +1511,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
return;
}
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
@@ -1602,6 +1544,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
if(this->GetType() != cmTarget::SHARED_LIBRARY &&
this->GetType() != cmTarget::STATIC_LIBRARY &&
this->GetType() != cmTarget::MODULE_LIBRARY &&
+ this->GetType() != cmTarget::INTERFACE_LIBRARY &&
!this->IsExecutableWithExports())
{
return;
@@ -1881,8 +1824,8 @@ cmTarget::GetIncludeDirectories(const char *config) const
if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
{
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
@@ -2110,8 +2053,8 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString])
{
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
@@ -2223,8 +2166,8 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
{
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
if (!cmGeneratorExpression::IsValidTargetName(it->Value)
@@ -2571,6 +2514,8 @@ void cmTarget::GetTargetVersion(bool soversion,
minor = 0;
patch = 0;
+ assert(this->GetType() != INTERFACE_LIBRARY);
+
// Look for a VERSION or SOVERSION property.
const char* prop = soversion? "SOVERSION" : "VERSION";
if(const char* version = this->GetProperty(prop))
@@ -2684,7 +2629,6 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetType() == cmTarget::STATIC_LIBRARY ||
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY ||
- this->GetType() == cmTarget::INTERFACE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{
if(strcmp(prop,"LOCATION") == 0)
@@ -2719,25 +2663,6 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetLocation(configName.c_str()),
cmProperty::TARGET);
}
- else
- {
- // Support "<CONFIG>_LOCATION" for compatibility.
- int len = static_cast<int>(strlen(prop));
- if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
- {
- std::string configName(prop, len-9);
- if(configName != "IMPORTED")
- {
- if (!this->HandleLocationPropertyPolicy())
- {
- return 0;
- }
- this->Properties.SetProperty(prop,
- this->GetLocation(configName.c_str()),
- cmProperty::TARGET);
- }
- }
- }
}
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
{
@@ -2799,8 +2724,8 @@ const char *cmTarget::GetProperty(const char* prop,
output = "";
std::string sep;
for (std::vector<cmValueWithOrigin>::const_iterator
- it = this->Internal->LinkInterfacePropertyEntries.begin(),
- end = this->Internal->LinkInterfacePropertyEntries.end();
+ it = this->Internal->LinkImplementationPropertyEntries.begin(),
+ end = this->Internal->LinkImplementationPropertyEntries.end();
it != end; ++it)
{
output += sep;
@@ -3185,13 +3110,17 @@ std::string cmTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
-bool cmTarget::HasMacOSXRpath(const char* config) const
+bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
{
bool install_name_is_rpath = false;
- bool macosx_rpath = this->GetPropertyAsBool("MACOSX_RPATH");
+ bool macosx_rpath = false;
if(!this->IsImportedTarget)
{
+ if(this->GetType() != cmTarget::SHARED_LIBRARY)
+ {
+ return false;
+ }
const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
bool use_install_name =
this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH");
@@ -3204,6 +3133,10 @@ bool cmTarget::HasMacOSXRpath(const char* config) const
{
return false;
}
+ if(!install_name_is_rpath)
+ {
+ macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
+ }
}
else
{
@@ -3258,6 +3191,37 @@ bool cmTarget::HasMacOSXRpath(const char* config) const
}
//----------------------------------------------------------------------------
+bool cmTarget::MacOSXRpathInstallNameDirDefault() const
+{
+ // we can't do rpaths when unsupported
+ if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG"))
+ {
+ return false;
+ }
+
+ const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH");
+ if(macosx_rpath_str)
+ {
+ return this->GetPropertyAsBool("MACOSX_RPATH");
+ }
+
+ cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
+
+ if(cmp0042 == cmPolicies::WARN)
+ {
+ this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
+ AddCMP0042WarnTarget(this->GetName());
+ }
+
+ if(cmp0042 == cmPolicies::NEW)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//----------------------------------------------------------------------------
bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
{
if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY)
@@ -3564,6 +3528,8 @@ void cmTarget::GetLibraryNames(std::string& name,
return;
}
+ assert(this->GetType() != INTERFACE_LIBRARY);
+
// Check for library version properties.
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
@@ -3846,7 +3812,8 @@ std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const
!this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
{
std::string dir;
- if(this->GetPropertyAsBool("MACOSX_RPATH"))
+ bool macosx_rpath = this->MacOSXRpathInstallNameDirDefault();
+ if(macosx_rpath)
{
dir = "@rpath";
}
@@ -3880,9 +3847,12 @@ std::string cmTarget::GetInstallNameDirForInstallTree() const
dir += "/";
}
}
- if(!install_name_dir && this->GetPropertyAsBool("MACOSX_RPATH"))
+ if(!install_name_dir)
{
- dir = "@rpath/";
+ if(this->MacOSXRpathInstallNameDirDefault())
+ {
+ dir = "@rpath/";
+ }
}
return dir;
}
@@ -4135,6 +4105,8 @@ std::string cmTarget::GetOutputName(const char* config, bool implib) const
//----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkVersion() const
{
+ assert(this->GetType() != INTERFACE_LIBRARY);
+
if(const char* fversion = this->GetProperty("FRAMEWORK_VERSION"))
{
return fversion;
@@ -4213,20 +4185,23 @@ enum CompatibleType
//----------------------------------------------------------------------------
template<typename PropertyType>
-PropertyType consistentProperty(PropertyType lhs, PropertyType rhs,
- CompatibleType t);
+std::pair<bool, PropertyType> consistentProperty(PropertyType lhs,
+ PropertyType rhs,
+ CompatibleType t);
//----------------------------------------------------------------------------
template<>
-bool consistentProperty(bool lhs, bool rhs, CompatibleType)
+std::pair<bool, bool> consistentProperty(bool lhs, bool rhs, CompatibleType)
{
- return lhs == rhs;
+ return std::make_pair(lhs == rhs, lhs);
}
//----------------------------------------------------------------------------
-const char * consistentStringProperty(const char *lhs, const char *rhs)
+std::pair<bool, const char*> consistentStringProperty(const char *lhs,
+ const char *rhs)
{
- return strcmp(lhs, rhs) == 0 ? lhs : 0;
+ const bool b = strcmp(lhs, rhs) == 0;
+ return std::make_pair(b, b ? lhs : 0);
}
#if defined(_MSC_VER) && _MSC_VER <= 1200
@@ -4240,49 +4215,74 @@ cmMinimum(const T& l, const T& r) {return l < r ? l : r;}
#endif
//----------------------------------------------------------------------------
-const char * consistentNumberProperty(const char *lhs, const char *rhs,
- CompatibleType t)
+std::pair<bool, const char*> consistentNumberProperty(const char *lhs,
+ const char *rhs,
+ CompatibleType t)
{
- double lnum;
- double rnum;
- if(sscanf(lhs, "%lg", &lnum) != 1 ||
- sscanf(rhs, "%lg", &rnum) != 1)
+ char *pEnd;
+
+#if defined(_MSC_VER)
+ static const char* const null_ptr = 0;
+#else
+# define null_ptr 0
+#endif
+
+ long lnum = strtol(lhs, &pEnd, 0);
+ if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE)
{
- return 0;
+ return std::pair<bool, const char*>(false, null_ptr);
+ }
+
+ long rnum = strtol(rhs, &pEnd, 0);
+ if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE)
+ {
+ return std::pair<bool, const char*>(false, null_ptr);
}
+#if !defined(_MSC_VER)
+#undef null_ptr
+#endif
+
if (t == NumberMaxType)
{
- return cmMaximum(lnum, rnum) == lnum ? lhs : rhs;
+ return std::make_pair(true, cmMaximum(lnum, rnum) == lnum ? lhs : rhs);
}
else
{
- return cmMinimum(lnum, rnum) == lnum ? lhs : rhs;
+ return std::make_pair(true, cmMinimum(lnum, rnum) == lnum ? lhs : rhs);
}
}
//----------------------------------------------------------------------------
template<>
-const char* consistentProperty(const char *lhs, const char *rhs,
- CompatibleType t)
+std::pair<bool, const char*> consistentProperty(const char *lhs,
+ const char *rhs,
+ CompatibleType t)
{
if (!lhs && !rhs)
{
- return "";
+ return std::make_pair(true, lhs);
}
if (!lhs)
{
- return rhs ? rhs : "";
+ return std::make_pair(true, rhs);
}
if (!rhs)
{
- return lhs ? lhs : "";
+ return std::make_pair(true, lhs);
}
+
+#if defined(_MSC_VER)
+ static const char* const null_ptr = 0;
+#else
+# define null_ptr 0
+#endif
+
switch(t)
{
case BoolType:
assert(!"consistentProperty for strings called with BoolType");
- return 0;
+ return std::pair<bool, const char*>(false, null_ptr);
case StringType:
return consistentStringProperty(lhs, rhs);
case NumberMinType:
@@ -4290,7 +4290,12 @@ const char* consistentProperty(const char *lhs, const char *rhs,
return consistentNumberProperty(lhs, rhs, t);
}
assert(!"Unreachable!");
- return 0;
+ return std::pair<bool, const char*>(false, null_ptr);
+
+#if !defined(_MSC_VER)
+#undef null_ptr
+#endif
+
}
template<typename PropertyType>
@@ -4462,7 +4467,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
("INTERFACE_" + p).c_str(), 0);
std::string reportEntry;
- if (ifacePropContent)
+ if (ifaceIsSet)
{
reportEntry += " * Target \"";
reportEntry += li->Target->GetName();
@@ -4475,11 +4480,12 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{
if (ifaceIsSet)
{
- PropertyType consistent = consistentProperty(propContent,
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
ifacePropContent, t);
report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent);
- if (!consistent)
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
{
cmOStringStream e;
e << "Property " << p << " on target \""
@@ -4491,7 +4497,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
}
else
{
- propContent = consistent;
+ propContent = consistent.second;
continue;
}
}
@@ -4505,19 +4511,14 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{
propContent = impliedValue<PropertyType>(propContent);
- reportEntry += " * Target \"";
- reportEntry += li->Target->GetName();
- reportEntry += "\" property value \"";
- reportEntry += valueAsString<PropertyType>(propContent);
- reportEntry += "\" ";
-
if (ifaceIsSet)
{
- PropertyType consistent = consistentProperty(propContent,
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
ifacePropContent, t);
report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent);
- if (!consistent)
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
{
cmOStringStream e;
e << "Property " << p << " on target \""
@@ -4530,7 +4531,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
}
else
{
- propContent = consistent;
+ propContent = consistent.second;
continue;
}
}
@@ -4546,11 +4547,12 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
{
if (propInitialized)
{
- PropertyType consistent = consistentProperty(propContent,
+ std::pair<bool, PropertyType> consistent =
+ consistentProperty(propContent,
ifacePropContent, t);
report += reportEntry;
- report += compatibilityAgree(t, propContent != consistent);
- if (!consistent)
+ report += compatibilityAgree(t, propContent != consistent.second);
+ if (!consistent.first)
{
cmOStringStream e;
e << "The INTERFACE_" << p << " property of \""
@@ -4562,7 +4564,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
}
else
{
- propContent = consistent;
+ propContent = consistent.second;
continue;
}
}
@@ -4860,6 +4862,15 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
const char** imp,
std::string& suffix) const
{
+ if (this->GetType() == INTERFACE_LIBRARY)
+ {
+ // This method attempts to find a config-specific LOCATION for the
+ // IMPORTED library. In the case of INTERFACE_LIBRARY, there is no
+ // LOCATION at all, so leaving *loc and *imp unchanged is the appropriate
+ // and valid response.
+ return true;
+ }
+
// Track the configuration-specific property suffix.
suffix = "_";
suffix += desired_config;
@@ -4992,8 +5003,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
const char* loc = 0;
const char* imp = 0;
std::string suffix;
- if (this->GetType() != INTERFACE_LIBRARY &&
- !this->GetMappedConfig(desired_config, &loc, &imp, suffix))
+ if (!this->GetMappedConfig(desired_config, &loc, &imp, suffix))
{
return;
}
@@ -5526,9 +5536,6 @@ void cmTarget::ComputeLinkImplementation(const char* config,
LinkImplementation& impl,
cmTarget const* head) const
{
- // Compute which library configuration to link.
- cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
-
// Collect libraries directly linked in this configuration.
std::vector<std::string> llibs;
this->GetDirectLinkLibraries(config, llibs, head);
@@ -5605,7 +5612,7 @@ void cmTarget::ComputeLinkImplementation(const char* config,
{
e << "Target \"" << this->GetName() << "\" links to target \"" << item
<< "\" but the target was not found. Perhaps a find_package() "
- "call is missing for an IMPORTED target, or a ALIAS target is "
+ "call is missing for an IMPORTED target, or an ALIAS target is "
"missing?";
this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
e.str(),
@@ -5621,6 +5628,7 @@ void cmTarget::ComputeLinkImplementation(const char* config,
impl.Libraries.push_back(item);
}
+ cmTarget::LinkLibraryType linkType = this->ComputeLinkType(config);
LinkLibraryVectorType const& oldllibs = this->GetOriginalLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
li != oldllibs.end(); ++li)
@@ -5762,7 +5770,8 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
//----------------------------------------------------------------------------
template<typename PropertyType>
-void checkPropertyConsistency(cmTarget const* depender, cmTarget *dependee,
+void checkPropertyConsistency(cmTarget const* depender,
+ cmTarget const* dependee,
const char *propName,
std::set<cmStdString> &emitted,
const char *config,
@@ -5950,7 +5959,8 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
<< propsString <<
" property in the dependencies of target \"" << this->GetName() <<
"\". This is not allowed. A property may only require compatibility "
- "in a boolean interpretation or a string interpretation, but not both.";
+ "in a boolean interpretation, a numeric minimum, a numeric maximum or a "
+ "string interpretation, but not a mixture.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 3f5a5d1..4916648 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -26,7 +26,8 @@
F(CMP0020) \
F(CMP0021) \
F(CMP0022) \
- F(CMP0041)
+ F(CMP0041) \
+ F(CMP0042)
class cmake;
class cmMakefile;
@@ -187,7 +188,7 @@ public:
cmTarget const* head) const;
void GetInterfaceLinkLibraries(const char *config,
std::vector<std::string> &,
- cmTarget *head) const;
+ cmTarget const* head) const;
/** Compute the link type to use for the given configuration. */
LinkLibraryType ComputeLinkType(const char* config) const;
@@ -382,7 +383,10 @@ public:
std::string GetSOName(const char* config) const;
/** Whether this library has \@rpath and platform supports it. */
- bool HasMacOSXRpath(const char* config) const;
+ bool HasMacOSXRpathInstallNameDir(const char* config) const;
+
+ /** Whether this library defaults to \@rpath. */
+ bool MacOSXRpathInstallNameDirDefault() const;
/** Test for special case of a third-party shared library that has
no soname at all. */
@@ -564,8 +568,6 @@ public:
std::set<cmStdString> const & GetSystemIncludeDirectories() const
{ return this->SystemIncludeDirectories; }
- void FinalizeSystemIncludeDirectories();
-
bool LinkLanguagePropagatesToDependents() const
{ return this->TargetTypeValue == STATIC_LIBRARY; }
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 258bacd..1feb072 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -20,17 +20,17 @@ class cmTarget;
It may be marked as a 'link' or 'util' edge or both. */
class cmTargetDepend
{
- cmTarget* Target;
+ cmTarget const* Target;
// The set order depends only on the Target, so we use
// mutable members to acheive a map with set syntax.
mutable bool Link;
mutable bool Util;
public:
- cmTargetDepend(cmTarget* t): Target(t), Link(false), Util(false) {}
- operator cmTarget*() const { return this->Target; }
- cmTarget* operator->() const { return this->Target; }
- cmTarget& operator*() const { return *this->Target; }
+ cmTargetDepend(cmTarget const* t): Target(t), Link(false), Util(false) {}
+ operator cmTarget const*() const { return this->Target; }
+ cmTarget const* operator->() const { return this->Target; }
+ cmTarget const& operator*() const { return *this->Target; }
friend bool operator < (cmTargetDepend const& l, cmTargetDepend const& r)
{ return l.Target < r.Target; }
void SetType(bool strong) const
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 879d4fd..cfedaa5 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -12,6 +12,7 @@
#include "cmTryRunCommand.h"
#include "cmCacheManager.h"
#include "cmTryCompileCommand.h"
+#include <cmsys/FStream.hxx>
// cmTryRunCommand
bool cmTryRunCommand
@@ -302,7 +303,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
if (error)
{
static bool firstTryRun = true;
- std::ofstream file(resultFileName.c_str(),
+ cmsys::ofstream file(resultFileName.c_str(),
firstTryRun ? std::ios::out : std::ios::app);
if ( file )
{
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index 1bd579d..d4ec20f 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
bool cmUseMangledMesaCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
@@ -73,7 +74,7 @@ CopyAndFullPathMesaHeader(const char* source,
outFile += file;
std::string tempOutputFile = outFile;
tempOutputFile += ".tmp";
- std::ofstream fout(tempOutputFile.c_str());
+ cmsys::ofstream fout(tempOutputFile.c_str());
if(!fout)
{
cmSystemTools::Error("Could not open file for write in copy operation: ",
@@ -81,7 +82,7 @@ CopyAndFullPathMesaHeader(const char* source,
cmSystemTools::ReportLastSystemError("");
return;
}
- std::ifstream fin(source);
+ cmsys::ifstream fin(source);
if(!fin)
{
cmSystemTools::Error("Could not open file for read in copy operation",
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 10663b7..784cadb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -596,7 +596,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
// Make sure the path exists for the file
std::string path = cmSystemTools::GetFilenamePath(sourcePath);
cmSystemTools::MakeDirectory(path.c_str());
- std::ofstream fout(sourcePath.c_str());
+ cmsys::ofstream fout(sourcePath.c_str());
if(fout)
{
fout << "# generated from CMake\n";
@@ -1841,7 +1841,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
- cmTarget* dt = *i;
+ cmTarget const* dt = *i;
if(dt->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index bae5974..d182a75 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include "cmVisualStudioSlnData.h"
+#include <cmsys/FStream.hxx>
#include <cassert>
#include <stack>
@@ -472,7 +473,7 @@ bool cmVisualStudioSlnParser::ParseFile(const std::string& file,
this->LastResult.SetError(ResultErrorUnsupportedDataGroup, 0);
return false;
}
- std::ifstream f(file.c_str());
+ cmsys::ifstream f(file.c_str());
if (!f)
{
this->LastResult.SetError(ResultErrorOpeningInput, 0);
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index 3642c6f..aa6b9f8 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmWriteFileCommand.h"
+#include <cmsys/FStream.hxx>
#include <sys/types.h>
#include <sys/stat.h>
@@ -71,7 +72,7 @@ bool cmWriteFileCommand
}
// If GetPermissions fails, pretend like it is ok. File open will fail if
// the file is not writable
- std::ofstream file(fileName.c_str(),
+ cmsys::ofstream file(fileName.c_str(),
overwrite?std::ios::out : std::ios::app);
if ( !file )
{
diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx
index 882fc17..0c53440 100644
--- a/Source/cmXMLParser.cxx
+++ b/Source/cmXMLParser.cxx
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmXMLParser.h"
+#include <cmsys/FStream.hxx>
#include <cm_expat.h>
#include <ctype.h>
@@ -45,7 +46,7 @@ int cmXMLParser::ParseFile(const char* file)
return 0;
}
- std::ifstream ifs(file);
+ cmsys::ifstream ifs(file);
if ( !ifs )
{
return 0;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 741e263..1dd8a66 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -28,6 +28,7 @@
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
+#include <cmsys/FStream.hxx>
// only build kdevelop generator on non-windows platforms
// when not bootstrapping cmake
@@ -1861,7 +1862,7 @@ void cmake::UpdateConversionPathTable()
if(tablepath)
{
- std::ifstream table( tablepath );
+ cmsys::ifstream table( tablepath );
if(!table)
{
cmSystemTools::Error("CMAKE_PATH_TRANSLATION_FILE set to ", tablepath,
@@ -2387,7 +2388,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// echo results to stdout if needed
if (writeToStdout)
{
- FILE* fin = fopen(resultFile.c_str(), "r");
+ FILE* fin = cmsys::SystemTools::Fopen(resultFile.c_str(), "r");
if(fin)
{
const int bufferSize = 4096;
@@ -2421,9 +2422,9 @@ static bool cmakeCheckStampFile(const char* stampName)
std::string stampDepends = stampName;
stampDepends += ".depend";
#if defined(_WIN32) || defined(__CYGWIN__)
- std::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary);
+ cmsys::ifstream fin(stampDepends.c_str(), std::ios::in | std::ios::binary);
#else
- std::ifstream fin(stampDepends.c_str(), std::ios::in);
+ cmsys::ifstream fin(stampDepends.c_str(), std::ios::in);
#endif
if(!fin)
{
@@ -2464,7 +2465,7 @@ static bool cmakeCheckStampFile(const char* stampName)
{
// TODO: Teach cmGeneratedFileStream to use a random temp file (with
// multiple tries in unlikely case of conflict) and use that here.
- std::ofstream stamp(stampTemp);
+ cmsys::ofstream stamp(stampTemp);
stamp << "# CMake generation timestamp file for this directory.\n";
}
if(cmSystemTools::RenameFile(stampTemp, stampName))
@@ -2494,7 +2495,7 @@ static bool cmakeCheckStampList(const char* stampList)
<< "is missing.\n";
return false;
}
- std::ifstream fin(stampList);
+ cmsys::ifstream fin(stampList);
if(!fin)
{
std::cout << "CMake is re-running because generate.stamp.list "
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 882b072..fcaa127 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -24,6 +24,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include <cmsys/Encoding.hxx>
#ifdef CMAKE_BUILD_WITH_CMAKE
//----------------------------------------------------------------------------
@@ -79,7 +80,7 @@ static const char * cmDocumentationOptions[][2] =
#endif
-static int do_command(int ac, char** av)
+static int do_command(int ac, char const* const* av)
{
std::vector<std::string> args;
args.push_back(av[0]);
@@ -90,8 +91,8 @@ static int do_command(int ac, char** av)
return cmcmd::ExecuteCMakeCommand(args);
}
-int do_cmake(int ac, char** av);
-static int do_build(int ac, char** av);
+int do_cmake(int ac, char const* const* av);
+static int do_build(int ac, char const* const* av);
static cmMakefile* cmakemainGetMakefile(void *clientdata)
{
@@ -159,8 +160,13 @@ static void cmakemainProgressCallback(const char *m, float prog,
}
-int main(int ac, char** av)
+int main(int ac, char const* const* av)
{
+ cmsys::Encoding::CommandLineArguments args =
+ cmsys::Encoding::CommandLineArguments::Main(ac, av);
+ ac = args.argc();
+ av = args.argv();
+
cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::FindCMakeResources(av[0]);
if(ac > 1)
@@ -181,7 +187,7 @@ int main(int ac, char** av)
return ret;
}
-int do_cmake(int ac, char** av)
+int do_cmake(int ac, char const* const* av)
{
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
{
@@ -352,7 +358,7 @@ int do_cmake(int ac, char** av)
}
//----------------------------------------------------------------------------
-static int do_build(int ac, char** av)
+static int do_build(int ac, char const* const* av)
{
#ifndef CMAKE_BUILD_WITH_CMAKE
std::cerr << "This cmake does not support --build\n";
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index 0675470..faa5fa7 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -139,7 +139,7 @@ static void outputDepFile(const std::string& dfile, const std::string& objfile,
std::sort(incs.begin(), incs.end());
incs.erase(std::unique(incs.begin(), incs.end()), incs.end());
- FILE* out = fopen(dfile.c_str(), "wb");
+ FILE* out = cmsys::SystemTools::Fopen(dfile.c_str(), "wb");
// FIXME should this be fatal or not? delete obj? delete d?
if (!out)
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index d3b7b5f..7891969 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -23,6 +23,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/Process.h>
+#include <cmsys/FStream.hxx>
#if defined(CMAKE_HAVE_VS_GENERATORS)
#include "cmCallVisualStudioMacro.h"
@@ -376,7 +377,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::RemoveADirectory(dirName.c_str());
// is the last argument a filename that exists?
- FILE *countFile = fopen(args[3].c_str(),"r");
+ FILE *countFile = cmsys::SystemTools::Fopen(args[3].c_str(),"r");
int count;
if (countFile)
{
@@ -396,7 +397,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// write the count into the directory
std::string fName = dirName;
fName += "/count.txt";
- FILE *progFile = fopen(fName.c_str(),"w");
+ FILE *progFile = cmsys::SystemTools::Fopen(fName.c_str(),"w");
if (progFile)
{
fprintf(progFile,"%i\n",count);
@@ -417,7 +418,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// read the count
fName = dirName;
fName += "/count.txt";
- progFile = fopen(fName.c_str(),"r");
+ progFile = cmsys::SystemTools::Fopen(fName.c_str(),"r");
int count = 0;
if (!progFile)
{
@@ -437,7 +438,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
fName = dirName;
fName += "/";
fName += args[i];
- progFile = fopen(fName.c_str(),"w");
+ progFile = cmsys::SystemTools::Fopen(fName.c_str(),"w");
if (progFile)
{
fprintf(progFile,"empty");
@@ -946,7 +947,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
// Read command lines from the script.
- std::ifstream fin(args[2].c_str());
+ cmsys::ifstream fin(args[2].c_str());
if(!fin)
{
std::cerr << "Error opening link script \""
@@ -1057,7 +1058,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
// check for nmake temporary files
if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
{
- std::ifstream fin(i->substr(1).c_str());
+ cmsys::ifstream fin(i->substr(1).c_str());
std::string line;
while(cmSystemTools::GetLineFromStream(fin,
line))
@@ -1229,7 +1230,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
std::cout << "Create " << resourceInputFile.c_str() << "\n";
}
// Create input file for rc command
- std::ofstream fout(resourceInputFile.c_str());
+ cmsys::ofstream fout(resourceInputFile.c_str());
if(!fout)
{
return -1;
@@ -1252,7 +1253,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
{
std::cout << "Create empty: " << manifestFile.c_str() << "\n";
}
- std::ofstream foutTmp(manifestFile.c_str());
+ cmsys::ofstream foutTmp(manifestFile.c_str());
}
std::string resourceFile = manifestFile;
resourceFile += ".res";
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index de07458..3eb5551 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -18,6 +18,7 @@
#include "CTest/cmCTestScriptHandler.h"
#include "CTest/cmCTestLaunch.h"
+#include "cmsys/Encoding.hxx"
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -111,8 +112,13 @@ static const char * cmDocumentationOptions[][2] =
};
// this is a test driver program for cmCTest.
-int main (int argc, char *argv[])
+int main (int argc, char const* const* argv)
{
+ cmsys::Encoding::CommandLineArguments encoding_args =
+ cmsys::Encoding::CommandLineArguments::Main(argc, argv);
+ argc = encoding_args.argc();
+ argv = encoding_args.argv();
+
cmSystemTools::DoNotInheritStdPipes();
cmSystemTools::EnableMSVCDebugHook();
cmSystemTools::FindCMakeResources(argv[0]);
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 3745f78..24ea518 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -1136,6 +1136,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
testEncoding
)
ENDIF(KWSYS_STL_HAS_WSTRING)
+ IF(KWSYS_USE_FStream)
+ SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS}
+ testFStream
+ )
+ ENDIF(KWSYS_USE_FStream)
IF(KWSYS_USE_SystemInformation)
SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation)
ENDIF(KWSYS_USE_SystemInformation)
diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in
index 60a4a8e..aba4175 100644
--- a/Source/kwsys/Encoding.hxx.in
+++ b/Source/kwsys/Encoding.hxx.in
@@ -14,6 +14,7 @@
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string>
+#include <@KWSYS_NAMESPACE@/stl/vector>
/* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
@@ -25,6 +26,36 @@ namespace @KWSYS_NAMESPACE@
class @KWSYS_NAMESPACE@_EXPORT Encoding
{
public:
+
+ // Container class for argc/argv.
+ class CommandLineArguments
+ {
+ public:
+ // On Windows, get the program command line arguments
+ // in this Encoding module's 8 bit encoding.
+ // On other platforms the given argc/argv is used, and
+ // to be consistent, should be the argc/argv from main().
+ static CommandLineArguments Main(int argc, char const* const* argv);
+
+ // Construct CommandLineArguments with the given
+ // argc/argv. It is assumed that the string is already
+ // in the encoding used by this module.
+ CommandLineArguments(int argc, char const* const* argv);
+
+ // Construct CommandLineArguments with the given
+ // argc and wide argv. This is useful if wmain() is used.
+ CommandLineArguments(int argc, wchar_t const* const* argv);
+ ~CommandLineArguments();
+ CommandLineArguments(const CommandLineArguments&);
+ CommandLineArguments& operator=(const CommandLineArguments&);
+
+ int argc() const;
+ char const* const* argv() const;
+
+ protected:
+ std::vector<char*> argv_;
+ };
+
/**
* Convert between char and wchar_t
*/
diff --git a/Source/kwsys/EncodingC.c b/Source/kwsys/EncodingC.c
index a36eecc..cda78e2 100644
--- a/Source/kwsys/EncodingC.c
+++ b/Source/kwsys/EncodingC.c
@@ -68,7 +68,7 @@ size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
char* kwsysEncoding_DupToNarrow(const wchar_t* str)
{
char* ret = NULL;
- size_t length = kwsysEncoding_wcstombs(0, str, 0);
+ size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1;
if(length > 0)
{
ret = malloc(length);
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index aebc148..f76deb5 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -29,6 +29,7 @@
#endif
#include <stdlib.h>
+#include <string.h>
#ifdef _MSC_VER
# pragma warning (disable: 4786)
@@ -42,6 +43,98 @@
namespace KWSYS_NAMESPACE
{
+Encoding::CommandLineArguments
+Encoding::CommandLineArguments::Main(int argc, char const* const* argv)
+{
+#ifdef _WIN32
+ (void) argc;
+ (void) argv;
+
+ int ac;
+ LPWSTR* w_av = CommandLineToArgvW(GetCommandLineW(), &ac);
+
+ std::vector<std::string> av1(ac);
+ std::vector<char const*> av2(ac);
+ for(int i=0; i<ac; i++)
+ {
+ av1[i] = ToNarrow(w_av[i]);
+ av2[i] = av1[i].c_str();
+ }
+ LocalFree(w_av);
+ return CommandLineArguments(ac, &av2[0]);
+#else
+ return CommandLineArguments(argc, argv);
+#endif
+}
+
+Encoding::CommandLineArguments::CommandLineArguments(int ac,
+ char const* const* av)
+{
+ this->argv_.resize(ac+1);
+ for(int i=0; i<ac; i++)
+ {
+ this->argv_[i] = strdup(av[i]);
+ }
+ this->argv_[ac] = 0;
+}
+
+Encoding::CommandLineArguments::CommandLineArguments(int ac,
+ wchar_t const* const* av)
+{
+ this->argv_.resize(ac+1);
+ for(int i=0; i<ac; i++)
+ {
+ this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]);
+ }
+ this->argv_[ac] = 0;
+}
+
+Encoding::CommandLineArguments::~CommandLineArguments()
+{
+ for(size_t i=0; i<this->argv_.size(); i++)
+ {
+ free(argv_[i]);
+ }
+}
+
+Encoding::CommandLineArguments::
+ CommandLineArguments(const CommandLineArguments& other)
+{
+ this->argv_.resize(other.argv_.size());
+ for(size_t i=0; i<this->argv_.size(); i++)
+ {
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ }
+}
+
+Encoding::CommandLineArguments&
+Encoding::CommandLineArguments::operator=(const CommandLineArguments& other)
+{
+ size_t i;
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ free(this->argv_[i]);
+ }
+
+ this->argv_.resize(other.argv_.size());
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ }
+
+ return *this;
+}
+
+int Encoding::CommandLineArguments::argc() const
+{
+ return static_cast<int>(this->argv_.size() - 1);
+}
+
+char const* const* Encoding::CommandLineArguments::argv() const
+{
+ return &this->argv_[0];
+}
+
#if KWSYS_STL_HAS_WSTRING
kwsys_stl::wstring Encoding::ToWide(const kwsys_stl::string& str)
diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in
index 8170fb3..916a93e 100644
--- a/Source/kwsys/FStream.hxx.in
+++ b/Source/kwsys/FStream.hxx.in
@@ -25,8 +25,9 @@ namespace @KWSYS_NAMESPACE@
typedef std::basic_filebuf<CharType,Traits> my_base_type;
basic_filebuf *open(char const *s,std::ios_base::openmode mode)
{
- my_base_type::open(Encoding::ToWide(s).c_str(), mode);
- return this;
+ return static_cast<basic_filebuf*>(
+ my_base_type::open(Encoding::ToWide(s).c_str(), mode)
+ );
}
};
@@ -81,7 +82,7 @@ namespace @KWSYS_NAMESPACE@
internal_buffer_type *rdbuf() const
{
- return buf_.get();
+ return buf_;
}
~basic_ifstream()
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index b9af2f1..faeb967 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -2449,6 +2449,7 @@ static void kwsysProcessKill(pid_t process_id)
if(f)
{
size_t nread = fread(buffer, 1, KWSYSPE_PIPE_BUFFER_SIZE, f);
+ fclose(f);
buffer[nread] = '\0';
if(nread > 0)
{
@@ -2463,7 +2464,6 @@ static void kwsysProcessKill(pid_t process_id)
}
}
}
- fclose(f);
}
}
}
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 2f6c949..5f20853 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -3162,8 +3162,17 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
kwsys_stl::string cores =
this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
int numberOfCoresPerCPU=atoi(cores.c_str());
- this->NumberOfPhysicalCPU=static_cast<unsigned int>(
- numberOfCoresPerCPU*(maxId+1));
+ if (maxId > 0)
+ {
+ this->NumberOfPhysicalCPU=static_cast<unsigned int>(
+ numberOfCoresPerCPU*(maxId+1));
+ }
+ else
+ {
+ // Linux Sparc: get cpu count
+ this->NumberOfPhysicalCPU=
+ atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
+ }
#else // __CYGWIN__
// does not have "physical id" entries, neither "cpu cores"
@@ -3185,7 +3194,19 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// CPU speed (checking only the first processor)
kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
- this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
+ if(!CPUSpeed.empty())
+ {
+ this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
+ }
+#ifdef __linux
+ else
+ {
+ // Linux Sparc: CPU speed is in Hz and encoded in hexadecimal
+ CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"Cpu0ClkTck");
+ this->CPUSpeedInMHz = static_cast<float>(
+ strtoull(CPUSpeed.c_str(),0,16))/1000000.0f;
+ }
+#endif
// Chip family
kwsys_stl::string familyStr =
@@ -4991,7 +5012,12 @@ bool SystemInformationImplementation::QueryHPUXProcessor()
case CPU_PA_RISC2_0:
this->ChipID.Vendor = "Hewlett-Packard";
this->ChipID.Family = 0x200;
+# ifdef CPU_HP_INTEL_EM_1_0
+ case CPU_HP_INTEL_EM_1_0:
+# endif
+# ifdef CPU_IA64_ARCHREV_0
case CPU_IA64_ARCHREV_0:
+# endif
this->ChipID.Vendor = "GenuineIntel";
this->Features.HasIA64 = true;
break;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 4649f3b..f4a443f 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2115,10 +2115,10 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
SystemTools::RemoveFile(destination);
#if defined(_WIN32) || defined(__CYGWIN__)
- kwsys_ios::ofstream fout(destination,
+ kwsys::ofstream fout(destination,
kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#else
- kwsys_ios::ofstream fout(destination,
+ kwsys::ofstream fout(destination,
kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#endif
if(!fout)
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index 25832c2..6d7ec41 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -155,6 +155,7 @@ static const char* kwsysTerminalVT100Names[] =
"mach-color",
"mlterm",
"putty",
+ "putty-256color",
"rxvt",
"rxvt-256color",
"rxvt-cygwin",
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index 8e74a50..094588c 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -16,14 +16,18 @@
#endif
#include KWSYS_HEADER(Encoding.hxx)
+#include KWSYS_HEADER(Encoding.h)
#include KWSYS_HEADER(ios/iostream)
#include <locale.h>
+#include <string.h>
+#include <stdlib.h>
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "Encoding.hxx.in"
+# include "Encoding.h.in"
# include "kwsys_ios_iostream.h.in"
#endif
@@ -68,11 +72,16 @@ static int testHelloWorldEncoding()
std::cout << str << std::endl;
std::wstring wstr = kwsys::Encoding::ToWide(str);
std::string str2 = kwsys::Encoding::ToNarrow(wstr);
- if(!wstr.empty() && str != str2)
+ wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str());
+ char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr);
+ if(!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str())))
{
std::cout << "converted string was different: " << str2 << std::endl;
+ std::cout << "converted string was different: " << c_str2 << std::endl;
ret++;
}
+ free(c_wstr);
+ free(c_str2);
}
return ret;
}
@@ -136,6 +145,36 @@ static int testRobustEncoding()
return ret;
}
+static int testCommandLineArguments()
+{
+ int status = 0;
+
+ char const* argv[2] = {
+ "./app.exe",
+ (char const*)helloWorldStrings[1]
+ };
+
+ kwsys::Encoding::CommandLineArguments args(2, argv);
+ kwsys::Encoding::CommandLineArguments arg2 =
+ kwsys::Encoding::CommandLineArguments(args);
+
+ char const* const* u8_argv = args.argv();
+ for(int i=0; i<args.argc(); i++)
+ {
+ char const* u8_arg = u8_argv[i];
+ if(strcmp(argv[i], u8_arg) != 0)
+ {
+ std::cout << "argv[" << i << "] " << argv[i] << " != "
+ << u8_arg << std::endl;
+ status++;
+ }
+ }
+
+ kwsys::Encoding::CommandLineArguments args3 =
+ kwsys::Encoding::CommandLineArguments::Main(2, argv);
+
+ return status;
+}
//----------------------------------------------------------------------------
int testEncoding(int, char*[])
@@ -154,6 +193,7 @@ int testEncoding(int, char*[])
ret |= testHelloWorldEncoding();
ret |= testRobustEncoding();
+ ret |= testCommandLineArguments();
return ret;
}
diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx
new file mode 100644
index 0000000..8942549
--- /dev/null
+++ b/Source/kwsys/testFStream.cxx
@@ -0,0 +1,48 @@
+/*============================================================================
+ KWSys - Kitware System Library
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "kwsysPrivate.h"
+
+#if defined(_MSC_VER)
+# pragma warning (disable:4786)
+#endif
+
+#include KWSYS_HEADER(FStream.hxx)
+
+// Work-around CMake dependency scanning limitation. This must
+// duplicate the above list of headers.
+#if 0
+# include "FStream.hxx.in"
+#endif
+
+
+//----------------------------------------------------------------------------
+static int testNoFile()
+{
+ kwsys::ifstream in_file("NoSuchFile.txt");
+ if(in_file)
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+//----------------------------------------------------------------------------
+int testFStream(int, char*[])
+{
+ int ret = 0;
+
+ ret |= testNoFile();
+
+ return ret;
+}
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt
index fdb1638..9467fae 100644
--- a/Tests/AliasTarget/CMakeLists.txt
+++ b/Tests/AliasTarget/CMakeLists.txt
@@ -48,3 +48,25 @@ endif()
add_library(iface INTERFACE)
add_library(Alias::Iface ALIAS iface)
+
+get_target_property(_notAlias1 foo ALIASED_TARGET)
+if (NOT DEFINED _notAlias1)
+ message(SEND_ERROR "_notAlias1 is not defined")
+endif()
+if (_notAlias1)
+ message(SEND_ERROR "_notAlias1 is defined, but foo is not an ALIAS")
+endif()
+if (NOT _notAlias1 STREQUAL _notAlias1-NOTFOUND)
+ message(SEND_ERROR "_notAlias1 not defined to a -NOTFOUND variant")
+endif()
+
+get_property(_notAlias2 TARGET foo PROPERTY ALIASED_TARGET)
+if (NOT DEFINED _notAlias2)
+ message(SEND_ERROR "_notAlias2 is not defined")
+endif()
+if (_notAlias2)
+ message(SEND_ERROR "_notAlias2 is defined, but foo is not an ALIAS")
+endif()
+if (NOT _notAlias2 STREQUAL _notAlias2-NOTFOUND)
+ message(SEND_ERROR "_notAlias2 not defined to a -NOTFOUND variant")
+endif()
diff --git a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt
index 1652cf6..995b32c 100644
--- a/Tests/CMakeCommands/add_compile_options/CMakeLists.txt
+++ b/Tests/CMakeCommands/add_compile_options/CMakeLists.txt
@@ -12,3 +12,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
"DO_GNU_TESTS"
)
endif()
+
+add_compile_options(-rtti)
+add_library(imp UNKNOWN IMPORTED)
+get_target_property(_res imp COMPILE_OPTIONS)
+if (_res)
+ message(SEND_ERROR "add_compile_options populated the COMPILE_OPTIONS target property")
+endif()
diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
index 900dbd0..14d40aa 100644
--- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt
@@ -25,3 +25,10 @@ target_compile_definitions(consumer
target_compile_definitions(consumer
PRIVATE
)
+
+add_definitions(-DSOME_DEF)
+add_library(imp UNKNOWN IMPORTED)
+get_target_property(_res imp COMPILE_DEFINITIONS)
+if (_res)
+ message(SEND_ERROR "add_definitions populated the COMPILE_DEFINITIONS target property")
+endif()
diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
index 8a564c7..661bbaa 100644
--- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt
@@ -62,3 +62,10 @@ target_include_directories(consumer
target_include_directories(consumer
SYSTEM PRIVATE
)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+add_library(imp UNKNOWN IMPORTED)
+get_target_property(_res imp INCLUDE_DIRECTORIES)
+if (_res)
+ message(SEND_ERROR "include_directories populated the INCLUDE_DIRECTORIES target property")
+endif()
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9e74b7d..78dddd3 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -285,24 +285,6 @@ if(BUILD_TESTING)
PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked)")
endif()
- if(CMAKE_TEST_GENERATOR MATCHES Make)
- set(InterfaceBuildTargets_libname testlib)
- if (CMAKE_TEST_GENERATOR MATCHES "Borland|Watcom")
- set(InterfaceBuildTargets_libname testlib.lib)
- endif()
- add_test(InterfaceBuildTargets ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/InterfaceBuildTargets"
- "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets"
- --build-two-config
- ${build_generator_args}
- --build-project InterfaceBuildTargets
- --build-options ${build_options}
- --test-command ${CMAKE_CMAKE_COMMAND} -E touch_nocreate ${InterfaceBuildTargets_libname}
- )
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/InterfaceBuildTargets")
- endif()
-
list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
if(NOT QT4_FOUND)
@@ -2186,6 +2168,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--output-log "${CMake_BINARY_DIR}/Tests/CTestConfig/ScriptWithArgs.log"
)
+ ADD_TEST_MACRO(CMakeCommands.add_compile_options add_compile_options)
ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries)
ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions)
@@ -2237,6 +2220,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ADD_TEST_MACRO(CTestTestSerialInDepends ${CMAKE_CTEST_COMMAND} -j 4
--output-on-failure -C "\${CTestTest_CONFIG}")
+ ADD_TEST_MACRO(CTestTestMissingDependsExe ${CMAKE_CTEST_COMMAND}
+ --output-on-failure -C "\${CTestTest_CONFIG}")
+ set_tests_properties(CTestTestMissingDependsExe PROPERTIES
+ PASS_REGULAR_EXPRESSION "\\*\\*\\*Not Run"
+ )
+
+ ADD_TEST_MACRO(CTestTestSerialOrder ${CMAKE_CTEST_COMMAND}
+ --output-on-failure -C "\${CTestTest_CONFIG}")
+
if(NOT BORLAND)
set(CTestLimitDashJ_CTEST_OPTIONS --force-new-ctest-process)
add_test_macro(CTestLimitDashJ ${CMAKE_CTEST_COMMAND} -j 4
diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt
index ecfecdb..bc3322e 100644
--- a/Tests/CPackWiXGenerator/CMakeLists.txt
+++ b/Tests/CPackWiXGenerator/CMakeLists.txt
@@ -49,6 +49,10 @@ set(CPACK_PACKAGE_EXECUTABLES
"my-other-app" "Second CPack WiX Test"
)
+set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml")
+
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
+
include(CPack)
cpack_add_install_type(Full DISPLAY_NAME "Everything")
diff --git a/Tests/CPackWiXGenerator/license.txt b/Tests/CPackWiXGenerator/license.txt
new file mode 100644
index 0000000..7942783
--- /dev/null
+++ b/Tests/CPackWiXGenerator/license.txt
@@ -0,0 +1,9 @@
+hello world
+merhaba dünya
+ハローワールド
+привет мир
+مرحبا العالم
+你好世界
+
+4-Byte sequences:
+ Perch (Fish) 𩶘 Elevator 𨋢!
diff --git a/Tests/CPackWiXGenerator/patch.xml b/Tests/CPackWiXGenerator/patch.xml
new file mode 100644
index 0000000..13c392d
--- /dev/null
+++ b/Tests/CPackWiXGenerator/patch.xml
@@ -0,0 +1,7 @@
+<CPackWiXPatch>
+ <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe">
+ <Environment Id="MyEnvironment" Action="set"
+ Name="CPackWiXGeneratorTest"
+ Value="CPackWiXGeneratorTest"/>
+ </CPackWiXFragment>
+</CPackWiXPatch>
diff --git a/Tests/CTestTest/test.cmake.in b/Tests/CTestTest/test.cmake.in
index 214bff8..ab39b88 100644
--- a/Tests/CTestTest/test.cmake.in
+++ b/Tests/CTestTest/test.cmake.in
@@ -6,7 +6,7 @@
# this is the cvs module name that should be checked out
set (CTEST_MODULE_NAME SmallAndFast)
-# these are the the name of the source and binary directory on disk.
+# these are the name of the source and binary directory on disk.
# They will be appended to DASHBOARD_ROOT
set (CTEST_SOURCE_NAME SmallAndFast)
set (CTEST_BINARY_NAME SmallAndFastBuild)
diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt
index b5162c9..9bd7249 100644
--- a/Tests/CTestTestMemcheck/CMakeLists.txt
+++ b/Tests/CTestTestMemcheck/CMakeLists.txt
@@ -1,5 +1,13 @@
REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+get_filename_component(CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR
+ "${CMAKE_CURRENT_BINARY_DIR}" REALPATH
+)
+
+REGEX_ESCAPE_STRING(CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR
+ "${CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR}"
+)
+
foreach (_retval 0 1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY)
endforeach ()
@@ -180,7 +188,7 @@ set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES
PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n")
set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES
- PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n")
+ PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n")
set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES
PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n")
diff --git a/Tests/CTestTestMissingDependsExe/CMakeLists.txt b/Tests/CTestTestMissingDependsExe/CMakeLists.txt
new file mode 100644
index 0000000..9826da6
--- /dev/null
+++ b/Tests/CTestTestMissingDependsExe/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+project(CTestTestMissingDependsExe)
+
+enable_testing()
+
+add_test(test1 ${CMAKE_COMMAND} -E echo test)
+add_test(test2 non-existent-command)
+
+set_tests_properties(test1 PROPERTIES DEPENDS test2)
diff --git a/Tests/CTestTestSerialOrder/CMakeLists.txt b/Tests/CTestTestSerialOrder/CMakeLists.txt
new file mode 100644
index 0000000..69c11fc
--- /dev/null
+++ b/Tests/CTestTestSerialOrder/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+project(CTestTestSerialOrder)
+
+set(TEST_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/test_output.txt")
+
+enable_testing()
+
+function(add_serial_order_test TEST_NAME)
+ add_test(NAME ${TEST_NAME}
+ COMMAND ${CMAKE_COMMAND}
+ "-DTEST_OUTPUT_FILE=${TEST_OUTPUT_FILE}"
+ "-DTEST_NAME=${TEST_NAME}"
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/test.cmake"
+ )
+
+ if(ARGC GREATER 1)
+ set_tests_properties(${TEST_NAME} PROPERTIES ${ARGN})
+ endif()
+endfunction()
+
+add_serial_order_test(initialization COST 1000)
+add_serial_order_test(test1)
+add_serial_order_test(test2)
+add_serial_order_test(test3)
+add_serial_order_test(test4 DEPENDS test5)
+
+add_serial_order_test(test5)
+set_tests_properties(test5 PROPERTIES DEPENDS "test6;test7b;test7a")
+
+add_serial_order_test(test6 COST -2)
+add_serial_order_test(test7a COST -1)
+add_serial_order_test(test7b COST -1)
+add_serial_order_test(test8 COST 10)
+add_serial_order_test(test9 COST 20)
+add_serial_order_test(test10 COST 0)
+add_serial_order_test(test11)
+add_serial_order_test(test12 COST 0)
+
+add_serial_order_test(verification COST -1000)
diff --git a/Tests/CTestTestSerialOrder/test.cmake b/Tests/CTestTestSerialOrder/test.cmake
new file mode 100644
index 0000000..8479cae
--- /dev/null
+++ b/Tests/CTestTestSerialOrder/test.cmake
@@ -0,0 +1,31 @@
+list(APPEND EXPECTED_OUTPUT
+ initialization
+ test9
+ test8
+ test1
+ test2
+ test3
+ test6
+ test7a
+ test7b
+ test5
+ test4
+ test10
+ test11
+ test12
+)
+
+
+if("${TEST_NAME}" STREQUAL "initialization")
+ file(WRITE ${TEST_OUTPUT_FILE} "${TEST_NAME}")
+
+elseif("${TEST_NAME}" STREQUAL "verification")
+ file(READ ${TEST_OUTPUT_FILE} ACTUAL_OUTPUT)
+ if(NOT "${ACTUAL_OUTPUT}" STREQUAL "${EXPECTED_OUTPUT}")
+ message(FATAL_ERROR "Actual test order [${ACTUAL_OUTPUT}] differs from expected test order [${EXPECTED_OUTPUT}]")
+ endif()
+
+else()
+ file(APPEND ${TEST_OUTPUT_FILE} ";${TEST_NAME}")
+
+endif()
diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt
index 5e64d2a..350b518 100644
--- a/Tests/CompatibleInterface/CMakeLists.txt
+++ b/Tests/CompatibleInterface/CMakeLists.txt
@@ -24,6 +24,8 @@ set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MIN
NUMBER_MIN_PROP1
NUMBER_MIN_PROP2
+ NUMBER_MIN_PROP3
+ NUMBER_MIN_PROP4
)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MAX
@@ -34,7 +36,7 @@ set_property(TARGET iface1 APPEND PROPERTY
set(CMAKE_DEBUG_TARGET_PROPERTIES
BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4
STRING_PROP1 STRING_PROP2 STRING_PROP3
- NUMBER_MIN_PROP1 NUMBER_MIN_PROP2
+ NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4
NUMBER_MAX_PROP1 NUMBER_MAX_PROP2
)
@@ -44,6 +46,8 @@ set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1)
set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP3 0x10)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP4 0x10)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200)
@@ -56,6 +60,8 @@ set_property(TARGET CompatibleInterface PROPERTY STRING_PROP2 prop2)
set_property(TARGET CompatibleInterface PROPERTY STRING_PROP3 prop3)
set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP1 50)
set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP2 250)
+set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP3 0xa)
+set_property(TARGET CompatibleInterface PROPERTY NUMBER_MIN_PROP4 0x1A)
set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP1 50)
set_property(TARGET CompatibleInterface PROPERTY NUMBER_MAX_PROP2 250)
@@ -69,6 +75,8 @@ target_compile_definitions(CompatibleInterface
$<$<STREQUAL:$<TARGET_PROPERTY:STRING_PROP3>,prop3>:STRING_PROP3>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP1>,50>:NUMBER_MIN_PROP1=50>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP2>,200>:NUMBER_MIN_PROP2=200>
+ $<$<EQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP3>,0xA>:NUMBER_MIN_PROP3=0xA>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP4>,0x10>:NUMBER_MIN_PROP4=0x10>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP1>,100>:NUMBER_MAX_PROP1=100>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP2>,250>:NUMBER_MAX_PROP2=250>
)
diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp
index fa299e9..e23625a 100644
--- a/Tests/CompatibleInterface/main.cpp
+++ b/Tests/CompatibleInterface/main.cpp
@@ -33,7 +33,9 @@ enum {
NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>),
NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>),
NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>),
- NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>)
+ NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>),
+ NumericMinTest3 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP3 == 0xA>),
+ NumericMinTest4 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP4 == 0x10>)
};
#include "iface2.h"
diff --git a/Tests/Contracts/VTK/Dashboard.cmake.in b/Tests/Contracts/VTK/Dashboard.cmake.in
index e33a2de..c3d10f4 100644
--- a/Tests/Contracts/VTK/Dashboard.cmake.in
+++ b/Tests/Contracts/VTK/Dashboard.cmake.in
@@ -1,3 +1,11 @@
+# This submission's role is to test leading edge of cmake development
+# against VTK release
+#
+# Maintainer: Zack Galbreath <zack.galbreath@kitware.com>
+#
+# This file was generated as part of the CMake/VTK Contracts test.
+# See <CMake-src>/Tests/Contracts/VTK/ for more information
+
set(CTEST_SITE "@SITE@")
set(CTEST_BUILD_NAME "Contracts.VTK")
set(CTEST_DASHBOARD_ROOT "@base_dir@")
@@ -6,6 +14,7 @@ set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/VTK-build")
set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
set(CTEST_CONFIGURATION_TYPE Debug)
+set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
# Assume a Linux build, with a make that supports -j9. Modify this script if
# assumption is ever invalid.
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
index b713262..9d4793d 100644
--- a/Tests/ExportImport/Export/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -23,12 +23,10 @@ set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_
add_library(sharediface INTERFACE)
target_link_libraries(sharediface INTERFACE sharedlib)
-export(TARGETS sharediface sharedlib headeronly
- NAMESPACE bld::
- FILE ../ExportInterfaceBuildTree.cmake
+install(TARGETS headeronly sharediface
+ EXPORT expInterface
)
-
-install(TARGETS headeronly sharediface sharedlib
+install(TARGETS sharedlib
EXPORT expInterface
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib NAMELINK_SKIP
@@ -47,3 +45,8 @@ install(FILES
)
install(EXPORT expInterface NAMESPACE exp:: DESTINATION lib/exp)
+
+export(EXPORT expInterface
+ NAMESPACE bld::
+ FILE ../ExportInterfaceBuildTree.cmake
+)
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index edadb87..3b85dc3 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -13,6 +13,7 @@ add_custom_target(check-part1 ALL
-Dtest_1=$<1:content>
-Dtest_1_with_comma=$<1:-Wl,--no-undefined>
-Dconfig=$<CONFIGURATION>
+ -Dshort_config=$<CONFIG>
-Dtest_and_0=$<AND:0>
-Dtest_and_0_0=$<AND:0,0>
-Dtest_and_0_1=$<AND:0,1>
@@ -193,9 +194,32 @@ add_custom_target(check-part3 ALL
-Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
-Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
-Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
- -Dlower_case=$<LOWER_CASE:MiXeD>
- -Dupper_case=$<UPPER_CASE:MiXeD>
- -Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4foo:+bar-$>
+ -Dlower_case=$<LOWER_CASE:Mi,XeD>
+ -Dupper_case=$<UPPER_CASE:MiX,eD>
+ -Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4f,oo:+bar-$>
+ -Dequal1=$<EQUAL:1,2>
+ -Dequal2=$<EQUAL:1,1>
+ -Dequal3=$<EQUAL:0x1,1>
+ -Dequal4=$<EQUAL:0X1,2>
+ -Dequal5=$<EQUAL:0xA,0xa>
+ -Dequal6=$<EQUAL:0xA,10>
+ -Dequal7=$<EQUAL:0xA,012>
+ -Dequal8=$<EQUAL:10,012>
+ -Dequal9=$<EQUAL:10,010>
+ -Dequal10=$<EQUAL:10,0b1010>
+ -Dequal11=$<EQUAL:-10,-0xa>
+ -Dequal12=$<EQUAL:10,+0xa>
+ -Dequal13=$<EQUAL:+10,+0Xa>
+ -Dequal14=$<EQUAL:+10,0xa>
+ -Dequal15=$<EQUAL:-10,-0Xa>
+ -Dequal16=$<EQUAL:-10,-0b1010>
+ -Dequal17=$<EQUAL:-10,+0b1010>
+ -Dequal18=$<EQUAL:10,+0B1010>
+ -Dequal19=$<EQUAL:10,-0B1010>
+ -Dequal20=$<EQUAL:10,0B1010>
+ -Dequal21=$<EQUAL:10,+012>
+ -Dequal22=$<EQUAL:10,-012>
+ -Dequal23=$<EQUAL:-10,-012>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
VERBATIM
diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake
index 9bef159..3207582 100644
--- a/Tests/GeneratorExpression/check-part1.cmake
+++ b/Tests/GeneratorExpression/check-part1.cmake
@@ -2,6 +2,7 @@
include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
message(STATUS "config=[${config}]")
+check(config "${short_config}")
check(test_0 "")
check(test_0_with_comma "")
check(test_1 "content")
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index a86db31..70ccfe1 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -34,6 +34,29 @@ foreach(system Linux Windows Darwin)
check(test_platform_id_${system} 0)
endif()
endforeach()
-check(lower_case "mixed")
-check(upper_case "MIXED")
-check(make_c_identifier "_4foo__bar__")
+check(lower_case "mi,xed")
+check(upper_case "MIX,ED")
+check(make_c_identifier "_4f_oo__bar__")
+check(equal1 "0")
+check(equal2 "1")
+check(equal3 "1")
+check(equal4 "0")
+check(equal5 "1")
+check(equal6 "1")
+check(equal7 "1")
+check(equal8 "1")
+check(equal9 "0")
+check(equal10 "1")
+check(equal11 "1")
+check(equal12 "1")
+check(equal13 "1")
+check(equal14 "1")
+check(equal15 "1")
+check(equal16 "1")
+check(equal17 "0")
+check(equal18 "1")
+check(equal19 "0")
+check(equal20 "1")
+check(equal21 "1")
+check(equal22 "0")
+check(equal23 "1")
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
index 1f5c93b..abe9f74 100644
--- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
@@ -25,6 +25,10 @@ add_library(imported_consumer imported_consumer.cpp)
target_link_libraries(imported_consumer iface)
target_compile_options(imported_consumer PRIVATE -Werror=unused-variable)
+add_library(imported_consumer2 imported_consumer.cpp)
+target_link_libraries(imported_consumer2 imported_consumer)
+target_compile_options(imported_consumer2 PRIVATE -Werror=unused-variable)
+
macro(do_try_compile error_option)
set(TC_ARGS
IFACE_TRY_COMPILE_${error_option}
diff --git a/Tests/InterfaceBuildTargets/CMakeLists.txt b/Tests/InterfaceBuildTargets/CMakeLists.txt
deleted file mode 100644
index a00e5d5..0000000
--- a/Tests/InterfaceBuildTargets/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-project(InterfaceBuildTargets)
-
-add_library(testlib EXCLUDE_FROM_ALL testlib.cxx)
-set_property(TARGET testlib PROPERTY PREFIX "")
-if(CMAKE_GENERATOR MATCHES "Borland|Watcom")
- # These librarians add the .lib suffix anyway.
- set_property(TARGET testlib PROPERTY SUFFIX ".lib")
-else()
- set_property(TARGET testlib PROPERTY SUFFIX "")
-endif()
-
-add_library(iface INTERFACE)
-target_link_libraries(iface INTERFACE testlib)
diff --git a/Tests/InterfaceBuildTargets/main.cxx b/Tests/InterfaceBuildTargets/main.cxx
deleted file mode 100644
index e9ad257..0000000
--- a/Tests/InterfaceBuildTargets/main.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-
-int main(int, char**)
-{
- return 0;
-}
diff --git a/Tests/InterfaceBuildTargets/testlib.cxx b/Tests/InterfaceBuildTargets/testlib.cxx
deleted file mode 100644
index 02bd6b0..0000000
--- a/Tests/InterfaceBuildTargets/testlib.cxx
+++ /dev/null
@@ -1,5 +0,0 @@
-
-void testlib(void)
-{
-
-}
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index 53aeb03..b396eb6 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -6,10 +6,26 @@ project(InterfaceLibrary)
add_library(iface_nodepends INTERFACE)
target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE)
+add_subdirectory(headerdir)
+
add_executable(InterfaceLibrary definetestexe.cpp)
-target_link_libraries(InterfaceLibrary iface_nodepends)
+target_link_libraries(InterfaceLibrary iface_nodepends headeriface)
add_subdirectory(libsdir)
add_executable(sharedlibtestexe sharedlibtestexe.cpp)
-target_link_libraries(sharedlibtestexe shared_iface)
+target_link_libraries(sharedlibtestexe shared_iface imported::iface)
+
+add_library(broken EXCLUDE_FROM_ALL broken.cpp)
+
+add_library(iface_broken INTERFACE)
+# This is not a dependency, so broken will not be built (and the error in
+# it will not be hit)
+target_link_libraries(iface_broken INTERFACE broken)
+
+add_library(iface_whitelist INTERFACE)
+# The target property CUSTOM will never be evaluated on the INTERFACE library.
+target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTOM>>:irrelevant>)
+
+add_executable(exec_whitelist dummy.cpp)
+target_link_libraries(exec_whitelist iface_whitelist)
diff --git a/Tests/InterfaceLibrary/broken.cpp b/Tests/InterfaceLibrary/broken.cpp
new file mode 100644
index 0000000..1fd1041
--- /dev/null
+++ b/Tests/InterfaceLibrary/broken.cpp
@@ -0,0 +1,2 @@
+
+#error Broken
diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp
index decd37c..e7a10c1 100644
--- a/Tests/InterfaceLibrary/definetestexe.cpp
+++ b/Tests/InterfaceLibrary/definetestexe.cpp
@@ -3,6 +3,18 @@
#error Expected IFACE_DEFINE
#endif
+#include "iface_header.h"
+
+#ifndef IFACE_HEADER_SRCDIR
+#error Expected IFACE_HEADER_SRCDIR
+#endif
+
+#include "iface_header_builddir.h"
+
+#ifndef IFACE_HEADER_BUILDDIR
+#error Expected IFACE_HEADER_BUILDDIR
+#endif
+
int main(int,char**)
{
return 0;
diff --git a/Tests/InterfaceLibrary/dummy.cpp b/Tests/InterfaceLibrary/dummy.cpp
new file mode 100644
index 0000000..341aaaf
--- /dev/null
+++ b/Tests/InterfaceLibrary/dummy.cpp
@@ -0,0 +1,5 @@
+
+int main(int, char **)
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
new file mode 100644
index 0000000..98f521e
--- /dev/null
+++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
@@ -0,0 +1,8 @@
+
+set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+
+add_library(headeriface INTERFACE)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/iface_header_builddir.h"
+ "#define IFACE_HEADER_BUILDDIR\n"
+)
diff --git a/Tests/InterfaceLibrary/headerdir/iface_header.h b/Tests/InterfaceLibrary/headerdir/iface_header.h
new file mode 100644
index 0000000..82dd157
--- /dev/null
+++ b/Tests/InterfaceLibrary/headerdir/iface_header.h
@@ -0,0 +1 @@
+#define IFACE_HEADER_SRCDIR
diff --git a/Tests/InterfaceLibrary/libsdir/CMakeLists.txt b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt
index 6999646..4e529df 100644
--- a/Tests/InterfaceLibrary/libsdir/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt
@@ -24,3 +24,5 @@ target_compile_definitions(shareddependlib
add_library(shared_iface INTERFACE)
target_link_libraries(shared_iface INTERFACE sharedlib)
+
+add_library(imported::iface INTERFACE IMPORTED GLOBAL)
diff --git a/Tests/LinkDirectory/CMakeLists.txt b/Tests/LinkDirectory/CMakeLists.txt
index b8d5a04..c60de84 100644
--- a/Tests/LinkDirectory/CMakeLists.txt
+++ b/Tests/LinkDirectory/CMakeLists.txt
@@ -11,13 +11,11 @@ endif()
add_library(mylibA STATIC mylibA.c)
set_property(TARGET mylibA PROPERTY
ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/External/lib")
-# get_property(mylibA TARGET mylibA PROPERTY LOCATION)
# Build a library into our build tree relative to the subproject build tree.
add_library(mylibB STATIC mylibB.c)
set_property(TARGET mylibB PROPERTY
ARCHIVE_OUTPUT_DIRECTORY "${LinkDirectory_BINARY_DIR}/lib")
-# get_property(mylibB TARGET mylibB PROPERTY LOCATION)
# Create a custom target to drive the subproject build.
include(ExternalProject)
diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt
index 5fc54f4..ade0a3c 100644
--- a/Tests/MacRuntimePath/A/CMakeLists.txt
+++ b/Tests/MacRuntimePath/A/CMakeLists.txt
@@ -10,13 +10,15 @@ add_library(shared2 SHARED shared.cpp shared.h)
set_target_properties(shared2 PROPERTIES
BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")
+cmake_policy(SET CMP0042 NEW)
+
# a framework library
add_library(framework SHARED framework.cpp framework.h)
-set_target_properties(framework PROPERTIES MACOSX_RPATH 1 FRAMEWORK 1)
+set_target_properties(framework PROPERTIES FRAMEWORK 1)
# another framework
add_library(framework2 SHARED framework2.cpp framework2.h)
-set_target_properties(framework2 PROPERTIES MACOSX_RPATH 1 FRAMEWORK 1)
+set_target_properties(framework2 PROPERTIES FRAMEWORK 1)
# executable to test a shared library dependency with install rpaths
add_executable(test1 test1.cpp)
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt
index 09f1881..bf867a9 100644
--- a/Tests/Module/GenerateExportHeader/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt
@@ -55,93 +55,9 @@ else()
endif()
endif()
-set(DEPS
- libshared
- libstatic
- lib_shared_and_static
-)
-
-foreach(DEP ${DEPS})
- try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/${DEP}_build
- ${CMAKE_CURRENT_SOURCE_DIR}/${DEP}
- ${DEP}
- OUTPUT_VARIABLE Out
- )
- if (NOT Result)
- message("OUTPUT: ${Out}")
- endif()
-endforeach()
-
-# The _do_build macro is called from a child scope, where
-# the current source and binary dir are different. Save them here
-# for use in the macro.
-set(TEST_TOP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(TEST_TOP_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
-
-
-# We seem to get race conditions is writing this stuff to the same file at least on MinGW
-# So to write to separate source and build directories, we use a count to differentiate.
-set (COUNT 0)
-macro(_do_build Include Library LibrarySource Source)
-
- math(EXPR COUNT "${COUNT} + 1" )
-
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/src.cpp" "#include \"${Include}\"\n"
- "int main() { ${Source}; }\n"
- )
-
- if ("${Library}" STREQUAL "static_variant")
- set(CONDITIONAL_STATIC_DEFINE "add_definitions(-DLIBSHARED_AND_STATIC_STATIC_DEFINE)\n")
- endif()
-
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}/CMakeLists.txt"
- "cmake_minimum_required(VERSION 2.8)\n"
-
- "project(compiletest)\n"
-
- "set(CMAKE_INCLUDE_CURRENT_DIR ON)\n"
-
- "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"\${CMAKE_CURRENT_BINARY_DIR}\")\n"
-
- "include(GenerateExportHeader)\n"
-
- "add_compiler_export_flags()\n"
-
- "if(NOT \"${ERROR_FLAG}\" STREQUAL \"\")\n"
- " add_definitions(${ERROR_FLAG})\n"
- "endif()\n"
-
- "include(\"${TEST_TOP_BINARY_DIR}/${LibrarySource}_build/Targets.cmake\")\n"
-
- "include_directories(\"${TEST_TOP_SOURCE_DIR}/${LibrarySource}\"\n"
- " \"${TEST_TOP_BINARY_DIR}/${LibrarySource}_build\")\n"
-
- "${CONDITIONAL_STATIC_DEFINE}"
-
- "add_executable(compiletest src.cpp)\n"
- "target_link_libraries(compiletest ${Library})\n"
- )
-
- try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/fail${COUNT}
- ${CMAKE_CURRENT_BINARY_DIR}/test${COUNT}
- compiletest
- OUTPUT_VARIABLE Out
- )
-endmacro()
-
-macro(build_fail Include Library LibrarySource Source Message)
- _do_build(${Include} ${Library} ${LibrarySource} "${Source}")
- test_fail(Result ${Message})
-endmacro()
-
-macro(build_pass Include Library LibrarySource Source Message)
- _do_build(${Include} ${Library} ${LibrarySource} "${Source}")
- test_pass(Result ${Message})
-endmacro()
-
include(GenerateExportHeader)
-add_subdirectory(visibility_preset)
+add_subdirectory(lib_shared_and_static)
add_compiler_export_flags()
@@ -159,23 +75,17 @@ macro(macro_add_test_library name)
${${name}_BINARY_DIR} # For the export header.
)
list(APPEND link_libraries ${name})
- add_subdirectory(${name}test)
endmacro()
macro_add_test_library(libshared)
macro_add_test_library(libstatic)
-add_subdirectory(lib_shared_and_static)
-add_subdirectory(lib_shared_and_statictest)
-add_subdirectory(override_symbol)
add_subdirectory(nodeprecated)
-add_subdirectory(prefix)
if(NOT BORLAND)
add_subdirectory(c_identifier)
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang))
- # We deliberately call deprecated methods, and test for that elsewhere.
# No need to clutter the test output with warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
@@ -187,3 +97,24 @@ endif()
add_executable(GenerateExportHeader exportheader_test.cpp)
target_link_libraries(GenerateExportHeader ${link_libraries})
+if (WIN32)
+ if(MSVC AND COMPILER_HAS_DEPRECATED)
+ set(_platform Win32)
+ elseif(MINGW AND COMPILER_HAS_DEPRECATED)
+ set(_platform MinGW)
+ else()
+ set(_platform WinEmpty)
+ endif()
+elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
+ set(_platform UNIX)
+elseif(COMPILER_HAS_DEPRECATED)
+ set(_platform UNIX_DeprecatedOnly)
+else()
+ set(_platform Empty)
+endif()
+message("#### Testing reference: ${_platform}")
+target_compile_definitions(GenerateExportHeader
+ PRIVATE
+ "SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}"
+ "BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+)
diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp
index 55c3c1a..146374a 100644
--- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp
+++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp
@@ -11,6 +11,52 @@
#define DOES_NOT_BUILD(function) function
#endif
+#include <fstream>
+#include <iostream>
+#include <stdlib.h>
+#include <string>
+
+void compare(const char* refName, const char* testName)
+{
+ std::ifstream ref;
+ ref.open(refName);
+ if (!ref.is_open())
+ {
+ std::cout << "Could not open \"" << refName << "\"." << std::endl;
+ exit(1);
+ }
+ std::ifstream test;
+ test.open(testName);
+ if (!test.is_open())
+ {
+ std::cout << "Could not open \"" << testName << "\"." << std::endl;
+ exit(1);
+ }
+
+ while (!ref.eof() && !test.eof())
+ {
+ std::string refLine;
+ std::string testLine;
+ std::getline(ref, refLine);
+ std::getline(test, testLine);
+ if (testLine.size() && testLine[testLine.size()-1] == ' ')
+ {
+ testLine = testLine.substr(0, testLine.size() - 1);
+ }
+ if (refLine != testLine)
+ {
+ std::cout << "Ref and test are not the same:\n Ref: \""
+ << refLine << "\"\n Test: \"" << testLine << "\"\n";
+ exit(1);
+ }
+ }
+ if (!ref.eof() || !test.eof())
+ {
+ std::cout << "Ref and test have differing numbers of lines.";
+ exit(1);
+ }
+}
+
int main()
{
{
@@ -78,5 +124,13 @@ int main()
libstatic_not_exported();
libstatic_excluded();
+#define STRINGIFY_IMPL(A) #A
+#define STRINGIFY(A) STRINGIFY_IMPL(A)
+
+ compare(STRINGIFY(SRC_DIR) "/libshared_export.h",
+ STRINGIFY(BIN_DIR) "/libshared/libshared_export.h");
+ compare(STRINGIFY(SRC_DIR) "/libstatic_export.h",
+ STRINGIFY(BIN_DIR) "/libstatic/libstatic_export.h");
+
return 0;
}
diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt
index be0387f..c1be125 100644
--- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt
@@ -5,7 +5,15 @@ project(lib_shared_and_static)
include(GenerateExportHeader)
-add_compiler_export_flags()
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+
+if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden")
+ message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
+endif()
+if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden")
+ message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
+endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -14,9 +22,13 @@ set(lib_SRCS
)
add_library(shared_variant SHARED ${lib_SRCS})
+set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL)
add_library(static_variant ${lib_SRCS})
-generate_export_header(shared_variant BASE_NAME libshared_and_static)
+generate_export_header(shared_variant
+ BASE_NAME libshared_and_static
+ PREFIX_NAME MYPREFIX_
+)
set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h
index 049bfe9..5ad77f4 100644
--- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h
+++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h
@@ -4,51 +4,51 @@
#include "libshared_and_static_export.h"
-class LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic {
+class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic {
public:
int libshared_and_static() const;
int libshared_and_static_exported() const;
- int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const;
int libshared_and_static_not_exported() const;
- int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const;
};
class LibsharedAndStaticNotExported {
public:
int libshared_and_static() const;
- int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const;
- int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const;
int libshared_and_static_not_exported() const;
- int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const;
};
-class LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded {
+class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded {
public:
int libshared_and_static() const;
- int LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT libshared_and_static_exported() const;
- int LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED libshared_and_static_deprecated() const;
int libshared_and_static_not_exported() const;
- int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded() const;
};
-LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported();
+MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported();
-LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated();
+MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int libshared_and_static_deprecated();
int libshared_and_static_not_exported();
-int LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded();
+int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded();
#endif
diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt
deleted file mode 100644
index 207534d..0000000
--- a/Tests/Module/GenerateExportHeader/lib_shared_and_statictest/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-
-macro(shared_variant_build_pass Source Message)
- build_pass("libshared_and_static.h" "shared_variant" "lib_shared_and_static" "${Source}" ${Message})
-endmacro()
-
-macro(shared_variant_build_fail Source Message)
- build_fail("libshared_and_static.h" "shared_variant" "lib_shared_and_static" "${Source}" ${Message})
-endmacro()
-
-macro(static_variant_build_pass Source Message)
- build_pass("libshared_and_static.h" "static_variant" "lib_shared_and_static" "${Source}" ${Message})
-endmacro()
-
-macro(static_variant_build_fail Source Message)
- build_fail("libshared_and_static.h" "static_variant" "lib_shared_and_static" "${Source}" ${Message})
-endmacro()
-
-static_variant_build_pass("return libshared_and_static_exported();" "Failed to build static variant")
-shared_variant_build_pass("return libshared_and_static_exported();" "Failed to build shared variant")
-# if (COMPILER_HAS_DEPRECATED)
-# shared_variant_build_fail("return libshared_and_static_deprecated();" "Built shared deprecated variant")
-# static_variant_build_fail("return libshared_and_static_deprecated();" "Built static deprecated variant")
-# else()
-# shared_variant_build_pass("return libshared_and_static_deprecated();" "Built shared deprecated variant")
-# static_variant_build_pass("return libshared_and_static_deprecated();" "Built static deprecated variant")
-# endif()
-static_variant_build_pass("return libshared_and_static_not_exported();" "Failed to build static not exported variant")
-
-if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY)
- shared_variant_build_fail("return libshared_and_static_not_exported();" "Built shared not exported variant")
-else()
- shared_variant_build_pass("return libshared_and_static_not_exported();" "Built shared not exported variant")
-endif()
diff --git a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
deleted file mode 100644
index 2a97d8f..0000000
--- a/Tests/Module/GenerateExportHeader/libsharedtest/CMakeLists.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-
-macro(shared_build_pass Source Message)
- build_pass("libshared.h" "libshared" "libshared" "${Source}" ${Message})
-endmacro()
-
-macro(shared_build_fail Source Message)
- build_fail("libshared.h" "libshared" "libshared" "${Source}" ${Message})
-endmacro()
-
-shared_build_pass("Libshared l; return l.libshared_exported();" "Failed to build exported")
-shared_build_pass("return libshared_exported();" "Failed to build exported function.")
-
-# if (COMPILER_HAS_DEPRECATED)
-# shared_build_fail("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
-# else()
-# shared_build_pass("Libshared l; return l.libshared_deprecated();" "Built use of deprecated class method. This should not be possible.")
-# endif()
-if (COMPILER_HAS_HIDDEN_VISIBILITY)
- shared_build_fail("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
-else()
- # There is no MSVC equivalent to hiding symbols.
- shared_build_pass("Libshared l; return l.libshared_excluded();" "Built use of excluded class method. This is possible on MSVC.")
-endif()
-
-if (WIN32 OR COMPILER_HAS_HIDDEN_VISIBILITY)
- shared_build_fail("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method. This should not be possible.")
- shared_build_fail("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method. This should not be possible.")
- shared_build_fail("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method. This should not be possible.")
- shared_build_fail("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method. This should not be possible.")
- shared_build_fail("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method. This should not be possible.")
- shared_build_fail("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method. This should not be possible.")
-
- shared_build_fail("return libshared_excluded();" "Built use of excluded function. This should not be possible.")
- shared_build_fail("return libshared_not_exported();" "Built use of not-exported function. This should not be possible.")
-else()
- shared_build_pass("LibsharedNotExported l; return l.libshared();" "Built use of not-exported class method.")
- shared_build_pass("LibsharedNotExported l; return l.libshared_not_exported();" "Built use of not-exported class method.")
- shared_build_pass("LibsharedNotExported l; return l.libshared_excluded();" "Built use of not-exported class method.")
- shared_build_pass("LibsharedExcluded l; return l.libshared();" "Built use of excluded class method.")
- shared_build_pass("LibsharedExcluded l; return l.libshared_not_exported();" "Built use of excluded class method.")
- shared_build_pass("LibsharedExcluded l; return l.libshared_excluded();" "Built use of excluded class method.")
-
- shared_build_pass("return libshared_excluded();" "Built use of excluded function.")
- shared_build_pass("return libshared_not_exported();" "Built use of not-exported function.")
-endif()
diff --git a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt b/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt
deleted file mode 100644
index eb6bb87..0000000
--- a/Tests/Module/GenerateExportHeader/libstatictest/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-
-macro(static_build_pass Source Message)
- build_pass("libstatic.h" "libstatic" "libstatic" "${Source}" ${Message})
-endmacro()
-
-macro(static_build_fail Source Message)
- build_fail("libstatic.h" "libstatic" "libstatic" "${Source}" ${Message})
-endmacro()
-
-static_build_pass("Libstatic l; return l.libstatic_exported();" "Failed to build exported.")
-
-# if (COMPILER_HAS_DEPRECATED)
-# static_build_fail("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.")
-# static_build_fail("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.")
-# else()
-# static_build_pass("Libstatic l; return l.libstatic_deprecated();" "Built use of deprecated class method. This should not be possible.")
-# static_build_pass("libstatic_deprecated();" "Built use of deprecated function. This should not be possible.")
-# endif()
diff --git a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt b/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt
deleted file mode 100644
index aeeef20..0000000
--- a/Tests/Module/GenerateExportHeader/override_symbol/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-project(override_symbol)
-
-add_library(somelib SHARED someclass.cpp)
-
-set_target_properties(somelib PROPERTIES DEFINE_SYMBOL SOMELIB_MAKEDLL)
-
-generate_export_header(somelib)
-
-add_executable(consumer main.cpp)
-
-target_link_libraries(consumer somelib)
diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp
deleted file mode 100644
index eec46d3..0000000
--- a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#include "someclass.h"
-
-int main(int, char**)
-{
- SomeClass sc;
- sc.someMethod();
- return 0;
-}
diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp
deleted file mode 100644
index 427ec29..0000000
--- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#include "someclass.h"
-
-void SomeClass::someMethod() const
-{
-
-}
diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h b/Tests/Module/GenerateExportHeader/override_symbol/someclass.h
deleted file mode 100644
index ae5e844..0000000
--- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.h
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#include "somelib_export.h"
-
-class SOMELIB_EXPORT SomeClass
-{
-public:
- void someMethod() const;
-};
diff --git a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt b/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt
deleted file mode 100644
index bd64df2..0000000
--- a/Tests/Module/GenerateExportHeader/prefix/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-project(use_prefix)
-
-set(use_prefix_lib_SRCS
- useprefixclass.cpp
-)
-
-add_library(use_prefix_lib SHARED useprefixclass.cpp)
-
-generate_export_header(use_prefix_lib
- PREFIX_NAME MYPREFIX_
-)
-
-add_executable(use_prefix main.cpp)
-
-target_link_libraries(use_prefix use_prefix_lib) \ No newline at end of file
diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp
deleted file mode 100644
index 507f6fd..0000000
--- a/Tests/Module/GenerateExportHeader/prefix/main.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#include "useprefixclass.h"
-
-int main(int argc, char **argv)
-{
- UsePrefixClass upc;
- return upc.someMethod();
-}
diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp
deleted file mode 100644
index 1fd2cb2..0000000
--- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#include "useprefixclass.h"
-
-int UsePrefixClass::someMethod() const
-{
- return 0;
-}
diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h
deleted file mode 100644
index f5e31b5..0000000
--- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-#ifndef USEPREFIXCLASS_H
-#define USEPREFIXCLASS_H
-
-#include "use_prefix_lib_export.h"
-
-class MYPREFIX_USE_PREFIX_LIB_EXPORT UsePrefixClass
-{
-public:
- int someMethod() const;
-};
-
-#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h
new file mode 100644
index 0000000..b6749b2
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/Empty/libshared_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSHARED_EXPORT_H
+#define LIBSHARED_EXPORT_H
+
+#ifdef LIBSHARED_STATIC_DEFINE
+# define LIBSHARED_EXPORT
+# define LIBSHARED_NO_EXPORT
+#else
+# ifndef LIBSHARED_EXPORT
+# ifdef libshared_EXPORTS
+ /* We are building this library */
+# define LIBSHARED_EXPORT
+# else
+ /* We are using this library */
+# define LIBSHARED_EXPORT
+# endif
+# endif
+
+# ifndef LIBSHARED_NO_EXPORT
+# define LIBSHARED_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSHARED_DEPRECATED
+# define LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_EXPORT
+# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
+# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSHARED_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h
new file mode 100644
index 0000000..e8000e2
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/Empty/libstatic_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSTATIC_EXPORT_H
+#define LIBSTATIC_EXPORT_H
+
+#ifdef LIBSTATIC_STATIC_DEFINE
+# define LIBSTATIC_EXPORT
+# define LIBSTATIC_NO_EXPORT
+#else
+# ifndef LIBSTATIC_EXPORT
+# ifdef libstatic_EXPORTS
+ /* We are building this library */
+# define LIBSTATIC_EXPORT
+# else
+ /* We are using this library */
+# define LIBSTATIC_EXPORT
+# endif
+# endif
+
+# ifndef LIBSTATIC_NO_EXPORT
+# define LIBSTATIC_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED
+# define LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_EXPORT
+# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
+# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSTATIC_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h
new file mode 100644
index 0000000..d376631
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libshared_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSHARED_EXPORT_H
+#define LIBSHARED_EXPORT_H
+
+#ifdef LIBSHARED_STATIC_DEFINE
+# define LIBSHARED_EXPORT
+# define LIBSHARED_NO_EXPORT
+#else
+# ifndef LIBSHARED_EXPORT
+# ifdef libshared_EXPORTS
+ /* We are building this library */
+# define LIBSHARED_EXPORT __declspec(dllexport)
+# else
+ /* We are using this library */
+# define LIBSHARED_EXPORT __declspec(dllimport)
+# endif
+# endif
+
+# ifndef LIBSHARED_NO_EXPORT
+# define LIBSHARED_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSHARED_DEPRECATED
+# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_EXPORT
+# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
+# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSHARED_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h
new file mode 100644
index 0000000..fd021e9
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/MinGW/libstatic_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSTATIC_EXPORT_H
+#define LIBSTATIC_EXPORT_H
+
+#ifdef LIBSTATIC_STATIC_DEFINE
+# define LIBSTATIC_EXPORT
+# define LIBSTATIC_NO_EXPORT
+#else
+# ifndef LIBSTATIC_EXPORT
+# ifdef libstatic_EXPORTS
+ /* We are building this library */
+# define LIBSTATIC_EXPORT
+# else
+ /* We are using this library */
+# define LIBSTATIC_EXPORT
+# endif
+# endif
+
+# ifndef LIBSTATIC_NO_EXPORT
+# define LIBSTATIC_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED
+# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_EXPORT
+# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
+# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSTATIC_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h
new file mode 100644
index 0000000..7d8087f
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libshared_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSHARED_EXPORT_H
+#define LIBSHARED_EXPORT_H
+
+#ifdef LIBSHARED_STATIC_DEFINE
+# define LIBSHARED_EXPORT
+# define LIBSHARED_NO_EXPORT
+#else
+# ifndef LIBSHARED_EXPORT
+# ifdef libshared_EXPORTS
+ /* We are building this library */
+# define LIBSHARED_EXPORT __attribute__((visibility("default")))
+# else
+ /* We are using this library */
+# define LIBSHARED_EXPORT __attribute__((visibility("default")))
+# endif
+# endif
+
+# ifndef LIBSHARED_NO_EXPORT
+# define LIBSHARED_NO_EXPORT __attribute__((visibility("hidden")))
+# endif
+#endif
+
+#ifndef LIBSHARED_DEPRECATED
+# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_EXPORT
+# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
+# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSHARED_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h
new file mode 100644
index 0000000..fd021e9
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/UNIX/libstatic_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSTATIC_EXPORT_H
+#define LIBSTATIC_EXPORT_H
+
+#ifdef LIBSTATIC_STATIC_DEFINE
+# define LIBSTATIC_EXPORT
+# define LIBSTATIC_NO_EXPORT
+#else
+# ifndef LIBSTATIC_EXPORT
+# ifdef libstatic_EXPORTS
+ /* We are building this library */
+# define LIBSTATIC_EXPORT
+# else
+ /* We are using this library */
+# define LIBSTATIC_EXPORT
+# endif
+# endif
+
+# ifndef LIBSTATIC_NO_EXPORT
+# define LIBSTATIC_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED
+# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_EXPORT
+# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
+# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSTATIC_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h
new file mode 100644
index 0000000..5681f58
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSHARED_EXPORT_H
+#define LIBSHARED_EXPORT_H
+
+#ifdef LIBSHARED_STATIC_DEFINE
+# define LIBSHARED_EXPORT
+# define LIBSHARED_NO_EXPORT
+#else
+# ifndef LIBSHARED_EXPORT
+# ifdef libshared_EXPORTS
+ /* We are building this library */
+# define LIBSHARED_EXPORT
+# else
+ /* We are using this library */
+# define LIBSHARED_EXPORT
+# endif
+# endif
+
+# ifndef LIBSHARED_NO_EXPORT
+# define LIBSHARED_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSHARED_DEPRECATED
+# define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_EXPORT
+# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
+# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSHARED_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h
new file mode 100644
index 0000000..fd021e9
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSTATIC_EXPORT_H
+#define LIBSTATIC_EXPORT_H
+
+#ifdef LIBSTATIC_STATIC_DEFINE
+# define LIBSTATIC_EXPORT
+# define LIBSTATIC_NO_EXPORT
+#else
+# ifndef LIBSTATIC_EXPORT
+# ifdef libstatic_EXPORTS
+ /* We are building this library */
+# define LIBSTATIC_EXPORT
+# else
+ /* We are using this library */
+# define LIBSTATIC_EXPORT
+# endif
+# endif
+
+# ifndef LIBSTATIC_NO_EXPORT
+# define LIBSTATIC_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED
+# define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_EXPORT
+# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
+# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSTATIC_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h
new file mode 100644
index 0000000..976c92e
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/Win32/libshared_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSHARED_EXPORT_H
+#define LIBSHARED_EXPORT_H
+
+#ifdef LIBSHARED_STATIC_DEFINE
+# define LIBSHARED_EXPORT
+# define LIBSHARED_NO_EXPORT
+#else
+# ifndef LIBSHARED_EXPORT
+# ifdef libshared_EXPORTS
+ /* We are building this library */
+# define LIBSHARED_EXPORT __declspec(dllexport)
+# else
+ /* We are using this library */
+# define LIBSHARED_EXPORT __declspec(dllimport)
+# endif
+# endif
+
+# ifndef LIBSHARED_NO_EXPORT
+# define LIBSHARED_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSHARED_DEPRECATED
+# define LIBSHARED_DEPRECATED __declspec(deprecated)
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_EXPORT
+# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
+# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSHARED_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h
new file mode 100644
index 0000000..db4df61
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/Win32/libstatic_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSTATIC_EXPORT_H
+#define LIBSTATIC_EXPORT_H
+
+#ifdef LIBSTATIC_STATIC_DEFINE
+# define LIBSTATIC_EXPORT
+# define LIBSTATIC_NO_EXPORT
+#else
+# ifndef LIBSTATIC_EXPORT
+# ifdef libstatic_EXPORTS
+ /* We are building this library */
+# define LIBSTATIC_EXPORT
+# else
+ /* We are using this library */
+# define LIBSTATIC_EXPORT
+# endif
+# endif
+
+# ifndef LIBSTATIC_NO_EXPORT
+# define LIBSTATIC_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED
+# define LIBSTATIC_DEPRECATED __declspec(deprecated)
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_EXPORT
+# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
+# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSTATIC_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h
new file mode 100644
index 0000000..2dc41d4
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libshared_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSHARED_EXPORT_H
+#define LIBSHARED_EXPORT_H
+
+#ifdef LIBSHARED_STATIC_DEFINE
+# define LIBSHARED_EXPORT
+# define LIBSHARED_NO_EXPORT
+#else
+# ifndef LIBSHARED_EXPORT
+# ifdef libshared_EXPORTS
+ /* We are building this library */
+# define LIBSHARED_EXPORT __declspec(dllexport)
+# else
+ /* We are using this library */
+# define LIBSHARED_EXPORT __declspec(dllimport)
+# endif
+# endif
+
+# ifndef LIBSHARED_NO_EXPORT
+# define LIBSHARED_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSHARED_DEPRECATED
+# define LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_EXPORT
+# define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#ifndef LIBSHARED_DEPRECATED_NO_EXPORT
+# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSHARED_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h
new file mode 100644
index 0000000..e8000e2
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/reference/WinEmpty/libstatic_export.h
@@ -0,0 +1,41 @@
+
+#ifndef LIBSTATIC_EXPORT_H
+#define LIBSTATIC_EXPORT_H
+
+#ifdef LIBSTATIC_STATIC_DEFINE
+# define LIBSTATIC_EXPORT
+# define LIBSTATIC_NO_EXPORT
+#else
+# ifndef LIBSTATIC_EXPORT
+# ifdef libstatic_EXPORTS
+ /* We are building this library */
+# define LIBSTATIC_EXPORT
+# else
+ /* We are using this library */
+# define LIBSTATIC_EXPORT
+# endif
+# endif
+
+# ifndef LIBSTATIC_NO_EXPORT
+# define LIBSTATIC_NO_EXPORT
+# endif
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED
+# define LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_EXPORT
+# define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT
+# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define LIBSTATIC_NO_DEPRECATED
+#endif
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt b/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt
deleted file mode 100644
index 2571d22..0000000
--- a/Tests/Module/GenerateExportHeader/visibility_preset/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-
-set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
-
-if (CMAKE_CXX_FLAGS MATCHES "-fvisibility=hidden")
- message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
-endif()
-if (CMAKE_CXX_FLAGS MATCHES "-fvisibility-inlines-hidden")
- message(SEND_ERROR "Do not use add_compiler_export_flags before adding this directory")
-endif()
-
-add_library(visibility_preset SHARED visibility_preset.cpp)
-generate_export_header(visibility_preset)
-
-add_executable(visibility_preset_exe main.cpp)
-
-target_link_libraries(visibility_preset_exe visibility_preset)
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp
deleted file mode 100644
index 89c3977..0000000
--- a/Tests/Module/GenerateExportHeader/visibility_preset/main.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#include "visibility_preset.h"
-
-int main()
-{
- VisibilityPreset vp;
- vp.someMethod();
- return 0;
-}
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp
deleted file mode 100644
index c97dec6..0000000
--- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#include "visibility_preset.h"
-
-void VisibilityPreset::someMethod()
-{
-
-}
diff --git a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h b/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h
deleted file mode 100644
index 8becbe1..0000000
--- a/Tests/Module/GenerateExportHeader/visibility_preset/visibility_preset.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-#ifndef VISIBILITY_PRESET_H
-#define VISIBILITY_PRESET_H
-
-#include "visibility_preset_export.h"
-
-class VISIBILITY_PRESET_EXPORT VisibilityPreset
-{
-public:
- void someMethod();
-};
-
-#endif
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 9dd5289..7b99395 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -47,7 +47,6 @@ add_custom_target(generate_moc_input
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h"
)
-# set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" PROPERTIES GENERATED TRUE)
add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp
xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot>
diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake
index 57c3ed0..2e76ee0 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared.cmake
@@ -1,5 +1,7 @@
enable_language(CXX)
+cmake_policy(SET CMP0042 NEW)
+
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
target_link_libraries(bar foo)
diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
index fe7e858..e3552b2 100644
--- a/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
+++ b/Tests/RunCMake/CMP0022/CMP0022-WARN.cmake
@@ -1,6 +1,8 @@
project(CMP0022-WARN)
+cmake_policy(SET CMP0042 NEW)
+
add_library(foo SHARED empty_vs6_1.cpp)
add_library(bar SHARED empty_vs6_2.cpp)
add_library(bat SHARED empty_vs6_3.cpp)
diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt
index a7b0799..711ad0e 100644
--- a/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt
@@ -1,6 +1,6 @@
CMake Error at CMP0028-NEW.cmake:4 \(add_library\):
Target "foo" links to target "External::Library" but the target was not
found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or
- a ALIAS target is missing\?
+ an ALIAS target is missing\?
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt
index 2ff6927..41d7560 100644
--- a/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt
+++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt
@@ -5,7 +5,7 @@ CMake Warning \(dev\) at CMP0028-WARN.cmake:2 \(add_library\):
Target "foo" links to target "External::Library" but the target was not
found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or
- a ALIAS target is missing\?
+ an ALIAS target is missing\?
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-NEW-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-NEW-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake
new file mode 100644
index 0000000..778a444
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-NEW.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0042 NEW)
+
+add_library(foo SHARED empty.cpp)
diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-OLD-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake
new file mode 100644
index 0000000..1aede96
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-OLD.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0042 OLD)
+
+add_library(foo SHARED empty.cpp)
diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt
new file mode 100644
index 0000000..f3574a1
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-WARN-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\):
+ Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
+ --help-policy CMP0042" for policy details. Use the cmake_policy command to
+ set the policy and suppress this warning.
+
+ MACOSX_RPATH is not specified for the following targets:
+
+ foo
+
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake
new file mode 100644
index 0000000..3fa32b1
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMP0042-WARN.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo SHARED empty.cpp)
+add_library(foo-static STATIC empty.cpp)
+add_library(foo2 SHARED empty.cpp)
+set_target_properties(foo2 PROPERTIES MACOSX_RPATH 1)
+add_library(foo3 SHARED empty.cpp)
+set_target_properties(foo3 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@loader_path")
+add_library(foo4 SHARED empty.cpp)
+set_target_properties(foo4 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath")
diff --git a/Tests/RunCMake/CMP0042/CMakeLists.txt b/Tests/RunCMake/CMP0042/CMakeLists.txt
new file mode 100644
index 0000000..11ea636
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0042/RunCMakeTest.cmake b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake
new file mode 100644
index 0000000..3b226d7
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0042-OLD)
+run_cmake(CMP0042-NEW)
+run_cmake(CMP0042-WARN)
diff --git a/Tests/RunCMake/CMP0042/empty.cpp b/Tests/RunCMake/CMP0042/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/CMP0042/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 96b0543..96724ce 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -61,6 +61,9 @@ add_RunCMake_test(CMP0038)
add_RunCMake_test(CMP0039)
add_RunCMake_test(CMP0040)
add_RunCMake_test(CMP0041)
+if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
+ add_RunCMake_test(CMP0042)
+endif()
add_RunCMake_test(CTest)
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic.cmake b/Tests/RunCMake/CompatibleInterface/AutoUic.cmake
index 86bd5a0..03635e2 100644
--- a/Tests/RunCMake/CompatibleInterface/AutoUic.cmake
+++ b/Tests/RunCMake/CompatibleInterface/AutoUic.cmake
@@ -1,9 +1,6 @@
find_package(Qt4 REQUIRED)
-set(QT_CORE_TARGET Qt4::QtCore)
-set(QT_GUI_TARGET Qt4::QtGui)
-
set(CMAKE_AUTOUIC ON)
set(CMAKE_DEBUG_TARGET_PROPERTIES AUTOUIC_OPTIONS)
@@ -19,4 +16,4 @@ set_property(TARGET OtherI18n APPEND PROPERTY
)
add_library(LibWidget empty.cpp)
-target_link_libraries(LibWidget KI18n OtherI18n ${QT_GUI_TARGET})
+target_link_libraries(LibWidget KI18n OtherI18n Qt4::QtGui)
diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
index 0044564..17b8a5c 100644
--- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
+++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
@@ -25,6 +25,28 @@ CMake Debug Log:
\* Target "CompatibleInterface" property not set.
+
CMake Debug Log:
+ Boolean compatibility of property "BOOL_PROP5" for target
+ "CompatibleInterface" \(result: "FALSE"\):
+
+ \* Target "CompatibleInterface" property not set.
+ \* Target "iface1" property value "FALSE" \(Interface set\)
++
+CMake Debug Log:
+ Boolean compatibility of property "BOOL_PROP6" for target
+ "CompatibleInterface" \(result: "FALSE"\):
+
+ \* Target "CompatibleInterface" property not set.
+ \* Target "iface1" property value "FALSE" \(Interface set\)
+ \* Target "iface2" property value "FALSE" \(Agree\)
++
+CMake Debug Log:
+ Boolean compatibility of property "BOOL_PROP7" for target
+ "CompatibleInterface" \(result: "FALSE"\):
+
+ \* Target "CompatibleInterface" property is implied by use.
+ \* Target "iface1" property value "FALSE" \(Agree\)
++
+CMake Debug Log:
String compatibility of property "STRING_PROP1" for target
"CompatibleInterface" \(result: "prop1"\):
@@ -45,6 +67,12 @@ CMake Debug Log:
\* Target "CompatibleInterface" has property content "prop3"
+
CMake Debug Log:
+ String compatibility of property "STRING_PROP4" for target
+ "CompatibleInterface" \(result: "\(unset\)"\):
+
+ \* Target "CompatibleInterface" property not set.
++
+CMake Debug Log:
Numeric minimum compatibility of property "NUMBER_MIN_PROP1" for target
"CompatibleInterface" \(result: "50"\):
diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake
index 3214d8e..0196611 100644
--- a/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake
+++ b/Tests/RunCMake/CompatibleInterface/DebugProperties.cmake
@@ -13,12 +13,16 @@ set_property(TARGET iface1 APPEND PROPERTY
BOOL_PROP2
BOOL_PROP3
BOOL_PROP4
+ BOOL_PROP5
+ BOOL_PROP6
+ BOOL_PROP7
)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING
STRING_PROP1
STRING_PROP2
STRING_PROP3
+ STRING_PROP4 # Not set.
)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MIN
@@ -32,14 +36,17 @@ set_property(TARGET iface1 APPEND PROPERTY
)
set(CMAKE_DEBUG_TARGET_PROPERTIES
- BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4
- STRING_PROP1 STRING_PROP2 STRING_PROP3
+ BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 BOOL_PROP5 BOOL_PROP6 BOOL_PROP7
+ STRING_PROP1 STRING_PROP2 STRING_PROP3 STRING_PROP4
NUMBER_MIN_PROP1 NUMBER_MIN_PROP2
NUMBER_MAX_PROP1 NUMBER_MAX_PROP2
)
set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON)
set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON)
+set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP5 OFF)
+set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP6 OFF)
+set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP7 OFF)
set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1)
set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100)
@@ -47,8 +54,15 @@ set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200)
+add_library(iface2 INTERFACE)
+set_property(TARGET iface2 PROPERTY INTERFACE_BOOL_PROP6 OFF)
+
+add_library(iface3 INTERFACE)
+
add_executable(CompatibleInterface empty.cpp)
-target_link_libraries(CompatibleInterface iface1)
+target_link_libraries(CompatibleInterface iface1 iface2
+ $<$<BOOL:$<TARGET_PROPERTY:BOOL_PROP7>>:iface3>
+)
set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP2 ON)
set_property(TARGET CompatibleInterface PROPERTY BOOL_PROP3 ON)
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt
new file mode 100644
index 0000000..723daec
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error: Property SOMEPROP on target "user" is
+implied to be empty because it was used to determine the link libraries
+already. The INTERFACE_SOMEPROP property on
+dependency "foo" is in conflict.
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake
new file mode 100644
index 0000000..a064d76
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceNumber-mismatched-use.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo UNKNOWN IMPORTED)
+add_library(bar UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN SOMEPROP)
+set_property(TARGET foo PROPERTY INTERFACE_SOMEPROP 42)
+
+add_executable(user main.cpp)
+target_link_libraries(user foo $<$<STREQUAL:$<TARGET_PROPERTY:SOMEPROP>,42>:bar>)
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt
index 5a8f99d..900e3f8 100644
--- a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict-stderr.txt
@@ -2,4 +2,5 @@ CMake Error in CMakeLists.txt:
Property "SOMETHING" appears in both the COMPATIBLE_INTERFACE_BOOL and the
COMPATIBLE_INTERFACE_STRING property in the dependencies of target "user".
This is not allowed. A property may only require compatibility in a
- boolean interpretation or a string interpretation, but not both.
+ boolean interpretation, a numeric minimum, a numeric maximum or a string
+ interpretation, but not a mixture.
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake
index 711368a..4bae804 100644
--- a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Conflict.cmake
@@ -1,9 +1,8 @@
add_library(foo UNKNOWN IMPORTED)
-add_library(bar UNKNOWN IMPORTED)
set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SOMETHING)
set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING SOMETHING)
add_executable(user main.cpp)
-target_link_libraries(user foo bar)
+target_link_libraries(user foo)
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt
new file mode 100644
index 0000000..2cfbae4
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error in CMakeLists.txt:
+ Property "OTHER" appears in both the COMPATIBLE_INTERFACE_BOOL,
+ COMPATIBLE_INTERFACE_NUMBER_MIN and the COMPATIBLE_INTERFACE_STRING
+ property in the dependencies of target "user". This is not allowed. A
+ property may only require compatibility in a boolean interpretation, a
+ numeric minimum, a numeric maximum or a string interpretation, but not a
+ mixture.
diff --git a/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake
new file mode 100644
index 0000000..164ffd9
--- /dev/null
+++ b/Tests/RunCMake/CompatibleInterface/InterfaceString-Bool-Min-Conflict.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo UNKNOWN IMPORTED)
+
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL OTHER)
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_STRING OTHER)
+set_property(TARGET foo APPEND PROPERTY COMPATIBLE_INTERFACE_NUMBER_MIN OTHER)
+
+add_executable(user main.cpp)
+target_link_libraries(user foo)
diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
index b87adc8..0b9729b 100644
--- a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake
@@ -7,8 +7,10 @@ run_cmake(InterfaceBool-builtin-prop)
run_cmake(InterfaceString-mismatch-depends)
run_cmake(InterfaceString-mismatch-depend-self)
run_cmake(InterfaceString-mismatched-use)
+run_cmake(InterfaceNumber-mismatched-use)
run_cmake(InterfaceString-builtin-prop)
run_cmake(InterfaceString-Bool-Conflict)
+run_cmake(InterfaceString-Bool-Min-Conflict)
run_cmake(DebugProperties)
if (QT_QMAKE_EXECUTABLE})
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
index 1cfbf40..964ea4d 100644
--- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt
@@ -1,15 +1,6 @@
CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
Error evaluating generator expression:
- \$<CONFIG>
-
- \$<CONFIG> expression requires exactly one parameter.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
-CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
- Error evaluating generator expression:
-
\$<CONFIG:.>
Expression syntax not recognized.
@@ -21,7 +12,7 @@ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\):
\$<CONFIG:Foo,Bar>
- \$<CONFIG> expression requires exactly one parameter.
+ \$<CONFIG> expression requires one or zero parameters.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
index c27ea5f..5c22aaa 100644
--- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
+++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake
@@ -1,5 +1,4 @@
add_custom_target(check ALL COMMAND check
- $<CONFIG>
$<CONFIG:.>
$<CONFIG:Foo,Bar>
$<CONFIG:Foo-Bar>
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 6533b75..5a80872 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -11,3 +11,8 @@
\* CMP0020
\* CMP0021
\* CMP0022
+ \* CMP0041
+ \* CMP0042
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/AppendExport-result.txt b/Tests/RunCMake/export/AppendExport-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/AppendExport-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/AppendExport-stderr.txt b/Tests/RunCMake/export/AppendExport-stderr.txt
new file mode 100644
index 0000000..6e385d4
--- /dev/null
+++ b/Tests/RunCMake/export/AppendExport-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at AppendExport.cmake:8 \(export\):
+ export EXPORT signature does not recognise the APPEND option.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/AppendExport.cmake b/Tests/RunCMake/export/AppendExport.cmake
new file mode 100644
index 0000000..f36010b
--- /dev/null
+++ b/Tests/RunCMake/export/AppendExport.cmake
@@ -0,0 +1,8 @@
+add_library(foo empty.cpp)
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+export(EXPORT fooExport APPEND FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
diff --git a/Tests/RunCMake/export/NoExportSet-result.txt b/Tests/RunCMake/export/NoExportSet-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/NoExportSet-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/NoExportSet-stderr.txt b/Tests/RunCMake/export/NoExportSet-stderr.txt
new file mode 100644
index 0000000..9d27805
--- /dev/null
+++ b/Tests/RunCMake/export/NoExportSet-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoExportSet.cmake:2 \(export\):
+ export Export set "fooExport" not found.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/NoExportSet.cmake b/Tests/RunCMake/export/NoExportSet.cmake
new file mode 100644
index 0000000..72390e8
--- /dev/null
+++ b/Tests/RunCMake/export/NoExportSet.cmake
@@ -0,0 +1,2 @@
+
+export(EXPORT fooExport)
diff --git a/Tests/RunCMake/export/OldIface-result.txt b/Tests/RunCMake/export/OldIface-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/OldIface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/OldIface-stderr.txt b/Tests/RunCMake/export/OldIface-stderr.txt
new file mode 100644
index 0000000..afb4ae3
--- /dev/null
+++ b/Tests/RunCMake/export/OldIface-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at OldIface.cmake:8 \(export\):
+ export EXPORT signature does not recognise the
+ EXPORT_LINK_INTERFACE_LIBRARIES option.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/OldIface.cmake b/Tests/RunCMake/export/OldIface.cmake
new file mode 100644
index 0000000..5fb8e25
--- /dev/null
+++ b/Tests/RunCMake/export/OldIface.cmake
@@ -0,0 +1,10 @@
+add_library(foo empty.cpp)
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake")
+install(TARGETS foo EXPORT fooExport
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+export(EXPORT fooExport
+ EXPORT_LINK_INTERFACE_LIBRARIES
+)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index b8d3f27..4b04f18 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -1,3 +1,6 @@
include(RunCMake)
run_cmake(TargetNotFound)
+run_cmake(AppendExport)
+run_cmake(OldIface)
+run_cmake(NoExportSet)
diff --git a/Tests/RunCMake/include/ExportExportInclude-result.txt b/Tests/RunCMake/include/ExportExportInclude-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include/ExportExportInclude-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include/ExportExportInclude-stderr.txt b/Tests/RunCMake/include/ExportExportInclude-stderr.txt
new file mode 100644
index 0000000..70d013c
--- /dev/null
+++ b/Tests/RunCMake/include/ExportExportInclude-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at ExportExportInclude.cmake:6 \(include\):
+ include could not find load file:
+
+ .*/Tests/RunCMake/include/ExportExportInclude-build/theTargets.cmake
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/include/ExportExportInclude.cmake b/Tests/RunCMake/include/ExportExportInclude.cmake
new file mode 100644
index 0000000..14e5d91
--- /dev/null
+++ b/Tests/RunCMake/include/ExportExportInclude.cmake
@@ -0,0 +1,6 @@
+
+add_library(iface INTERFACE)
+install(TARGETS iface EXPORT ifaceExport)
+
+export(EXPORT ifaceExport FILE "${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
+include("${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake
index 7fc9a12..bea7d5c 100644
--- a/Tests/RunCMake/include/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake(EmptyString)
run_cmake(EmptyStringOptional)
run_cmake(CMP0024-WARN)
run_cmake(CMP0024-NEW)
+run_cmake(ExportExportInclude)
diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
index e257fb3..9ca9a77 100644
--- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
@@ -4,3 +4,6 @@ run_cmake(invalid_name)
run_cmake(target_commands)
run_cmake(no_shared_libs)
run_cmake(whitelist)
+run_cmake(invalid_signature)
+run_cmake(genex_link)
+run_cmake(add_dependencies)
diff --git a/Tests/RunCMake/interface_library/add_dependencies-result.txt b/Tests/RunCMake/interface_library/add_dependencies-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/add_dependencies-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/add_dependencies-stderr.txt b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt
new file mode 100644
index 0000000..c550b68
--- /dev/null
+++ b/Tests/RunCMake/interface_library/add_dependencies-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at add_dependencies.cmake:4 \(add_dependencies\):
+ add_dependencies Cannot add target-level dependencies to INTERFACE library
+ target "iface".
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/interface_library/add_dependencies.cmake b/Tests/RunCMake/interface_library/add_dependencies.cmake
new file mode 100644
index 0000000..12cdfb4
--- /dev/null
+++ b/Tests/RunCMake/interface_library/add_dependencies.cmake
@@ -0,0 +1,4 @@
+
+add_library(foo empty.cpp)
+add_library(iface INTERFACE)
+add_dependencies(iface foo)
diff --git a/Tests/RunCMake/interface_library/genex_link-result.txt b/Tests/RunCMake/interface_library/genex_link-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/interface_library/genex_link-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/interface_library/genex_link-stderr.txt b/Tests/RunCMake/interface_library/genex_link-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/interface_library/genex_link-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/interface_library/genex_link.cmake b/Tests/RunCMake/interface_library/genex_link.cmake
new file mode 100644
index 0000000..0dbf029
--- /dev/null
+++ b/Tests/RunCMake/interface_library/genex_link.cmake
@@ -0,0 +1,22 @@
+
+cmake_minimum_required(VERSION 2.8.12.20131125 FATAL_ERROR)
+
+project(genex_link)
+
+set(_main_cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp)
+file(WRITE ${_main_cpp}
+ "int main(int argc, char** argv) { return 0; }\n"
+)
+
+add_library(foo::bar INTERFACE IMPORTED)
+set_target_properties(foo::bar
+ PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"
+ # When not using a generator expression here, no error is generated
+ INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:foo_bar.lib>"
+)
+
+add_executable(main ${_main_cpp})
+target_include_directories(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
+
+target_link_libraries(main foo::bar)
diff --git a/Tests/RunCMake/interface_library/invalid_signature-result.txt b/Tests/RunCMake/interface_library/invalid_signature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/invalid_signature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/invalid_signature-stderr.txt b/Tests/RunCMake/interface_library/invalid_signature-stderr.txt
new file mode 100644
index 0000000..701586a
--- /dev/null
+++ b/Tests/RunCMake/interface_library/invalid_signature-stderr.txt
@@ -0,0 +1,89 @@
+CMake Error at invalid_signature.cmake:2 \(add_library\):
+ add_library INTERFACE library requires no source arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:3 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:4 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:5 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:6 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:7 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:8 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:9 \(add_library\):
+ add_library INTERFACE library specified with conflicting STATIC type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:10 \(add_library\):
+ add_library INTERFACE library specified with conflicting SHARED type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:11 \(add_library\):
+ add_library INTERFACE library specified with conflicting MODULE type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:12 \(add_library\):
+ add_library INTERFACE library specified with conflicting OBJECT type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:13 \(add_library\):
+ add_library INTERFACE library specified with conflicting UNKNOWN type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:14 \(add_library\):
+ add_library INTERFACE library specified with conflicting ALIAS type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:15 \(add_library\):
+ add_library INTERFACE library specified with conflicting ALIAS type.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:16 \(add_library\):
+ add_library INTERFACE library specified with conflicting/multiple types.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:17 \(add_library\):
+ add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:18 \(add_library\):
+ add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_signature.cmake:20 \(add_library\):
+ add_library INTERFACE library requires no source arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/interface_library/invalid_signature.cmake b/Tests/RunCMake/interface_library/invalid_signature.cmake
new file mode 100644
index 0000000..67e3267
--- /dev/null
+++ b/Tests/RunCMake/interface_library/invalid_signature.cmake
@@ -0,0 +1,20 @@
+
+add_library(iface1 INTERFACE empty.cpp)
+add_library(iface3 STATIC INTERFACE)
+add_library(iface4 STATIC INTERFACE empty.cpp)
+add_library(iface5 SHARED INTERFACE)
+add_library(iface6 MODULE INTERFACE)
+add_library(iface7 OBJECT INTERFACE)
+add_library(iface8 UNKNOWN INTERFACE)
+add_library(iface9 INTERFACE STATIC)
+add_library(iface10 INTERFACE SHARED)
+add_library(iface11 INTERFACE MODULE)
+add_library(iface12 INTERFACE OBJECT)
+add_library(iface13 INTERFACE UNKNOWN)
+add_library(iface14 INTERFACE ALIAS)
+add_library(iface15 ALIAS INTERFACE)
+add_library(iface16 INTERFACE INTERFACE)
+add_library(iface17 INTERFACE EXCLUDE_FROM_ALL)
+add_library(iface18 EXCLUDE_FROM_ALL INTERFACE)
+add_library(iface19 GLOBAL INTERFACE)
+add_library(iface20 INTERFACE GLOBAL)
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 5e0ef87..aa9735e 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -11,8 +11,7 @@
#=============================================================================
if(NOT CMake_SOURCE_DIR)
set(CMakeHelp_STANDALONE 1)
- cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR)
- set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
+ cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index 146e1f6..336c74a 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -12,9 +12,24 @@
import os
import re
+# Monkey patch for pygments reporting an error when generator expressions are
+# used.
+# https://bitbucket.org/birkenfeld/pygments-main/issue/942/cmake-generator-expressions-not-handled
+from pygments.lexers import CMakeLexer
+from pygments.token import Name, Operator
+from pygments.lexer import bygroups
+CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)',
+ bygroups(Operator, Name.Variable, Operator)))
+
+
from docutils.parsers.rst import Directive, directives
from docutils.transforms import Transform
-from docutils.utils.error_reporting import SafeString, ErrorString
+try:
+ from docutils.utils.error_reporting import SafeString, ErrorString
+except ImportError:
+ # error_reporting was not in utils before version 0.11:
+ from docutils.error_reporting import SafeString, ErrorString
+
from docutils import io, nodes
from sphinx.directives import ObjectDescription
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
index a4dc710..c7c808f 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
@@ -2412,9 +2412,10 @@ tar_atol(const char *p, size_t char_cnt)
static int64_t
tar_atol_base_n(const char *p, size_t char_cnt, int base)
{
- int64_t l, limit, last_digit_limit;
+ int64_t l, maxval, limit, last_digit_limit;
int digit, sign;
+ maxval = INT64_MAX;
limit = INT64_MAX / base;
last_digit_limit = INT64_MAX % base;
@@ -2431,6 +2432,10 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base)
sign = -1;
p++;
char_cnt--;
+
+ maxval = INT64_MIN;
+ limit = -(INT64_MIN / base);
+ last_digit_limit = INT64_MIN % base;
}
l = 0;
@@ -2438,8 +2443,7 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base)
digit = *p - '0';
while (digit >= 0 && digit < base && char_cnt != 0) {
if (l>limit || (l == limit && digit > last_digit_limit)) {
- l = INT64_MAX; /* Truncate on overflow. */
- break;
+ return maxval; /* Truncate on overflow. */
}
l = (l * base) + digit;
digit = *++p - '0';
@@ -2462,32 +2466,56 @@ tar_atol10(const char *p, size_t char_cnt)
}
/*
- * Parse a base-256 integer. This is just a straight signed binary
- * value in big-endian order, except that the high-order bit is
- * ignored.
+ * Parse a base-256 integer. This is just a variable-length
+ * twos-complement signed binary value in big-endian order, except
+ * that the high-order bit is ignored. The values here can be up to
+ * 12 bytes, so we need to be careful about overflowing 64-bit
+ * (8-byte) integers.
+ *
+ * This code unashamedly assumes that the local machine uses 8-bit
+ * bytes and twos-complement arithmetic.
*/
static int64_t
tar_atol256(const char *_p, size_t char_cnt)
{
- int64_t l, upper_limit, lower_limit;
+ uint64_t l;
const unsigned char *p = (const unsigned char *)_p;
+ unsigned char c, neg;
+
+ /* Extend 7-bit 2s-comp to 8-bit 2s-comp, decide sign. */
+ c = *p;
+ if (c & 0x40) {
+ neg = 0xff;
+ c |= 0x80;
+ l = ~ARCHIVE_LITERAL_ULL(0);
+ } else {
+ neg = 0;
+ c &= 0x7f;
+ l = 0;
+ }
- upper_limit = INT64_MAX / 256;
- lower_limit = INT64_MIN / 256;
+ /* If more than 8 bytes, check that we can ignore
+ * high-order bits without overflow. */
+ while (char_cnt > sizeof(int64_t)) {
+ --char_cnt;
+ if (c != neg)
+ return neg ? INT64_MIN : INT64_MAX;
+ c = *++p;
+ }
- /* Sign-extend the 7-bit value to 64 bits. */
- if ((0x40 & *p) == 0x40)
- l = ~((int64_t)0x3f) | *p++;
- else
- l = 0x3f & *p++;
+ /* c is first byte that fits; if sign mismatch, return overflow */
+ if ((c ^ neg) & 0x80) {
+ return neg ? INT64_MIN : INT64_MAX;
+ }
+
+ /* Accumulate remaining bytes. */
while (--char_cnt > 0) {
- if (l > upper_limit)
- return (INT64_MAX); /* Truncate on overflow */
- else if (l < lower_limit)
- return (INT64_MIN);
- l = (l << 8) | (0xff & (int64_t)*p++);
+ l = (l << 8) | c;
+ c = *++p;
}
- return (l);
+ l = (l << 8) | c;
+ /* Return signed twos-complement value. */
+ return (int64_t)(l);
}
/*
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3 b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
index 9d60515..f8fb039 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
@@ -255,7 +255,7 @@ If the
.Ar value
is
.Cm hd ,
-then the the boot image is assumed to be a bootable hard disk image.
+then the boot image is assumed to be a bootable hard disk image.
If the
.Ar value
is