summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auxiliary/cmake-mode.el4
-rw-r--r--CMakeCPack.cmake63
-rw-r--r--CMakeCPackOptions.cmake.in118
-rw-r--r--CMakeLists.txt11
-rw-r--r--CONTRIBUTING.rst2
-rw-r--r--Help/command/FIND_XXX.txt68
-rw-r--r--Help/command/FIND_XXX_MAC.txt24
-rw-r--r--Help/command/FIND_XXX_ROOT.txt16
-rw-r--r--Help/command/add_custom_command.rst3
-rw-r--r--Help/command/add_subdirectory.rst14
-rw-r--r--Help/command/aux_source_directory.rst2
-rw-r--r--Help/command/build_name.rst5
-rw-r--r--Help/command/cmake_host_system_information.rst6
-rw-r--r--Help/command/cmake_minimum_required.rst2
-rw-r--r--Help/command/cmake_policy.rst2
-rw-r--r--Help/command/create_test_sourcelist.rst18
-rw-r--r--Help/command/ctest_memcheck.rst1
-rw-r--r--Help/command/ctest_run_script.rst6
-rw-r--r--Help/command/ctest_start.rst2
-rw-r--r--Help/command/ctest_test.rst10
-rw-r--r--Help/command/define_property.rst28
-rw-r--r--Help/command/else.rst2
-rw-r--r--Help/command/elseif.rst2
-rw-r--r--Help/command/enable_language.rst2
-rw-r--r--Help/command/enable_testing.rst8
-rw-r--r--Help/command/endforeach.rst4
-rw-r--r--Help/command/endfunction.rst2
-rw-r--r--Help/command/endif.rst2
-rw-r--r--Help/command/endmacro.rst2
-rw-r--r--Help/command/endwhile.rst2
-rw-r--r--Help/command/exec_program.rst8
-rw-r--r--Help/command/execute_process.rst14
-rw-r--r--Help/command/export.rst18
-rw-r--r--Help/command/export_library_dependencies.rst12
-rw-r--r--Help/command/find_file.rst29
-rw-r--r--Help/command/find_library.rst51
-rw-r--r--Help/command/find_package.rst7
-rw-r--r--Help/command/find_path.rst35
-rw-r--r--Help/command/find_program.rst15
-rw-r--r--Help/command/fltk_wrap_ui.rst2
-rw-r--r--Help/command/foreach.rst6
-rw-r--r--Help/command/get_cmake_property.rst8
-rw-r--r--Help/command/get_directory_property.rst6
-rw-r--r--Help/command/get_filename_component.rst12
-rw-r--r--Help/command/get_source_file_property.rst10
-rw-r--r--Help/command/get_target_property.rst6
-rw-r--r--Help/command/get_test_property.rst8
-rw-r--r--Help/command/include.rst18
-rw-r--r--Help/command/include_external_msproject.rst6
-rw-r--r--Help/command/include_regular_expression.rst4
-rw-r--r--Help/command/install_files.rst18
-rw-r--r--Help/command/install_programs.rst23
-rw-r--r--Help/command/install_targets.rst12
-rw-r--r--Help/command/link_directories.rst8
-rw-r--r--Help/command/list.rst48
-rw-r--r--Help/command/load_cache.rst4
-rw-r--r--Help/command/load_command.rst6
-rw-r--r--Help/command/make_directory.rst2
-rw-r--r--Help/command/mark_as_advanced.rst8
-rw-r--r--Help/command/math.rst2
-rw-r--r--Help/command/message.rst2
-rw-r--r--Help/command/option.rst6
-rw-r--r--Help/command/qt_wrap_cpp.rst2
-rw-r--r--Help/command/qt_wrap_ui.rst6
-rw-r--r--Help/command/remove.rst8
-rw-r--r--Help/command/remove_definitions.rst6
-rw-r--r--Help/command/return.rst14
-rw-r--r--Help/command/separate_arguments.rst8
-rw-r--r--Help/command/set_target_properties.rst145
-rw-r--r--Help/command/string.rst69
-rw-r--r--Help/command/subdirs.rst12
-rw-r--r--Help/command/unset.rst10
-rw-r--r--Help/command/utility_source.rst4
-rw-r--r--Help/command/variable_requires.rst8
-rw-r--r--Help/command/while.rst8
-rw-r--r--Help/command/write_file.rst14
-rw-r--r--Help/manual/cmake-buildsystem.7.rst2
-rw-r--r--Help/manual/cmake-developer.7.rst1
-rw-r--r--Help/manual/cmake-policies.7.rst10
-rw-r--r--Help/manual/cmake-properties.7.rst2
-rw-r--r--Help/manual/cmake-variables.7.rst7
-rw-r--r--Help/manual/ctest.1.rst14
-rw-r--r--Help/policy/CMP0000.rst2
-rw-r--r--Help/policy/CMP0001.rst2
-rw-r--r--Help/policy/CMP0002.rst2
-rw-r--r--Help/policy/CMP0003.rst2
-rw-r--r--Help/policy/CMP0004.rst2
-rw-r--r--Help/policy/CMP0005.rst2
-rw-r--r--Help/policy/CMP0006.rst2
-rw-r--r--Help/policy/CMP0007.rst2
-rw-r--r--Help/policy/CMP0008.rst2
-rw-r--r--Help/policy/CMP0009.rst2
-rw-r--r--Help/policy/CMP0010.rst2
-rw-r--r--Help/policy/CMP0011.rst2
-rw-r--r--Help/policy/CMP0012.rst2
-rw-r--r--Help/policy/CMP0013.rst2
-rw-r--r--Help/policy/CMP0014.rst2
-rw-r--r--Help/policy/CMP0015.rst2
-rw-r--r--Help/policy/CMP0016.rst2
-rw-r--r--Help/policy/CMP0017.rst2
-rw-r--r--Help/policy/CMP0018.rst2
-rw-r--r--Help/policy/CMP0019.rst2
-rw-r--r--Help/policy/CMP0020.rst2
-rw-r--r--Help/policy/CMP0021.rst2
-rw-r--r--Help/policy/CMP0022.rst2
-rw-r--r--Help/policy/CMP0023.rst2
-rw-r--r--Help/policy/CMP0024.rst2
-rw-r--r--Help/policy/CMP0025.rst2
-rw-r--r--Help/policy/CMP0026.rst2
-rw-r--r--Help/policy/CMP0027.rst2
-rw-r--r--Help/policy/CMP0028.rst2
-rw-r--r--Help/policy/CMP0029.rst2
-rw-r--r--Help/policy/CMP0030.rst2
-rw-r--r--Help/policy/CMP0031.rst2
-rw-r--r--Help/policy/CMP0032.rst2
-rw-r--r--Help/policy/CMP0033.rst2
-rw-r--r--Help/policy/CMP0034.rst2
-rw-r--r--Help/policy/CMP0035.rst2
-rw-r--r--Help/policy/CMP0036.rst2
-rw-r--r--Help/policy/CMP0037.rst2
-rw-r--r--Help/policy/CMP0038.rst2
-rw-r--r--Help/policy/CMP0039.rst2
-rw-r--r--Help/policy/CMP0040.rst2
-rw-r--r--Help/policy/CMP0041.rst2
-rw-r--r--Help/policy/CMP0042.rst2
-rw-r--r--Help/policy/CMP0043.rst2
-rw-r--r--Help/policy/CMP0044.rst2
-rw-r--r--Help/policy/CMP0045.rst2
-rw-r--r--Help/policy/CMP0046.rst2
-rw-r--r--Help/policy/CMP0047.rst2
-rw-r--r--Help/policy/CMP0048.rst2
-rw-r--r--Help/policy/CMP0049.rst2
-rw-r--r--Help/policy/CMP0050.rst2
-rw-r--r--Help/policy/CMP0051.rst2
-rw-r--r--Help/policy/CMP0052.rst2
-rw-r--r--Help/policy/CMP0053.rst2
-rw-r--r--Help/policy/CMP0054.rst2
-rw-r--r--Help/policy/CMP0055.rst2
-rw-r--r--Help/policy/CMP0056.rst2
-rw-r--r--Help/policy/CMP0057.rst2
-rw-r--r--Help/policy/CMP0058.rst2
-rw-r--r--Help/policy/CMP0059.rst2
-rw-r--r--Help/policy/CMP0060.rst2
-rw-r--r--Help/policy/CMP0061.rst2
-rw-r--r--Help/policy/CMP0062.rst2
-rw-r--r--Help/policy/CMP0063.rst2
-rw-r--r--Help/policy/DEPRECATED.txt4
-rw-r--r--Help/prop_tgt/CONFIG_OUTPUT_NAME.rst5
-rw-r--r--Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst13
-rw-r--r--Help/prop_tgt/OUTPUT_NAME.rst13
-rw-r--r--Help/prop_tgt/OUTPUT_NAME_CONFIG.rst3
-rw-r--r--Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst18
-rw-r--r--Help/release/3.3.rst6
-rw-r--r--Help/release/dev/ConcurrentFortran-compiler-id.rst5
-rw-r--r--Help/release/dev/ExternalProject-USES_TERMINAL.rst7
-rw-r--r--Help/release/dev/ExternalProject_init_selected_submodules.rst7
-rw-r--r--Help/release/dev/FindBISON-DEFINES_FILE.rst6
-rw-r--r--Help/release/dev/FindIce-imported-targets.rst4
-rw-r--r--Help/release/dev/GNUInstallDirs-special-prefixes.rst9
-rw-r--r--Help/release/dev/OUTPUT_NAME-genex.rst5
-rw-r--r--Help/release/dev/add-apple-swift-language.rst9
-rw-r--r--Help/release/dev/auto_export_dll_symbols.rst6
-rw-r--r--Help/release/dev/compiler-launcher.rst8
-rw-r--r--Help/release/dev/ctest-test-load-option.rst9
-rw-r--r--Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst5
-rw-r--r--Help/release/dev/string-append.rst4
-rw-r--r--Help/variable/CMAKE_APPBUNDLE_PATH.rst5
-rw-r--r--Help/variable/CMAKE_FIND_APPBUNDLE.rst22
-rw-r--r--Help/variable/CMAKE_FIND_FRAMEWORK.rst22
-rw-r--r--Help/variable/CMAKE_FIND_ROOT_PATH.rst2
-rw-r--r--Help/variable/CMAKE_FRAMEWORK_PATH.rst3
-rw-r--r--Help/variable/CMAKE_GENERATOR_PLATFORM.rst2
-rw-r--r--Help/variable/CMAKE_IGNORE_PATH.rst27
-rw-r--r--Help/variable/CMAKE_INCLUDE_PATH.rst11
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst1
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst6
-rw-r--r--Help/variable/CMAKE_LIBRARY_PATH.rst9
-rw-r--r--Help/variable/CMAKE_MODULE_PATH.rst9
-rw-r--r--Help/variable/CMAKE_PREFIX_PATH.rst20
-rw-r--r--Help/variable/CMAKE_PROGRAM_PATH.rst9
-rw-r--r--Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst7
-rw-r--r--Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst8
-rw-r--r--Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst25
-rw-r--r--Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst13
-rw-r--r--Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst13
-rw-r--r--Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst26
-rw-r--r--Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst13
-rw-r--r--Help/variable/CMAKE_USE_RELATIVE_PATHS.rst9
-rw-r--r--Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst6
-rw-r--r--Help/variable/CTEST_TEST_LOAD.rst7
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake9
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake9
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake53
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake16
-rw-r--r--Modules/CMakeDetermineSwiftCompiler.cmake53
-rw-r--r--Modules/CMakeSwiftCompiler.cmake.in5
-rw-r--r--Modules/CMakeSwiftInformation.cmake41
-rw-r--r--Modules/CMakeTestSwiftCompiler.cmake15
-rw-r--r--Modules/CPackDeb.cmake18
-rw-r--r--Modules/CheckCCompilerFlag.cmake8
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake8
-rw-r--r--Modules/CheckFortranCompilerFlag.cmake8
-rw-r--r--Modules/CheckIncludeFile.cmake34
-rw-r--r--Modules/CheckIncludeFileCXX.cmake37
-rw-r--r--Modules/CheckIncludeFiles.cmake33
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake5
-rw-r--r--Modules/Compiler/CCur-Fortran.cmake1
-rw-r--r--Modules/Compiler/XL-ASM.cmake3
-rw-r--r--Modules/Compiler/XL-C.cmake3
-rw-r--r--Modules/CompilerId/main.swift.in1
-rw-r--r--Modules/DartConfiguration.tcl.in4
-rw-r--r--Modules/ExternalProject.cmake85
-rw-r--r--Modules/FindBISON.cmake155
-rw-r--r--Modules/FindCUDA.cmake32
-rw-r--r--Modules/FindIce.cmake134
-rw-r--r--Modules/FindMatlab.cmake16
-rw-r--r--Modules/FindPythonLibs.cmake39
-rw-r--r--Modules/FindXercesC.cmake2
-rw-r--r--Modules/FindwxWidgets.cmake3
-rw-r--r--Modules/GNUInstallDirs.cmake130
-rw-r--r--Modules/Platform/Linux-CCur-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux-GNU-Fortran.cmake1
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake6
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake3
-rw-r--r--README.rst2
-rw-r--r--Source/CMakeLists.txt22
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx6
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx10
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGenericHandler.h3
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx159
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h4
-rw-r--r--Source/CTest/cmCTestRunTest.cxx3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx33
-rw-r--r--Source/CTest/cmCTestTestCommand.h1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx29
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx4
-rw-r--r--Source/CTest/cmProcess.cxx19
-rw-r--r--Source/CTest/cmProcess.h7
-rw-r--r--Source/CursesDialog/CMakeLists.txt3
-rw-r--r--Source/QtDialog/CMakeLists.txt33
-rw-r--r--Source/QtDialog/CMakeSetup.cxx2
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx3
-rw-r--r--Source/QtIFW/CMake.Dialogs.QtGUI.qs21
-rw-r--r--Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in21
-rw-r--r--Source/QtIFW/CMake.qs.in22
-rw-r--r--Source/QtIFW/installscript.qs.in8
-rw-r--r--Source/bindexplib.cxx428
-rw-r--r--Source/cmArchiveWrite.cxx11
-rw-r--r--Source/cmArchiveWrite.h1
-rw-r--r--Source/cmCPackPropertiesGenerator.cxx8
-rw-r--r--Source/cmCPluginAPI.cxx18
-rw-r--r--Source/cmCTest.cxx49
-rw-r--r--Source/cmCTest.h6
-rw-r--r--Source/cmCacheManager.cxx11
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx7
-rw-r--r--Source/cmCommandArgumentParserHelper.h8
-rw-r--r--Source/cmCommonTargetGenerator.cxx360
-rw-r--r--Source/cmCommonTargetGenerator.h88
-rw-r--r--Source/cmComputeComponentGraph.h4
-rw-r--r--Source/cmComputeLinkDepends.h18
-rw-r--r--Source/cmComputeLinkInformation.cxx6
-rw-r--r--Source/cmComputeLinkInformation.h37
-rw-r--r--Source/cmComputeTargetDepends.cxx81
-rw-r--r--Source/cmComputeTargetDepends.h16
-rw-r--r--Source/cmCoreTryCompile.cxx6
-rw-r--r--Source/cmCustomCommand.cxx55
-rw-r--r--Source/cmCustomCommand.h10
-rw-r--r--Source/cmCustomCommandGenerator.cxx7
-rw-r--r--Source/cmCustomCommandGenerator.h2
-rw-r--r--Source/cmDependsFortran.cxx2
-rw-r--r--Source/cmDocumentation.h1
-rw-r--r--Source/cmExecProgramCommand.cxx6
-rw-r--r--Source/cmExportBuildFileGenerator.cxx2
-rw-r--r--Source/cmExportFileGenerator.cxx24
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx3
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx24
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h5
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx3
-rw-r--r--Source/cmFileCommand.cxx18
-rw-r--r--Source/cmForEachCommand.cxx22
-rw-r--r--Source/cmForEachCommand.h5
-rw-r--r--Source/cmFunctionCommand.cxx32
-rw-r--r--Source/cmGeneratorExpression.cxx2
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx43
-rw-r--r--Source/cmGeneratorTarget.h9
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx11
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx36
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h5
-rw-r--r--Source/cmGetPropertyCommand.cxx22
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx6
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx6
-rw-r--r--Source/cmGetTestPropertyCommand.cxx6
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx22
-rw-r--r--Source/cmGhsMultiTargetGenerator.h3
-rw-r--r--Source/cmGlobalCommonGenerator.cxx21
-rw-r--r--Source/cmGlobalCommonGenerator.h27
-rw-r--r--Source/cmGlobalGenerator.cxx107
-rw-r--r--Source/cmGlobalGenerator.h39
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
-rw-r--r--Source/cmGlobalNinjaGenerator.h4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx41
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h10
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx65
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx97
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h7
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx33
-rw-r--r--Source/cmGraphVizWriter.cxx2
-rw-r--r--Source/cmGraphVizWriter.h15
-rw-r--r--Source/cmIfCommand.cxx9
-rw-r--r--Source/cmInstallFilesGenerator.cxx6
-rw-r--r--Source/cmInstallFilesGenerator.h2
-rw-r--r--Source/cmInstallTargetGenerator.cxx4
-rw-r--r--Source/cmInstallTargetGenerator.h6
-rw-r--r--Source/cmLinkedTree.h182
-rw-r--r--Source/cmListFileCache.cxx60
-rw-r--r--Source/cmListFileCache.h49
-rw-r--r--Source/cmLocalCommonGenerator.cxx40
-rw-r--r--Source/cmLocalCommonGenerator.h39
-rw-r--r--Source/cmLocalGenerator.cxx576
-rw-r--r--Source/cmLocalGenerator.h118
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx51
-rw-r--r--Source/cmLocalNinjaGenerator.h12
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx65
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h39
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx3
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx79
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx57
-rw-r--r--Source/cmMacroCommand.cxx26
-rw-r--r--Source/cmMakefile.cxx668
-rw-r--r--Source/cmMakefile.h161
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx2
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx55
-rw-r--r--Source/cmMakefileTargetGenerator.cxx371
-rw-r--r--Source/cmMakefileTargetGenerator.h53
-rw-r--r--Source/cmMakefileUtilityTargetGenerator.cxx2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx56
-rw-r--r--Source/cmNinjaTargetGenerator.cxx185
-rw-r--r--Source/cmNinjaTargetGenerator.h26
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx2
-rw-r--r--Source/cmOSXBundleGenerator.cxx2
-rw-r--r--Source/cmOrderDirectories.h5
-rw-r--r--Source/cmOutputConverter.cxx1050
-rw-r--r--Source/cmOutputConverter.h181
-rw-r--r--Source/cmPolicies.cxx33
-rw-r--r--Source/cmPolicies.h8
-rw-r--r--Source/cmProcessTools.cxx2
-rw-r--r--Source/cmProcessTools.h6
-rw-r--r--Source/cmProjectCommand.cxx3
-rw-r--r--Source/cmProperty.cxx7
-rw-r--r--Source/cmProperty.h6
-rw-r--r--Source/cmPropertyDefinitionMap.cxx8
-rw-r--r--Source/cmPropertyDefinitionMap.h4
-rw-r--r--Source/cmPropertyMap.cxx29
-rw-r--r--Source/cmPropertyMap.h18
-rw-r--r--Source/cmQtAutoGenerators.cxx80
-rw-r--r--Source/cmQtAutoGenerators.h3
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx6
-rw-r--r--Source/cmSourceFile.cxx19
-rw-r--r--Source/cmSourceFile.h4
-rw-r--r--Source/cmState.cxx341
-rw-r--r--Source/cmState.h87
-rw-r--r--Source/cmStringCommand.cxx32
-rw-r--r--Source/cmStringCommand.h1
-rw-r--r--Source/cmSystemTools.cxx28
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmTarget.cxx164
-rw-r--r--Source/cmTarget.h71
-rw-r--r--Source/cmTargetDepend.h13
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx3
-rw-r--r--Source/cmTest.cxx18
-rw-r--r--Source/cmTestGenerator.cxx14
-rw-r--r--Source/cmVariableWatchCommand.cxx16
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx45
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx8
-rw-r--r--Source/cmWhileCommand.cxx17
-rw-r--r--Source/cmWhileCommand.h5
-rw-r--r--Source/cmake.cxx35
-rw-r--r--Source/cmake.h5
-rw-r--r--Source/cmakemain.cxx9
-rw-r--r--Source/cmcmd.cxx39
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Source/kwsys/CMakeLists.txt9
-rw-r--r--Source/kwsys/CONTRIBUTING.rst2
-rw-r--r--Source/kwsys/ProcessWin32.c151
-rw-r--r--Source/kwsys/System.c585
-rw-r--r--Source/kwsys/System.h.in98
-rw-r--r--Source/kwsys/SystemInformation.cxx98
-rw-r--r--Source/kwsys/SystemInformation.hxx.in4
-rw-r--r--Source/kwsys/SystemTools.cxx2
-rw-r--r--Source/kwsys/kwsysPlatformTestsCXX.cxx13
-rw-r--r--Source/kwsys/testSystemInformation.cxx1
-rw-r--r--Tests/CMakeLists.txt6
-rw-r--r--Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt7
-rw-r--r--Tests/CTestUpdateCVS.cmake.in19
-rw-r--r--Tests/CTestUpdateCommon.cmake32
-rw-r--r--Tests/CTestUpdateGIT.cmake.in35
-rw-r--r--Tests/CTestUpdateHG.cmake.in19
-rw-r--r--Tests/CTestUpdateSVN.cmake.in19
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt10
-rw-r--r--Tests/ExportImport/Export/Interface/CMakeLists.txt4
-rw-r--r--Tests/ExportImport/Export/testLib7.c1
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt2
-rw-r--r--Tests/ExportImport/Import/A/imp_testExe1.c3
-rw-r--r--Tests/ExportImport/Import/Interface/CMakeLists.txt11
-rw-r--r--Tests/ExternalProject/CMakeLists.txt60
-rw-r--r--Tests/ExternalProject/gitrepo-sub.tgzbin0 -> 1911 bytes
-rw-r--r--Tests/Fortran/CMakeLists.txt2
-rw-r--r--Tests/Fortran/test_preprocess.F902
-rw-r--r--Tests/Fortran/test_preprocess_module.F905
-rw-r--r--Tests/QtAutogen/CMakeLists.txt27
-rw-r--r--Tests/QtAutogen/automoc_rerun/CMakeLists.txt27
-rw-r--r--Tests/QtAutogen/automoc_rerun/input.txt1
-rw-r--r--Tests/QtAutogen/automoc_rerun/res1.qrc5
-rw-r--r--Tests/QtAutogen/automoc_rerun/test1.cpp5
-rw-r--r--Tests/QtAutogen/automoc_rerun/test1.h.in18
-rw-r--r--Tests/QtAutogen/automoc_rerun/test1.h.in27
-rw-r--r--Tests/RunCMake/AutoExportDll/AutoExport.cmake7
-rw-r--r--Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt1
-rw-r--r--Tests/RunCMake/AutoExportDll/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake26
-rw-r--r--Tests/RunCMake/AutoExportDll/foo.c15
-rw-r--r--Tests/RunCMake/AutoExportDll/hello.cxx13
-rw-r--r--Tests/RunCMake/AutoExportDll/hello.h18
-rw-r--r--Tests/RunCMake/AutoExportDll/say.cxx37
-rw-r--r--Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/AutoExportDll/sub/sub.cxx4
-rw-r--r--Tests/RunCMake/AutoExportDll/world.cxx6
-rw-r--r--Tests/RunCMake/CMakeLists.txt50
-rw-r--r--Tests/RunCMake/CPack/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake76
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake10
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEB/Prerequirements.cmake8
-rw-r--r--Tests/RunCMake/CPack/MINIMAL.cmake3
-rw-r--r--Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake (renamed from Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake)0
-rw-r--r--Tests/RunCMake/CPack/PreTestError.cmake7
-rw-r--r--Tests/RunCMake/CPack/README.txt99
-rw-r--r--Tests/RunCMake/CPack/RPM/Helpers.cmake10
-rw-r--r--Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt (renamed from Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt)0
-rw-r--r--Tests/RunCMake/CPack/RPM/Prerequirements.cmake16
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake91
-rw-r--r--Tests/RunCMake/CPackRPM/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CPackRPM/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt7
-rw-r--r--Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt13
-rw-r--r--Tests/RunCMake/CTestCommandLine/MergeOutput.cmake4
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake69
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt7
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt7
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/CommandLine/build-bad-dir-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-no-dir-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-no-dir-stderr.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/C-launch.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/C.cmake4
-rw-r--r--Tests/RunCMake/CompilerLauncher/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/CompilerLauncher/CXX-launch.cmake3
-rw-r--r--Tests/RunCMake/CompilerLauncher/CXX.cmake4
-rw-r--r--Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake23
-rw-r--r--Tests/RunCMake/CompilerLauncher/main.c3
-rw-r--r--Tests/RunCMake/CompilerLauncher/main.cxx1
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake97
-rw-r--r--Tests/RunCMake/ExternalProject/UsesTerminal.cmake45
-rw-r--r--Tests/RunCMake/GNUInstallDirs/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Common.cmake28
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt28
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Opt.cmake2
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Root-stderr.txt28
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Root.cmake2
-rw-r--r--Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt28
-rw-r--r--Tests/RunCMake/GNUInstallDirs/Usr.cmake2
-rw-r--r--Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt28
-rw-r--r--Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake2
-rw-r--r--Tests/RunCMake/Languages/DetermineFail-result.txt1
-rw-r--r--Tests/RunCMake/Languages/DetermineFail-stderr.txt5
-rw-r--r--Tests/RunCMake/Languages/DetermineFail.cmake2
-rw-r--r--Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake1
-rw-r--r--Tests/RunCMake/Languages/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/RunCMake.cmake7
-rw-r--r--Tests/RunCMake/Swift/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Swift/Enable-stdout.txt1
-rw-r--r--Tests/RunCMake/Swift/Enable.cmake1
-rw-r--r--Tests/RunCMake/Swift/NotSupported-result.txt1
-rw-r--r--Tests/RunCMake/Swift/NotSupported-stderr.txt5
-rw-r--r--Tests/RunCMake/Swift/NotSupported.cmake1
-rw-r--r--Tests/RunCMake/Swift/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/Swift/XcodeTooOld-result.txt1
-rw-r--r--Tests/RunCMake/Swift/XcodeTooOld-stderr.txt5
-rw-r--r--Tests/RunCMake/Swift/XcodeTooOld.cmake1
-rw-r--r--Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/FunctionUnmatched-result.txt1
-rw-r--r--Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt6
-rw-r--r--Tests/RunCMake/Syntax/FunctionUnmatched.cmake2
-rw-r--r--Tests/RunCMake/Syntax/MacroUnmatched-result.txt1
-rw-r--r--Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt6
-rw-r--r--Tests/RunCMake/Syntax/MacroUnmatched.cmake2
-rw-r--r--Tests/RunCMake/Syntax/ParenInENV-stderr.txt4
-rw-r--r--Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt12
-rw-r--r--Tests/RunCMake/Syntax/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/Syntax/StringNoSpace-stderr.txt8
-rw-r--r--Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt1
-rw-r--r--Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt7
-rw-r--r--Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt7
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake41
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadFail-result.txt1
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt7
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt7
-rw-r--r--Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt7
-rw-r--r--Tests/RunCMake/ctest_test/test.cmake.in1
-rw-r--r--Tests/RunCMake/set_property/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/set_property/LINK_LIBRARIES.cmake7
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/string/Append.cmake58
-rw-r--r--Tests/RunCMake/string/AppendNoArgs-result.txt1
-rw-r--r--Tests/RunCMake/string/AppendNoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/string/AppendNoArgs.cmake1
-rw-r--r--Tests/RunCMake/string/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/empty.c0
-rw-r--r--Tests/SwiftMix/CMain.c4
-rw-r--r--Tests/SwiftMix/CMakeLists.txt5
-rw-r--r--Tests/SwiftMix/ObjC-Swift.h0
-rw-r--r--Tests/SwiftMix/ObjCMain.m4
-rw-r--r--Tests/SwiftMix/SwiftMain.swift10
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt4
-rw-r--r--Tests/SwiftOnly/main.swift1
-rw-r--r--Tests/VSResource/CMakeLists.txt3
-rw-r--r--Tests/VSResource/lib.cpp1
-rw-r--r--Tests/VSResource/lib.rc4
-rw-r--r--Tests/VSResource/main.cpp4
-rwxr-xr-xUtilities/Doxygen/doc_makeall.sh.in26
-rw-r--r--Utilities/Release/dashmacmini5_release.cmake2
-rw-r--r--Utilities/Release/linux64_release.cmake6
-rw-r--r--Utilities/Release/magrathea_release.cmake6
-rw-r--r--Utilities/Release/upload_release.cmake2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt14
-rwxr-xr-xbootstrap4
584 files changed, 8893 insertions, 4484 deletions
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 7458a66..51663a8 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -259,7 +259,9 @@ the indentation. Otherwise it retains the same position on the line"
(setq comment-start "#")
; Run user hooks.
- (run-hooks 'cmake-mode-hook))
+ (if (boundp 'prog-mode-hook)
+ (run-hooks 'prog-mode-hook 'cmake-mode-hook)
+ (run-hooks 'cmake-mode-hook)))
; Help mode starts here
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index 22ca8cf..ce10ad0 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -65,6 +65,61 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
endif()
endif()
+ # Components
+ if(CMake_INSTALL_COMPONENTS)
+ set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack)
+ if(APPLE)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild)
+ endif()
+ if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
+ set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
+ ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
+ else()
+ set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified)
+ endif()
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME})
+ string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}"
+ _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME)
+ if(BUILD_CursesDialog)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake)
+ endif()
+ if(BUILD_QtDialog)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui)
+ set(_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES "set(CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES
+ \"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\")")
+ endif()
+ if(SPHINX_MAN)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-man)
+ endif()
+ if(SPHINX_HTML)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html)
+ endif()
+ if(SPHINX_SINGLEHTML)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml)
+ endif()
+ if(SPHINX_QTHELP)
+ list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
+ endif()
+ set(_CPACK_IFW_COMPONENTS_CONFIGURATION "
+ # Components
+ set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\")
+ set(CPACK_COMPONENTS_GROUPING IGNORE)
+")
+ else()
+ if(BUILD_QtDialog AND CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
+ set(_CPACK_IFW_ADDITIONAL_LICENSES
+ "\"LGPLv2.1\" \"${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt\"")
+ endif()
+ endif()
+
+ # Components scripts configuration
+ foreach(_script
+ CMake
+ CMake.Documentation.SphinxHTML)
+ configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in"
+ "${CMake_BINARY_DIR}/${_script}.qs" @ONLY)
+ endforeach()
+
if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
set(_CPACK_IFW_PACKAGE_ICON
"set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
@@ -78,9 +133,13 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
"${CMake_BINARY_DIR}/installscript.qs" @ONLY
)
install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
- DESTINATION "."
+ DESTINATION "${CMAKE_DOC_DIR}"
)
- set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")")
+ if(CMake_INSTALL_COMPONENTS)
+ set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/CMake.qs")
+ else()
+ set(_CPACK_IFW_PACKAGE_SCRIPT "${CMake_BINARY_DIR}/installscript.qs")
+ endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index 6003565..a1e425a 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -32,6 +32,7 @@ endif()
include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL)
if(CPACK_GENERATOR MATCHES "IFW")
+
# Installer configuration
set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool")
set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org")
@@ -40,21 +41,132 @@ if(CPACK_GENERATOR MATCHES "IFW")
"@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png")
set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT
"@CMake_SOURCE_DIR@/Source/QtIFW/controlscript.qs")
+
# Uninstaller configuration
set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance")
+ @_CPACK_IFW_COMPONENTS_CONFIGURATION@
+ # Unspecified
+ set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME@_VERSION
+ "@_CPACK_IFW_PACKAGE_VERSION@")
+
# Package configuration group
set(CPACK_IFW_PACKAGE_GROUP CMake)
+
# Group configuration
+
+ # CMake
set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME
"@CPACK_PACKAGE_NAME@")
set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION
"@CPACK_PACKAGE_DESCRIPTION_SUMMARY@")
- # IFW group configuration
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION
"@_CPACK_IFW_PACKAGE_VERSION@")
set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES
- "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@")
- @_CPACK_IFW_PACKAGE_SCRIPT@
+ "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@"
+ @_CPACK_IFW_ADDITIONAL_LICENSES@)
+ set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@_CPACK_IFW_PACKAGE_SCRIPT@")
+ set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100)
+
+ # Tools
+ set(CPACK_COMPONENT_GROUP_TOOLS_DISPLAY_NAME "Command-Line Tools")
+ set(CPACK_COMPONENT_GROUP_TOOLS_DESCRIPTION
+ "Command-Line Tools: cmake, ctest and cpack")
+ set(CPACK_COMPONENT_GROUP_TOOLS_PARENT_GROUP CMake)
+ set(CPACK_IFW_COMPONENT_GROUP_TOOLS_PRIORITY 90)
+ set(CPACK_IFW_COMPONENT_GROUP_TOOLS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_CMAKE_DISPLAY_NAME "cmake")
+ set(CPACK_COMPONENT_CMAKE_DESCRIPTION
+ "The \"cmake\" executable is the CMake command-line interface")
+ set(CPACK_COMPONENT_CMAKE_REQUIRED TRUE)
+ set(CPACK_COMPONENT_CMAKE_GROUP Tools)
+ set(CPACK_IFW_COMPONENT_CMAKE_NAME "CMake")
+ set(CPACK_IFW_COMPONENT_CMAKE_PRIORITY 89)
+ set(CPACK_IFW_COMPONENT_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_CTEST_DISPLAY_NAME "ctest")
+ set(CPACK_COMPONENT_CTEST_DESCRIPTION
+ "The \"ctest\" executable is the CMake test driver program")
+ set(CPACK_COMPONENT_CTEST_REQUIRED TRUE)
+ set(CPACK_COMPONENT_CTEST_GROUP Tools)
+ set(CPACK_IFW_COMPONENT_CTEST_NAME "CTest")
+ set(CPACK_IFW_COMPONENT_CTEST_PRIORITY 88)
+ set(CPACK_IFW_COMPONENT_CTEST_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_CPACK_DISPLAY_NAME "cpack")
+ set(CPACK_COMPONENT_CPACK_DESCRIPTION
+ "The \"cpack\" executable is the CMake packaging program")
+ set(CPACK_COMPONENT_CPACK_REQUIRED TRUE)
+ set(CPACK_COMPONENT_CPACK_GROUP Tools)
+ set(CPACK_IFW_COMPONENT_CPACK_NAME "CPack")
+ set(CPACK_IFW_COMPONENT_CPACK_PRIORITY 87)
+ set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_CMAKEXBUILD_DISPLAY_NAME "cmakexbuild")
+ set(CPACK_COMPONENT_CMAKEXBUILD_DESCRIPTION
+ "The \"cmakexbuild\" executable is a wrapper program for \"xcodebuild\"")
+ set(CPACK_COMPONENT_CMAKEXBUILD_REQUIRED TRUE)
+ set(CPACK_COMPONENT_CMAKEXBUILD_GROUP Tools)
+ set(CPACK_IFW_COMPONENT_CMAKEXBUILD_NAME "CMakeXBuild")
+ set(CPACK_IFW_COMPONENT_CMAKEXBUILD_PRIORITY 86)
+ set(CPACK_IFW_COMPONENT_CMAKEXBUILD_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ # Dialogs
+ set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs")
+ set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION
+ "Interactive Dialogs with Console and GUI interfaces")
+ set(CPACK_COMPONENT_GROUP_DIALOGS_PARENT_GROUP CMake)
+ set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_PRIORITY 80)
+ set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_CMAKE-GUI_DISPLAY_NAME "cmake-gui")
+ set(CPACK_COMPONENT_CMAKE-GUI_GROUP Dialogs)
+ set(CPACK_IFW_COMPONENT_CMAKE-GUI_NAME "QtGUI")
+ set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT
+ "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs")
+ set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+ @_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES@
+
+ set(CPACK_COMPONENT_CCMAKE_DISPLAY_NAME "ccmake")
+ set(CPACK_COMPONENT_CCMAKE_GROUP Dialogs)
+ set(CPACK_IFW_COMPONENT_CCMAKE_NAME "CursesGUI")
+ set(CPACK_IFW_COMPONENT_CCMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ # Documentation
+ set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DISPLAY_NAME "Documentation")
+ set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
+ "CMake Documentation in different formats (html, man, qch)")
+ set(CPACK_COMPONENT_GROUP_DOCUMENTATION_PARENT_GROUP CMake)
+ set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_PRIORITY 60)
+ set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION
+ "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_SPHINX-MAN_DISPLAY_NAME "man")
+ set(CPACK_COMPONENT_SPHINX-MAN_GROUP Documentation)
+ set(CPACK_COMPONENT_SPHINX-MAN_DISABLED TRUE)
+ set(CPACK_IFW_COMPONENT_SPHINX-MAN_NAME "SphinxMan")
+ set(CPACK_IFW_COMPONENT_SPHINX-MAN_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_SPHINX-HTML_DISPLAY_NAME "HTML")
+ set(CPACK_COMPONENT_SPHINX-HTML_GROUP Documentation)
+ set(CPACK_IFW_COMPONENT_SPHINX-HTML_NAME "SphinxHTML")
+ set(CPACK_IFW_COMPONENT_SPHINX-HTML_SCRIPT
+ "@CMake_BINARY_DIR@/CMake.Documentation.SphinxHTML.qs")
+ set(CPACK_IFW_COMPONENT_SPHINX-HTML_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISPLAY_NAME "Single HTML")
+ set(CPACK_COMPONENT_SPHINX-SINGLEHTML_GROUP Documentation)
+ set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISABLED TRUE)
+ set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_NAME "SphinxSingleHTML")
+ set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_VERSION
+ "@_CPACK_IFW_PACKAGE_VERSION@")
+
+ set(CPACK_COMPONENT_SPHINX-QTHELP_DISPLAY_NAME "Qt Compressed Help")
+ set(CPACK_COMPONENT_SPHINX-QTHELP_GROUP Documentation)
+ set(CPACK_COMPONENT_SPHINX-QTHELP_DISABLED TRUE)
+ set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp")
+ set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@")
+
endif()
if(CPACK_GENERATOR MATCHES "CygwinSource")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b91ab8..5e94028 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,17 @@ if(CMAKE_ENCODING_UTF8)
set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
endif()
+# option to use COMPONENT with install command
+option(CMake_INSTALL_COMPONENTS "Using components when installing" OFF)
+mark_as_advanced(CMake_INSTALL_COMPONENTS)
+macro(CMake_OPTIONAL_COMPONENT NAME)
+ if(CMake_INSTALL_COMPONENTS)
+ set(COMPONENT COMPONENT ${NAME})
+ else()
+ set(COMPONENT)
+ endif()
+endmacro()
+
#-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 3499da8..5daaf9c 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -28,7 +28,7 @@ License
We do not require any formal copyright assignment or contributor license
agreement. Any contributions intentionally sent upstream are presumed
-to be offerred under terms of the OSI-approved BSD 3-clause License.
+to be offered under terms of the OSI-approved BSD 3-clause License.
See `Copyright.txt`_ for details.
.. _`Copyright.txt`: Copyright.txt
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index 9358329..bd4d295 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -33,36 +33,47 @@ and the search will not be repeated unless the variable is cleared.
If nothing is found, the result will be
``<VAR>-NOTFOUND``, and the search will be attempted again the
next time |FIND_XXX| is invoked with the same variable.
-The name of the |SEARCH_XXX| that
-is searched for is specified by the names listed
-after the NAMES argument. Additional search locations
-can be specified after the PATHS argument. If ENV var is
-found in the HINTS or PATHS section the environment variable var
-will be read and converted from a system environment variable to
-a cmake style list of paths. For example ENV PATH would be a way
-to list the system path variable. The argument
-after DOC will be used for the documentation string in
-the cache.
-PATH_SUFFIXES specifies additional subdirectories to check below
-each search path.
-
-If NO_DEFAULT_PATH is specified, then no additional paths are
+
+Options include:
+
+``NAMES``
+ Specify one or more possible names for the |SEARCH_XXX|.
+
+ When using this to specify names with and without a version
+ suffix, we recommend specifying the unversioned name first
+ so that locally-built packages can be found before those
+ provided by distributions.
+
+``HINTS``, ``PATHS``
+ Specify directories to search in addition to the default locations.
+ The ``ENV var`` sub-option reads paths from a system environment
+ variable.
+
+``PATH_SUFFIXES``
+ Specify additional subdirectories to check below each directory
+ location otherwise considered.
+
+``DOC``
+ Specify the documentation string for the ``<VAR>`` cache entry.
+
+If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
added to the search.
-If NO_DEFAULT_PATH is not specified, the search process is as follows:
+If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
.. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
- <prefix>/|XXX_SUBDIR| for each <prefix> in CMAKE_PREFIX_PATH
+ |prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_PREFIX_PATH`
.. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace::
- <prefix>/|XXX_SUBDIR| for each <prefix>/[s]bin in PATH, and
- <entry>/|XXX_SUBDIR| for other entries in PATH
+ |prefix_XXX_SUBDIR| for each ``<prefix>/[s]bin`` in ``PATH``, and
+ |entry_XXX_SUBDIR| for other entries in ``PATH``
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace::
- <prefix>/|XXX_SUBDIR| for each <prefix> in CMAKE_SYSTEM_PREFIX_PATH
+ |prefix_XXX_SUBDIR| for each ``<prefix>`` in
+ :variable:`CMAKE_SYSTEM_PREFIX_PATH`
1. Search paths specified in cmake-specific cache variables.
- These are intended to be used on the command line with a -DVAR=value.
- This can be skipped if NO_CMAKE_PATH is passed.
+ These are intended to be used on the command line with a ``-DVAR=value``.
+ This can be skipped if ``NO_CMAKE_PATH`` is passed.
* |CMAKE_PREFIX_PATH_XXX|
* |CMAKE_XXX_PATH|
@@ -70,24 +81,24 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows:
2. Search paths specified in cmake-specific environment variables.
These are intended to be set in the user's shell configuration.
- This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
+ This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed.
* |CMAKE_PREFIX_PATH_XXX|
* |CMAKE_XXX_PATH|
* |CMAKE_XXX_MAC_PATH|
-3. Search the paths specified by the HINTS option.
+3. Search the paths specified by the ``HINTS`` option.
These should be paths computed by system introspection, such as a
hint provided by the location of another item already found.
- Hard-coded guesses should be specified with the PATHS option.
+ Hard-coded guesses should be specified with the ``PATHS`` option.
4. Search the standard system environment variables.
- This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
+ This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument.
* |SYSTEM_ENVIRONMENT_PATH_XXX|
5. Search cmake variables defined in the Platform files
- for the current system. This can be skipped if NO_CMAKE_SYSTEM_PATH
+ for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH``
is passed.
* |CMAKE_SYSTEM_PREFIX_PATH_XXX|
@@ -100,6 +111,9 @@ If NO_DEFAULT_PATH is not specified, the search process is as follows:
.. |FIND_ARGS_XXX| replace:: <VAR> NAMES name
-.. include:: FIND_XXX_MAC.txt
+On OS X the :variable:`CMAKE_FIND_FRAMEWORK` and
+:variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of
+preference between Apple-style and unix-style package components.
+
.. include:: FIND_XXX_ROOT.txt
.. include:: FIND_XXX_ORDER.txt
diff --git a/Help/command/FIND_XXX_MAC.txt b/Help/command/FIND_XXX_MAC.txt
deleted file mode 100644
index eb3900c..0000000
--- a/Help/command/FIND_XXX_MAC.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-On Darwin or systems supporting OS X Frameworks, the cmake variable
-CMAKE_FIND_FRAMEWORK can be set to empty or one of the following:
-
-* FIRST: Try to find frameworks before standard libraries or headers.
- This is the default on Darwin.
-
-* LAST: Try to find frameworks after standard libraries or headers.
-
-* ONLY: Only try to find frameworks.
-
-* NEVER: Never try to find frameworks.
-
-On Darwin or systems supporting OS X Application Bundles, the cmake
-variable CMAKE_FIND_APPBUNDLE can be set to empty or one of the
-following:
-
-* FIRST: Try to find application bundles before standard programs.
- This is the default on Darwin.
-
-* LAST: Try to find application bundles after standard programs.
-
-* ONLY: Only try to find application bundles.
-
-* NEVER: Never try to find application bundles.
diff --git a/Help/command/FIND_XXX_ROOT.txt b/Help/command/FIND_XXX_ROOT.txt
index b5cab68..fab2303 100644
--- a/Help/command/FIND_XXX_ROOT.txt
+++ b/Help/command/FIND_XXX_ROOT.txt
@@ -16,8 +16,14 @@ search there too. By default at first the directories listed in
directory is searched, and then the non-rooted directories will be
searched. The default behavior can be adjusted by setting
|CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually
-overridden on a per-call basis. By using CMAKE_FIND_ROOT_PATH_BOTH
-the search order will be as described above. If
-NO_CMAKE_FIND_ROOT_PATH is used then :variable:`CMAKE_FIND_ROOT_PATH` will not be
-used. If ONLY_CMAKE_FIND_ROOT_PATH is used then only the re-rooted
-directories and directories below :variable:`CMAKE_STAGING_PREFIX` will be searched.
+overridden on a per-call basis using options:
+
+``CMAKE_FIND_ROOT_PATH_BOTH``
+ Search in the order described above.
+
+``NO_CMAKE_FIND_ROOT_PATH``
+ Do not use the :variable:`CMAKE_FIND_ROOT_PATH` variable.
+
+``ONLY_CMAKE_FIND_ROOT_PATH``
+ Search only the re-rooted directories and directories below
+ :variable:`CMAKE_STAGING_PREFIX`.
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index e646c56..ecbf9dd 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -79,6 +79,9 @@ The options are:
If ``COMMAND`` specifies an executable target (created by the
:command:`add_executable` command) it will automatically be replaced
by the location of the executable created at build time.
+ (Use the ``TARGET_FILE``
+ :manual:`generator expression <cmake-generator-expressions(7)>` to
+ reference an executable later in the command line.)
Additionally a target-level dependency will be added so that the
executable target will be built before any target using this custom
command. However this does NOT add a file-level dependency that
diff --git a/Help/command/add_subdirectory.rst b/Help/command/add_subdirectory.rst
index 29b5017..e979253 100644
--- a/Help/command/add_subdirectory.rst
+++ b/Help/command/add_subdirectory.rst
@@ -12,23 +12,23 @@ Add a subdirectory to the build. The source_dir specifies the
directory in which the source CMakeLists.txt and code files are
located. If it is a relative path it will be evaluated with respect
to the current directory (the typical usage), but it may also be an
-absolute path. The binary_dir specifies the directory in which to
+absolute path. The ``binary_dir`` specifies the directory in which to
place the output files. If it is a relative path it will be evaluated
with respect to the current output directory, but it may also be an
-absolute path. If binary_dir is not specified, the value of
-source_dir, before expanding any relative path, will be used (the
+absolute path. If ``binary_dir`` is not specified, the value of
+``source_dir``, before expanding any relative path, will be used (the
typical usage). The CMakeLists.txt file in the specified source
directory will be processed immediately by CMake before processing in
the current input file continues beyond this command.
-If the EXCLUDE_FROM_ALL argument is provided then targets in the
-subdirectory will not be included in the ALL target of the parent
+If the ``EXCLUDE_FROM_ALL`` argument is provided then targets in the
+subdirectory will not be included in the ``ALL`` target of the parent
directory by default, and will be excluded from IDE project files.
Users must explicitly build targets in the subdirectory. This is
meant for use when the subdirectory contains a separate part of the
project that is useful but not necessary, such as a set of examples.
-Typically the subdirectory should contain its own project() command
-invocation so that a full build system will be generated in the
+Typically the subdirectory should contain its own :command:`project`
+command invocation so that a full build system will be generated in the
subdirectory (such as a VS IDE solution file). Note that inter-target
dependencies supercede this exclusion. If a target built by the
parent project depends on a target in the subdirectory, the dependee
diff --git a/Help/command/aux_source_directory.rst b/Help/command/aux_source_directory.rst
index 434d7a9..dcd1cdf 100644
--- a/Help/command/aux_source_directory.rst
+++ b/Help/command/aux_source_directory.rst
@@ -8,7 +8,7 @@ Find all source files in a directory.
aux_source_directory(<dir> <variable>)
Collects the names of all the source files in the specified directory
-and stores the list in the <variable> provided. This command is
+and stores the list in the ``<variable>`` provided. This command is
intended to be used by projects that use explicit template
instantiation. Template instantiation files can be stored in a
"Templates" subdirectory and collected automatically using this
diff --git a/Help/command/build_name.rst b/Help/command/build_name.rst
index 53cd05e..f717db1 100644
--- a/Help/command/build_name.rst
+++ b/Help/command/build_name.rst
@@ -3,7 +3,7 @@ build_name
Disallowed. See CMake Policy :policy:`CMP0036`.
-Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead.
+Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead.
::
@@ -11,4 +11,5 @@ Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead.
Sets the specified variable to a string representing the platform and
compiler settings. These values are now available through the
-CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables.
+:variable:`CMAKE_SYSTEM` and
+:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` variables.
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index ba545d5..9402d57 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -8,10 +8,10 @@ Query host system specific information.
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
Queries system information of the host system on which cmake runs.
-One or more <key> can be provided to select the information to be
-queried. The list of queried values is stored in <variable>.
+One or more ``<key>`` can be provided to select the information to be
+queried. The list of queried values is stored in ``<variable>``.
-<key> can be one of the following values:
+``<key>`` can be one of the following values:
::
diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst
index 9865eeb..8573218 100644
--- a/Help/command/cmake_minimum_required.rst
+++ b/Help/command/cmake_minimum_required.rst
@@ -25,7 +25,7 @@ When version 2.4 or lower is given the command implicitly invokes
which enables compatibility features for CMake 2.4 and lower.
-The FATAL_ERROR option is accepted but ignored by CMake 2.6 and
+The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and
higher. It should be specified so CMake versions 2.4 and lower fail
with an error instead of just a warning.
diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst
index 2bc3287..b51b951 100644
--- a/Help/command/cmake_policy.rst
+++ b/Help/command/cmake_policy.rst
@@ -53,6 +53,8 @@ policy warning by setting the policy state to ``OLD``. Alternatively
one may fix the project to work with the new behavior and set the
policy state to ``NEW``.
+.. include:: ../policy/DEPRECATED.txt
+
Checking Policy Settings
^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/command/create_test_sourcelist.rst b/Help/command/create_test_sourcelist.rst
index 9addd67..dde6812 100644
--- a/Help/command/create_test_sourcelist.rst
+++ b/Help/command/create_test_sourcelist.rst
@@ -14,17 +14,17 @@ A test driver is a program that links together many small tests into a
single executable. This is useful when building static executables
with large libraries to shrink the total required size. The list of
source files needed to build the test driver will be in
-sourceListName. DriverName is the name of the test driver program.
+``sourceListName``. ``driverName`` is the name of the test driver program.
The rest of the arguments consist of a list of test source files, can
be semicolon separated. Each test source file should have a function
in it that is the same name as the file with no extension (foo.cxx
-should have int foo(int, char*[]);) DriverName will be able to call
-each of the tests by name on the command line. If EXTRA_INCLUDE is
+should have int foo(int, char*[]);) ``driverName`` will be able to call
+each of the tests by name on the command line. If ``EXTRA_INCLUDE`` is
specified, then the next argument is included into the generated file.
-If FUNCTION is specified, then the next argument is taken as a
+If ``FUNCTION`` is specified, then the next argument is taken as a
function name that is passed a pointer to ac and av. This can be used
-to add extra command line processing to each test. The cmake variable
-CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to have code that will be
-placed directly before calling the test main function.
-CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that will be
-placed directly after the call to the test main function.
+to add extra command line processing to each test. The
+``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to
+have code that will be placed directly before calling the test main function.
+``CMAKE_TESTDRIVER_AFTER_TESTMAIN`` can be set to have code that
+will be placed directly after the call to the test main function.
diff --git a/Help/command/ctest_memcheck.rst b/Help/command/ctest_memcheck.rst
index 2800511..29bdf7d 100644
--- a/Help/command/ctest_memcheck.rst
+++ b/Help/command/ctest_memcheck.rst
@@ -14,6 +14,7 @@ Perform the :ref:`CTest MemCheck Step` as a :ref:`Dashboard Client`.
[EXCLUDE_LABEL <label-exclude-regex>]
[INCLUDE_LABEL <label-include-regex>]
[PARALLEL_LEVEL <level>]
+ [TEST_LOAD <threshold>]
[SCHEDULE_RANDOM <ON|OFF>]
[STOP_TIME <time-of-day>]
[RETURN_VALUE <result-var>]
diff --git a/Help/command/ctest_run_script.rst b/Help/command/ctest_run_script.rst
index 0f35019..5ec543e 100644
--- a/Help/command/ctest_run_script.rst
+++ b/Help/command/ctest_run_script.rst
@@ -10,6 +10,6 @@ runs a ctest -S script
Runs a script or scripts much like if it was run from ctest -S. If no
argument is provided then the current script is run using the current
-settings of the variables. If NEW_PROCESS is specified then each
-script will be run in a separate process.If RETURN_VALUE is specified
-the return value of the last script run will be put into var.
+settings of the variables. If ``NEW_PROCESS`` is specified then each
+script will be run in a separate process.If ``RETURN_VALUE`` is specified
+the return value of the last script run will be put into ``var``.
diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst
index b5c7b34..63db32f 100644
--- a/Help/command/ctest_start.rst
+++ b/Help/command/ctest_start.rst
@@ -14,7 +14,7 @@ after the binary directory is initialized. If the 'source' and
If the track is
specified, the submissions will go to the specified track. If APPEND
is used, the existing TAG is used rather than creating a new one based
-on the current time stamp. If QUIET is used, CTest will suppress any
+on the current time stamp. If ``QUIET`` is used, CTest will suppress any
non-error messages that it otherwise would have printed to the console.
If the :variable:`CTEST_CHECKOUT_COMMAND` variable
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst
index 8cbb9ec..162db69 100644
--- a/Help/command/ctest_test.rst
+++ b/Help/command/ctest_test.rst
@@ -14,6 +14,7 @@ Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
[EXCLUDE_LABEL <label-exclude-regex>]
[INCLUDE_LABEL <label-include-regex>]
[PARALLEL_LEVEL <level>]
+ [TEST_LOAD <threshold>]
[SCHEDULE_RANDOM <ON|OFF>]
[STOP_TIME <time-of-day>]
[RETURN_VALUE <result-var>]
@@ -41,7 +42,7 @@ The options are:
Specify the end of a range of test numbers.
``STRIDE <stride-number>``
- Specify the stride by which to step acorss a range of test numbers.
+ Specify the stride by which to step across a range of test numbers.
``EXCLUDE <exclude-regex>``
Specify a regular expression matching test names to exclude.
@@ -61,6 +62,13 @@ The options are:
Specify a positive number representing the number of tests to
be run in parallel.
+``TEST_LOAD <threshold>``
+ While running tests in parallel, try not to start tests when they
+ may cause the CPU load to pass above a given threshold. If not
+ specified the :variable:`CTEST_TEST_LOAD` variable will be checked,
+ and then the ``--test-load`` command-line argument to :manual:`ctest(1)`.
+ See also the ``TestLoad`` setting in the :ref:`CTest Test Step`.
+
``SCHEDULE_RANDOM <ON|OFF>``
Launch tests in a random order. This may be useful for detecting
implicit test dependencies.
diff --git a/Help/command/define_property.rst b/Help/command/define_property.rst
index 62bcd1b..873c6ca 100644
--- a/Help/command/define_property.rst
+++ b/Help/command/define_property.rst
@@ -11,11 +11,11 @@ Define and document custom properties.
BRIEF_DOCS <brief-doc> [docs...]
FULL_DOCS <full-doc> [docs...])
-Define one property in a scope for use with the set_property and
-get_property commands. This is primarily useful to associate
+Define one property in a scope for use with the :command:`set_property` and
+:command:`get_property` commands. This is primarily useful to associate
documentation with property names that may be retrieved with the
-get_property command. The first argument determines the kind of scope
-in which the property should be used. It must be one of the
+:command:`get_property` command. The first argument determines the kind of
+scope in which the property should be used. It must be one of the
following:
::
@@ -28,18 +28,18 @@ following:
VARIABLE = documents a CMake language variable
CACHED_VARIABLE = documents a CMake cache variable
-Note that unlike set_property and get_property no actual scope needs
-to be given; only the kind of scope is important.
+Note that unlike :command:`set_property` and :command:`get_property` no
+actual scope needs to be given; only the kind of scope is important.
-The required PROPERTY option is immediately followed by the name of
+The required ``PROPERTY`` option is immediately followed by the name of
the property being defined.
-If the INHERITED option then the get_property command will chain up to
-the next higher scope when the requested property is not set in the
-scope given to the command. DIRECTORY scope chains to GLOBAL.
-TARGET, SOURCE, and TEST chain to DIRECTORY.
+If the ``INHERITED`` option then the :command:`get_property` command will
+chain up to the next higher scope when the requested property is not set
+in the scope given to the command. ``DIRECTORY`` scope chains to
+``GLOBAL``. ``TARGET``, ``SOURCE``, and ``TEST`` chain to ``DIRECTORY``.
-The BRIEF_DOCS and FULL_DOCS options are followed by strings to be
+The ``BRIEF_DOCS`` and ``FULL_DOCS`` options are followed by strings to be
associated with the property as its brief and full documentation.
-Corresponding options to the get_property command will retrieve the
-documentation.
+Corresponding options to the :command:`get_property` command will retrieve
+the documentation.
diff --git a/Help/command/else.rst b/Help/command/else.rst
index 5eece95..0e5a198 100644
--- a/Help/command/else.rst
+++ b/Help/command/else.rst
@@ -7,4 +7,4 @@ Starts the else portion of an if block.
else(expression)
-See the if command.
+See the :command:`if` command.
diff --git a/Help/command/elseif.rst b/Help/command/elseif.rst
index 96ee0e9..9a8dfed 100644
--- a/Help/command/elseif.rst
+++ b/Help/command/elseif.rst
@@ -7,4 +7,4 @@ Starts the elseif portion of an if block.
elseif(expression)
-See the if command.
+See the :command:`if` command.
diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst
index d46ff7e..4445561 100644
--- a/Help/command/enable_language.rst
+++ b/Help/command/enable_language.rst
@@ -18,5 +18,5 @@ targets using the named language directly for compiling sources or
indirectly through link dependencies. It is simplest to enable all
needed languages in the top-level directory of a project.
-The OPTIONAL keyword is a placeholder for future implementation and
+The ``OPTIONAL`` keyword is a placeholder for future implementation and
does not currently work.
diff --git a/Help/command/enable_testing.rst b/Help/command/enable_testing.rst
index 41ecd5b..1e3e279 100644
--- a/Help/command/enable_testing.rst
+++ b/Help/command/enable_testing.rst
@@ -7,7 +7,7 @@ Enable testing for current directory and below.
enable_testing()
-Enables testing for this directory and below. See also the add_test
-command. Note that ctest expects to find a test file in the build
-directory root. Therefore, this command should be in the source
-directory root.
+Enables testing for this directory and below. See also the
+:command:`add_test` command. Note that ctest expects to find a test file
+in the build directory root. Therefore, this command should be in the
+source directory root.
diff --git a/Help/command/endforeach.rst b/Help/command/endforeach.rst
index f23552d..9af972b 100644
--- a/Help/command/endforeach.rst
+++ b/Help/command/endforeach.rst
@@ -1,10 +1,10 @@
endforeach
----------
-Ends a list of commands in a FOREACH block.
+Ends a list of commands in a foreach block.
::
endforeach(expression)
-See the FOREACH command.
+See the :command:`foreach` command.
diff --git a/Help/command/endfunction.rst b/Help/command/endfunction.rst
index 63e70ba..6cc196c 100644
--- a/Help/command/endfunction.rst
+++ b/Help/command/endfunction.rst
@@ -7,4 +7,4 @@ Ends a list of commands in a function block.
endfunction(expression)
-See the function command.
+See the :command:`function` command.
diff --git a/Help/command/endif.rst b/Help/command/endif.rst
index 4c9955c..a0163bf 100644
--- a/Help/command/endif.rst
+++ b/Help/command/endif.rst
@@ -7,4 +7,4 @@ Ends a list of commands in an if block.
endif(expression)
-See the if command.
+See the :command:`if` command.
diff --git a/Help/command/endmacro.rst b/Help/command/endmacro.rst
index 524fc80..47327a7 100644
--- a/Help/command/endmacro.rst
+++ b/Help/command/endmacro.rst
@@ -7,4 +7,4 @@ Ends a list of commands in a macro block.
endmacro(expression)
-See the macro command.
+See the :command:`macro` command.
diff --git a/Help/command/endwhile.rst b/Help/command/endwhile.rst
index 11fdc1b..798c20e 100644
--- a/Help/command/endwhile.rst
+++ b/Help/command/endwhile.rst
@@ -7,4 +7,4 @@ Ends a list of commands in a while block.
endwhile(expression)
-See the while command.
+See the :command:`while` command.
diff --git a/Help/command/exec_program.rst b/Help/command/exec_program.rst
index aaa0dac..6dfdad3 100644
--- a/Help/command/exec_program.rst
+++ b/Help/command/exec_program.rst
@@ -1,7 +1,7 @@
exec_program
------------
-Deprecated. Use the execute_process() command instead.
+Deprecated. Use the :command:`execute_process` command instead.
Run an executable program during the processing of the CMakeList.txt
file.
@@ -15,10 +15,10 @@ file.
The executable is run in the optionally specified directory. The
executable can include arguments if it is double quoted, but it is
-better to use the optional ARGS argument to specify arguments to the
+better to use the optional ``ARGS`` argument to specify arguments to the
program. This is because cmake will then be able to escape spaces in
-the executable path. An optional argument OUTPUT_VARIABLE specifies a
+the executable path. An optional argument ``OUTPUT_VARIABLE`` specifies a
variable in which to store the output. To capture the return value of
-the execution, provide a RETURN_VALUE. If OUTPUT_VARIABLE is
+the execution, provide a ``RETURN_VALUE``. If ``OUTPUT_VARIABLE`` is
specified, then no output will go to the stdout/stderr of the console
running cmake.
diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst
index c38ec1a..ca44b53 100644
--- a/Help/command/execute_process.rst
+++ b/Help/command/execute_process.rst
@@ -26,7 +26,7 @@ A single standard error pipe is used for all processes.
Options:
-COMMAND
+``COMMAND``
A child process command line.
CMake executes the child process using operating system APIs directly.
@@ -36,31 +36,31 @@ COMMAND
(Use the ``INPUT_*``, ``OUTPUT_*``, and ``ERROR_*`` options to
redirect stdin, stdout, and stderr.)
-WORKING_DIRECTORY
+``WORKING_DIRECTORY``
The named directory will be set as the current working directory of
the child processes.
-TIMEOUT
+``TIMEOUT``
The child processes will be terminated if they do not finish in the
specified number of seconds (fractions are allowed).
-RESULT_VARIABLE
+``RESULT_VARIABLE``
The variable will be set to contain the result of running the processes.
This will be an integer return code from the last child or a string
describing an error condition.
-OUTPUT_VARIABLE, ERROR_VARIABLE
+``OUTPUT_VARIABLE``, ``ERROR_VARIABLE``
The variable named will be set with the contents of the standard output
and standard error pipes, respectively. If the same variable is named
for both pipes their output will be merged in the order produced.
-INPUT_FILE, OUTPUT_FILE, ERROR_FILE
+``INPUT_FILE, OUTPUT_FILE``, ``ERROR_FILE``
The file named will be attached to the standard input of the first
process, standard output of the last process, or standard error of
all processes, respectively. If the same file is named for both
output and error then it will be used for both.
-OUTPUT_QUIET, ERROR_QUIET
+``OUTPUT_QUIET``, ``ERROR_QUIET``
The standard output or standard error results will be quietly ignored.
If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
diff --git a/Help/command/export.rst b/Help/command/export.rst
index d4bab35..4419dc1 100644
--- a/Help/command/export.rst
+++ b/Help/command/export.rst
@@ -7,20 +7,20 @@ Export targets from the build tree for use by outside projects.
export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])
-Create a file <filename> that may be included by outside projects to
+Create a file ``<filename>`` that may be included by outside projects to
import targets from the current project's build tree. This is useful
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
+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.
-Target installations are associated with the export <export-name>
+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
-targets from an installation tree.
+should never be installed. See the :command:`install(EXPORT)` command to
+export targets from an installation tree.
The properties set on the generated IMPORTED targets will have the
same values as the final values of the input TARGETS.
@@ -45,12 +45,12 @@ unspecified.
export(PACKAGE <name>)
Store the current build directory in the CMake user package registry
-for package <name>. The find_package command may consider the
-directory while searching for package <name>. This helps dependent
+for package ``<name>``. The find_package command may consider the
+directory while searching for package ``<name>``. This helps dependent
projects find and use a package from the current project's build tree
without help from the user. Note that the entry in the package
registry that this command creates works only in conjunction with a
-package configuration file (<name>Config.cmake) that works with the
+package configuration file (``<name>Config.cmake``) that works with the
build tree. In some cases, for example for packaging and for system
wide installations, it is not desirable to write the user package
registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable
diff --git a/Help/command/export_library_dependencies.rst b/Help/command/export_library_dependencies.rst
index 73c0b42..2cb437e 100644
--- a/Help/command/export_library_dependencies.rst
+++ b/Help/command/export_library_dependencies.rst
@@ -7,22 +7,22 @@ Use :command:`install(EXPORT)` or :command:`export` command.
This command generates an old-style library dependencies file.
Projects requiring CMake 2.6 or later should not use the command. Use
-instead the install(EXPORT) command to help export targets from an
-installation tree and the export() command to export targets from a
+instead the :command:`install(EXPORT)` command to help export targets from an
+installation tree and the :command:`export` command to export targets from a
build tree.
The old-style library dependencies file does not take into account
-per-configuration names of libraries or the LINK_INTERFACE_LIBRARIES
-target property.
+per-configuration names of libraries or the
+:prop_tgt:`LINK_INTERFACE_LIBRARIES` target property.
::
export_library_dependencies(<file> [APPEND])
-Create a file named <file> that can be included into a CMake listfile
+Create a file named ``<file>`` that can be included into a CMake listfile
with the INCLUDE command. The file will contain a number of SET
commands that will set all the variables needed for library dependency
information. This should be the last command in the top level
-CMakeLists.txt file of the project. If the APPEND option is
+CMakeLists.txt file of the project. If the ``APPEND`` option is
specified, the SET commands will be appended to the given file instead
of replacing it.
diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst
index be309a5..bf7a919 100644
--- a/Help/command/find_file.rst
+++ b/Help/command/find_file.rst
@@ -5,24 +5,27 @@ find_file
.. |NAMES| replace:: NAMES name1 [name2 ...]
.. |SEARCH_XXX| replace:: full path to a file
.. |SEARCH_XXX_DESC| replace:: full path to named file
-.. |XXX_SUBDIR| replace:: include
+.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/include``
+.. |entry_XXX_SUBDIR| replace:: ``<entry>/include``
.. |CMAKE_PREFIX_PATH_XXX| replace::
- <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |CMAKE_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH
-.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR|
+.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH`
+.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE,
- <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|,
- and the directories in PATH itself.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``,
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the
+ directories in ``PATH`` itself.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
- <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH
-.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
+.. |CMAKE_SYSTEM_XXX_PATH| replace::
+ :variable:`CMAKE_SYSTEM_INCLUDE_PATH`
+.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace::
+ :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH`
.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
:variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE`
diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst
index e3dcd2b..5d07574 100644
--- a/Help/command/find_library.rst
+++ b/Help/command/find_library.rst
@@ -5,33 +5,36 @@ find_library
.. |NAMES| replace:: NAMES name1 [name2 ...] [NAMES_PER_DIR]
.. |SEARCH_XXX| replace:: library
.. |SEARCH_XXX_DESC| replace:: library
-.. |XXX_SUBDIR| replace:: lib
+.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/lib``
+.. |entry_XXX_SUBDIR| replace:: ``<entry>/lib``
.. |CMAKE_PREFIX_PATH_XXX| replace::
- <prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |CMAKE_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_XXX_PATH| replace:: CMAKE_LIBRARY_PATH
-.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH
+ ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
+ and |CMAKE_PREFIX_PATH_XXX_SUBDIR|
+.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH`
+.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in LIB,
- <prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|,
- and the directories in PATH itself.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``LIB``,
+ ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
+ and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|,
+ and the directories in ``PATH`` itself.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
- <prefix>/lib/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_LIBRARY_PATH
-.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH
+ ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
+ and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
+.. |CMAKE_SYSTEM_XXX_PATH| replace::
+ :variable:`CMAKE_SYSTEM_LIBRARY_PATH`
+.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace::
+ :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH`
.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
:variable:`CMAKE_FIND_ROOT_PATH_MODE_LIBRARY`
.. include:: FIND_XXX.txt
-When more than one value is given to the NAMES option this command by
+When more than one value is given to the ``NAMES`` option this command by
default will consider one name at a time and search every directory
-for it. The NAMES_PER_DIR option tells this command to consider one
+for it. The ``NAMES_PER_DIR`` option tells this command to consider one
directory at a time and search for all names in it.
Each library name given to the ``NAMES`` option is first considered
@@ -40,14 +43,14 @@ prefixes (e.g. ``lib``) and suffixes (e.g. ``.so``). Therefore one
may specify library file names such as ``libfoo.a`` directly.
This can be used to locate static libraries on UNIX-like systems.
-If the library found is a framework, then VAR will be set to the full
-path to the framework <fullPath>/A.framework. When a full path to a
-framework is used as a library, CMake will use a -framework A, and a
--F<fullPath> to link the framework to the target.
+If the library found is a framework, then ``<VAR>`` will be set to the full
+path to the framework ``<fullPath>/A.framework``. When a full path to a
+framework is used as a library, CMake will use a ``-framework A``, and a
+``-F<fullPath>`` to link the framework to the target.
-If the global property FIND_LIBRARY_USE_LIB64_PATHS is set all search
-paths will be tested as normal, with "64/" appended, and with all
-matches of "lib/" replaced with "lib64/". This property is
+If the :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global property is set
+all search paths will be tested as normal, with ``64/`` appended, and
+with all matches of ``lib/`` replaced with ``lib64/``. This property is
automatically set for the platforms that are known to need it if at
-least one of the languages supported by the PROJECT command is
-enabled.
+least one of the languages supported by the :command:`project` command
+is enabled.
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index a5efba6..58dff9d 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -228,9 +228,9 @@ installation directory. Those marked with (U) are intended for
installations on UNIX platforms where the prefix is shared by multiple
packages. This is merely a convention, so all (W) and (U) directories
are still searched on all platforms. Directories marked with (A) are
-intended for installations on Apple platforms. The cmake variables
-``CMAKE_FIND_FRAMEWORK`` and ``CMAKE_FIND_APPBUNDLE``
-determine the order of preference as specified below.
+intended for installations on Apple platforms. The
+:variable:`CMAKE_FIND_FRAMEWORK` and :variable:`CMAKE_FIND_APPBUNDLE`
+variables determine the order of preference.
The set of installation prefixes is constructed using the following
steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are
@@ -295,7 +295,6 @@ enabled.
.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
:variable:`CMAKE_FIND_ROOT_PATH_MODE_PACKAGE`
-.. include:: FIND_XXX_MAC.txt
.. include:: FIND_XXX_ROOT.txt
.. include:: FIND_XXX_ORDER.txt
diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst
index b5a6e37..4403cb5 100644
--- a/Help/command/find_path.rst
+++ b/Help/command/find_path.rst
@@ -5,31 +5,34 @@ find_path
.. |NAMES| replace:: NAMES name1 [name2 ...]
.. |SEARCH_XXX| replace:: file in a directory
.. |SEARCH_XXX_DESC| replace:: directory containing the named file
-.. |XXX_SUBDIR| replace:: include
+.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/include``
+.. |entry_XXX_SUBDIR| replace:: ``<entry>/include``
.. |CMAKE_PREFIX_PATH_XXX| replace::
- <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |CMAKE_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_XXX_PATH| replace:: CMAKE_INCLUDE_PATH
-.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_FRAMEWORK_PATH
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR|
+.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH`
+.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in INCLUDE,
- <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|,
- and the directories in PATH itself.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``,
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the
+ directories in ``PATH`` itself.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
- <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and
- |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_INCLUDE_PATH
-.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_FRAMEWORK_PATH
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
+.. |CMAKE_SYSTEM_XXX_PATH| replace::
+ :variable:`CMAKE_SYSTEM_INCLUDE_PATH`
+.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace::
+ :variable:`CMAKE_SYSTEM_FRAMEWORK_PATH`
.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
:variable:`CMAKE_FIND_ROOT_PATH_MODE_INCLUDE`
.. include:: FIND_XXX.txt
-When searching for frameworks, if the file is specified as A/b.h, then
-the framework search will look for A.framework/Headers/b.h. If that
+When searching for frameworks, if the file is specified as ``A/b.h``, then
+the framework search will look for ``A.framework/Headers/b.h``. If that
is found the path will be set to the path to the framework. CMake
-will convert this to the correct -F option to include the file.
+will convert this to the correct ``-F`` option to include the file.
diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst
index c62a8a5..2a5ce9a 100644
--- a/Help/command/find_program.rst
+++ b/Help/command/find_program.rst
@@ -5,19 +5,22 @@ find_program
.. |NAMES| replace:: NAMES name1 [name2 ...]
.. |SEARCH_XXX| replace:: program
.. |SEARCH_XXX_DESC| replace:: program
-.. |XXX_SUBDIR| replace:: [s]bin
+.. |prefix_XXX_SUBDIR| replace:: ``<prefix>/[s]bin``
+.. |entry_XXX_SUBDIR| replace:: ``<entry>/[s]bin``
.. |CMAKE_PREFIX_PATH_XXX| replace::
|CMAKE_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_XXX_PATH| replace:: CMAKE_PROGRAM_PATH
-.. |CMAKE_XXX_MAC_PATH| replace:: CMAKE_APPBUNDLE_PATH
+.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH`
+.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_APPBUNDLE_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: PATH
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: ``PATH``
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
|CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
-.. |CMAKE_SYSTEM_XXX_PATH| replace:: CMAKE_SYSTEM_PROGRAM_PATH
-.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace:: CMAKE_SYSTEM_APPBUNDLE_PATH
+.. |CMAKE_SYSTEM_XXX_PATH| replace::
+ :variable:`CMAKE_SYSTEM_PROGRAM_PATH`
+.. |CMAKE_SYSTEM_XXX_MAC_PATH| replace::
+ :variable:`CMAKE_SYSTEM_APPBUNDLE_PATH`
.. |CMAKE_FIND_ROOT_PATH_MODE_XXX| replace::
:variable:`CMAKE_FIND_ROOT_PATH_MODE_PROGRAM`
diff --git a/Help/command/fltk_wrap_ui.rst b/Help/command/fltk_wrap_ui.rst
index 448ae64..041e5a7 100644
--- a/Help/command/fltk_wrap_ui.rst
+++ b/Help/command/fltk_wrap_ui.rst
@@ -10,5 +10,5 @@ Create FLTK user interfaces Wrappers.
Produce .h and .cxx files for all the .fl and .fld files listed. The
resulting .h and .cxx files will be added to a variable named
-resultingLibraryName_FLTK_UI_SRCS which should be added to your
+``resultingLibraryName_FLTK_UI_SRCS`` which should be added to your
library.
diff --git a/Help/command/foreach.rst b/Help/command/foreach.rst
index 348ebd8..c0f3679 100644
--- a/Help/command/foreach.rst
+++ b/Help/command/foreach.rst
@@ -15,7 +15,7 @@ All commands between foreach and the matching endforeach are recorded
without being invoked. Once the endforeach is evaluated, the recorded
list of commands is invoked once for each argument listed in the
original foreach command. Before each iteration of the loop
-"${loop_var}" will be set as a variable with the current value in the
+``${loop_var}`` will be set as a variable with the current value in the
list.
::
@@ -40,8 +40,8 @@ three types of this iteration:
foreach(loop_var IN [LISTS [list1 [...]]]
[ITEMS [item1 [...]]])
-Iterates over a precise list of items. The LISTS option names
+Iterates over a precise list of items. The ``LISTS`` option names
list-valued variables to be traversed, including empty elements (an
empty string is a zero-length list). (Note macro
-arguments are not variables.) The ITEMS option ends argument
+arguments are not variables.) The ``ITEMS`` option ends argument
parsing and includes all arguments following it in the iteration.
diff --git a/Help/command/get_cmake_property.rst b/Help/command/get_cmake_property.rst
index bcfc5e8..3a6fb41 100644
--- a/Help/command/get_cmake_property.rst
+++ b/Help/command/get_cmake_property.rst
@@ -8,8 +8,8 @@ Get a property of the CMake instance.
get_cmake_property(VAR property)
Get a property from the CMake instance. The value of the property is
-stored in the variable VAR. If the property is not found, VAR will be
-set to "NOTFOUND". Some supported properties include: VARIABLES,
-CACHE_VARIABLES, COMMANDS, MACROS, and COMPONENTS.
+stored in the variable ``VAR``. If the property is not found, ``VAR``
+will be set to "NOTFOUND". See the :manual:`cmake-properties(7)` manual
+for available properties.
-See also the more general get_property() command.
+See also the more general :command:`get_property` command.
diff --git a/Help/command/get_directory_property.rst b/Help/command/get_directory_property.rst
index f2a0a80..e50abe0 100644
--- a/Help/command/get_directory_property.rst
+++ b/Help/command/get_directory_property.rst
@@ -1,14 +1,14 @@
get_directory_property
----------------------
-Get a property of DIRECTORY scope.
+Get a property of ``DIRECTORY`` scope.
::
get_directory_property(<variable> [DIRECTORY <dir>] <prop-name>)
Store a property of directory scope in the named variable. If the
-property is not defined the empty-string is returned. The DIRECTORY
+property is not defined the empty-string is returned. The ``DIRECTORY``
argument specifies another directory from which to retrieve the
property value. The specified directory must have already been
traversed by CMake.
@@ -21,4 +21,4 @@ traversed by CMake.
Get a variable definition from a directory. This form is useful to
get a variable definition from another directory.
-See also the more general get_property() command.
+See also the more general :command:`get_property` command.
diff --git a/Help/command/get_filename_component.rst b/Help/command/get_filename_component.rst
index 5eec792..60488da 100644
--- a/Help/command/get_filename_component.rst
+++ b/Help/command/get_filename_component.rst
@@ -7,7 +7,7 @@ Get a specific component of a full filename.
get_filename_component(<VAR> <FileName> <COMP> [CACHE])
-Set <VAR> to a component of <FileName>, where <COMP> is one of:
+Set ``<VAR>`` to a component of ``<FileName>``, where ``<COMP>`` is one of:
::
@@ -21,7 +21,7 @@ Set <VAR> to a component of <FileName>, where <COMP> is one of:
Paths are returned with forward slashes and have no trailing slahes.
The longest file extension is always considered. If the optional
-CACHE argument is specified, the result variable is added to the
+``CACHE`` argument is specified, the result variable is added to the
cache.
::
@@ -30,8 +30,8 @@ cache.
PROGRAM [PROGRAM_ARGS <ARG_VAR>]
[CACHE])
-The program in FileName will be found in the system search path or
-left as a full path. If PROGRAM_ARGS is present with PROGRAM, then
-any command-line arguments present in the FileName string are split
-from the program name and stored in <ARG_VAR>. This is used to
+The program in ``FileName`` will be found in the system search path or
+left as a full path. If ``PROGRAM_ARGS`` is present with ``PROGRAM``, then
+any command-line arguments present in the ``FileName`` string are split
+from the program name and stored in ``<ARG_VAR>``. This is used to
separate a program name from its arguments in a command line string.
diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst
index 80c512b..3e975c2 100644
--- a/Help/command/get_source_file_property.rst
+++ b/Help/command/get_source_file_property.rst
@@ -8,9 +8,9 @@ Get a property for a source file.
get_source_file_property(VAR file property)
Get a property from a source file. The value of the property is
-stored in the variable VAR. If the property is not found, VAR will be
-set to "NOTFOUND". Use set_source_files_properties to set property
-values. Source file properties usually control how the file is built.
-One property that is always there is LOCATION
+stored in the variable ``VAR``. If the property is not found, ``VAR``
+will be set to "NOTFOUND". Use :command:`set_source_files_properties`
+to set property values. Source file properties usually control how the
+file is built. One property that is always there is :prop_sf:`LOCATION`
-See also the more general get_property() command.
+See also the more general :command:`get_property` command.
diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst
index 4017d31..7798252 100644
--- a/Help/command/get_target_property.rst
+++ b/Help/command/get_target_property.rst
@@ -8,11 +8,11 @@ Get a property from a target.
get_target_property(VAR target property)
Get a property from a target. The value of the property is stored in
-the variable VAR. If the property is not found, VAR will be set to
-"NOTFOUND". Use set_target_properties to set property values.
+the variable ``VAR``. If the property is not found, ``VAR`` will be set to
+"NOTFOUND". Use :command:`set_target_properties` to set property values.
Properties are usually used to control how a target is built, but some
query the target instead. This command can get properties for any
target so far created. The targets do not need to be in the current
CMakeLists.txt file.
-See also the more general get_property() command.
+See also the more general :command:`get_property` command.
diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst
index 391a32e..e359f4b 100644
--- a/Help/command/get_test_property.rst
+++ b/Help/command/get_test_property.rst
@@ -8,8 +8,8 @@ Get a property of the test.
get_test_property(test property VAR)
Get a property from the test. The value of the property is stored in
-the variable VAR. If the test or property is not found, VAR will be
-set to "NOTFOUND". For a list of standard properties you can type cmake
---help-property-list.
+the variable ``VAR``. If the test or property is not found, ``VAR`` will
+be set to "NOTFOUND". For a list of standard properties you can type
+``cmake --help-property-list``.
-See also the more general get_property() command.
+See also the more general :command:`get_property` command.
diff --git a/Help/command/include.rst b/Help/command/include.rst
index a9074c1..c391561 100644
--- a/Help/command/include.rst
+++ b/Help/command/include.rst
@@ -9,17 +9,17 @@ Load and run CMake code from a file or module.
[NO_POLICY_SCOPE])
Load and run CMake code from the file given. Variable reads and
-writes access the scope of the caller (dynamic scoping). If OPTIONAL
+writes access the scope of the caller (dynamic scoping). If ``OPTIONAL``
is present, then no error is raised if the file does not exist. If
-RESULT_VARIABLE is given the variable will be set to the full filename
+``RESULT_VARIABLE`` is given the variable will be set to the full filename
which has been included or NOTFOUND if it failed.
If a module is specified instead of a file, the file with name
-<modulename>.cmake is searched first in CMAKE_MODULE_PATH, then in the
-CMake module directory. There is one exception to this: if the file
-which calls include() is located itself in the CMake module directory,
-then first the CMake module directory is searched and
-CMAKE_MODULE_PATH afterwards. See also policy CMP0017.
+<modulename>.cmake is searched first in :variable:`CMAKE_MODULE_PATH`,
+then in the CMake module directory. There is one exception to this: if
+the file which calls ``include()`` is located itself in the CMake module
+directory, then first the CMake module directory is searched and
+:variable:`CMAKE_MODULE_PATH` afterwards. See also policy :policy:`CMP0017`.
-See the cmake_policy() command documentation for discussion of the
-NO_POLICY_SCOPE option.
+See the :command:`cmake_policy` command documentation for discussion of the
+``NO_POLICY_SCOPE`` option.
diff --git a/Help/command/include_external_msproject.rst b/Help/command/include_external_msproject.rst
index ba9a393..595762d 100644
--- a/Help/command/include_external_msproject.rst
+++ b/Help/command/include_external_msproject.rst
@@ -13,10 +13,10 @@ Include an external Microsoft project file in a workspace.
Includes an external Microsoft project in the generated workspace
file. Currently does nothing on UNIX. This will create a target
-named [projectname]. This can be used in the add_dependencies command
-to make things depend on the external project.
+named [projectname]. This can be used in the :command:`add_dependencies`
+command to make things depend on the external project.
-TYPE, GUID and PLATFORM are optional parameters that allow one to
+``TYPE``, ``GUID`` and ``PLATFORM`` are optional parameters that allow one to
specify the type of project, id (GUID) of the project and the name of
the target platform. This is useful for projects requiring values
other than the default (e.g. WIX projects). These options are not
diff --git a/Help/command/include_regular_expression.rst b/Help/command/include_regular_expression.rst
index dd887df..ab5a563 100644
--- a/Help/command/include_regular_expression.rst
+++ b/Help/command/include_regular_expression.rst
@@ -8,8 +8,8 @@ Set the regular expression used for dependency checking.
include_regular_expression(regex_match [regex_complain])
Set the regular expressions used in dependency checking. Only files
-matching regex_match will be traced as dependencies. Only files
-matching regex_complain will generate warnings if they cannot be found
+matching ``regex_match`` will be traced as dependencies. Only files
+matching ``regex_complain`` will generate warnings if they cannot be found
(standard header paths are not searched). The defaults are:
::
diff --git a/Help/command/install_files.rst b/Help/command/install_files.rst
index 7b6bd81..1850be6 100644
--- a/Help/command/install_files.rst
+++ b/Help/command/install_files.rst
@@ -1,13 +1,13 @@
install_files
-------------
-Deprecated. Use the install(FILES ) command instead.
+Deprecated. Use the :command:`install(FILES)` command instead.
-This command has been superceded by the install command. It is
-provided for compatibility with older CMake code. The FILES form is
-directly replaced by the FILES form of the install command. The
-regexp form can be expressed more clearly using the GLOB form of the
-file command.
+This command has been superceded by the :command:`install` command. It is
+provided for compatibility with older CMake code. The ``FILES`` form is
+directly replaced by the ``FILES`` form of the :command:`install`
+command. The regexp form can be expressed more clearly using the ``GLOB``
+form of the :command:`file` command.
::
@@ -32,8 +32,8 @@ expression will be installed.
install_files(<dir> FILES file file ...)
-Any files listed after the FILES keyword will be installed explicitly
+Any files listed after the ``FILES`` keyword will be installed explicitly
from the names given. Full paths are allowed in this form.
-The directory <dir> is relative to the installation prefix, which is
-stored in the variable CMAKE_INSTALL_PREFIX.
+The directory ``<dir>`` is relative to the installation prefix, which is
+stored in the variable :variable:`CMAKE_INSTALL_PREFIX`.
diff --git a/Help/command/install_programs.rst b/Help/command/install_programs.rst
index 26789d8..79aa486 100644
--- a/Help/command/install_programs.rst
+++ b/Help/command/install_programs.rst
@@ -1,13 +1,13 @@
install_programs
----------------
-Deprecated. Use the install(PROGRAMS ) command instead.
+Deprecated. Use the :command:`install(PROGRAMS)` command instead.
-This command has been superceded by the install command. It is
-provided for compatibility with older CMake code. The FILES form is
-directly replaced by the PROGRAMS form of the INSTALL command. The
-regexp form can be expressed more clearly using the GLOB form of the
-FILE command.
+This command has been superceded by the :command:`install` command. It is
+provided for compatibility with older CMake code. The ``FILES`` form is
+directly replaced by the ``PROGRAMS`` form of the :command:`install`
+command. The regexp form can be expressed more clearly using the ``GLOB``
+form of the :command:`file` command.
::
@@ -15,7 +15,7 @@ FILE command.
install_programs(<dir> FILES file1 [file2 ...])
Create rules to install the listed programs into the given directory.
-Use the FILES argument to guarantee that the file list version of the
+Use the ``FILES`` argument to guarantee that the file list version of the
command will be used even when there is only one argument.
::
@@ -26,8 +26,9 @@ In the second form any program in the current source directory that
matches the regular expression will be installed.
This command is intended to install programs that are not built by
-cmake, such as shell scripts. See the TARGETS form of the INSTALL
-command to create installation rules for targets built by cmake.
+cmake, such as shell scripts. See the ``TARGETS`` form of the
+:command:`install` command to create installation rules for targets built
+by cmake.
-The directory <dir> is relative to the installation prefix, which is
-stored in the variable CMAKE_INSTALL_PREFIX.
+The directory ``<dir>`` is relative to the installation prefix, which is
+stored in the variable :variable:`CMAKE_INSTALL_PREFIX`.
diff --git a/Help/command/install_targets.rst b/Help/command/install_targets.rst
index caa933f..49ca696 100644
--- a/Help/command/install_targets.rst
+++ b/Help/command/install_targets.rst
@@ -1,9 +1,9 @@
install_targets
---------------
-Deprecated. Use the install(TARGETS ) command instead.
+Deprecated. Use the :command:`install(TARGETS)` command instead.
-This command has been superceded by the install command. It is
+This command has been superceded by the :command:`install` command. It is
provided for compatibility with older CMake code.
::
@@ -11,7 +11,7 @@ provided for compatibility with older CMake code.
install_targets(<dir> [RUNTIME_DIRECTORY dir] target target)
Create rules to install the listed targets into the given directory.
-The directory <dir> is relative to the installation prefix, which is
-stored in the variable CMAKE_INSTALL_PREFIX. If RUNTIME_DIRECTORY is
-specified, then on systems with special runtime files (Windows DLL),
-the files will be copied to that directory.
+The directory ``<dir>`` is relative to the installation prefix, which is
+stored in the variable :variable:`CMAKE_INSTALL_PREFIX`. If
+``RUNTIME_DIRECTORY`` is specified, then on systems with special runtime
+files (Windows DLL), the files will be copied to that directory.
diff --git a/Help/command/link_directories.rst b/Help/command/link_directories.rst
index bdc94cd..5c64bc6 100644
--- a/Help/command/link_directories.rst
+++ b/Help/command/link_directories.rst
@@ -10,10 +10,10 @@ Specify directories in which the linker will look for libraries.
Specify the paths in which the linker should search for libraries.
The command will apply only to targets created after it is called.
Relative paths given to this command are interpreted as relative to
-the current source directory, see CMP0015.
+the current source directory, see :policy:`CMP0015`.
Note that this command is rarely necessary. Library locations
-returned by find_package() and find_library() are absolute paths.
-Pass these absolute library file paths directly to the
-target_link_libraries() command. CMake will ensure the linker finds
+returned by :command:`find_package` and :command:`find_library` are
+absolute paths. Pass these absolute library file paths directly to the
+:command:`target_link_libraries` command. CMake will ensure the linker finds
them.
diff --git a/Help/command/list.rst b/Help/command/list.rst
index aeb1e94..a7a05c7 100644
--- a/Help/command/list.rst
+++ b/Help/command/list.rst
@@ -17,45 +17,45 @@ List operations.
list(REVERSE <list>)
list(SORT <list>)
-LENGTH will return a given list's length.
+``LENGTH`` will return a given list's length.
-GET will return list of elements specified by indices from the list.
+``GET`` will return list of elements specified by indices from the list.
-APPEND will append elements to the list.
+``APPEND`` will append elements to the list.
-FIND will return the index of the element specified in the list or -1
+``FIND`` will return the index of the element specified in the list or -1
if it wasn't found.
-INSERT will insert elements to the list to the specified location.
+``INSERT`` will insert elements to the list to the specified location.
-REMOVE_AT and REMOVE_ITEM will remove items from the list. The
-difference is that REMOVE_ITEM will remove the given items, while
-REMOVE_AT will remove the items at the given indices.
+``REMOVE_AT`` and ``REMOVE_ITEM`` will remove items from the list. The
+difference is that ``REMOVE_ITEM`` will remove the given items, while
+``REMOVE_AT`` will remove the items at the given indices.
-REMOVE_DUPLICATES will remove duplicated items in the list.
+``REMOVE_DUPLICATES`` will remove duplicated items in the list.
-REVERSE reverses the contents of the list in-place.
+``REVERSE`` reverses the contents of the list in-place.
-SORT sorts the list in-place alphabetically.
+``SORT`` sorts the list in-place alphabetically.
-The list subcommands APPEND, INSERT, REMOVE_AT, REMOVE_ITEM,
-REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list
-within the current CMake variable scope. Similar to the SET command,
-the LIST command creates new variable values in the current scope,
-even if the list itself is actually defined in a parent scope. To
-propagate the results of these operations upwards, use SET with
-PARENT_SCOPE, SET with CACHE INTERNAL, or some other means of value
-propagation.
+The list subcommands ``APPEND``, ``INSERT``, ``REMOVE_AT``, ``REMOVE_ITEM``,
+``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new values for
+the list within the current CMake variable scope. Similar to the
+:command:`set` command, the LIST command creates new variable values in the
+current scope, even if the list itself is actually defined in a parent
+scope. To propagate the results of these operations upwards, use
+:command:`set` with ``PARENT_SCOPE``, :command:`set` with
+``CACHE INTERNAL``, or some other means of value propagation.
-NOTES: A list in cmake is a ; separated group of strings. To create a
-list the set command can be used. For example, set(var a b c d e)
-creates a list with a;b;c;d;e, and set(var "a b c d e") creates a
+NOTES: A list in cmake is a ``;`` separated group of strings. To create a
+list the set command can be used. For example, ``set(var a b c d e)``
+creates a list with ``a;b;c;d;e``, and ``set(var "a b c d e")`` creates a
string or a list with one item in it. (Note macro arguments are not
variables, and therefore cannot be used in LIST commands.)
-When specifying index values, if <element index> is 0 or greater, it
+When specifying index values, if ``<element index>`` is 0 or greater, it
is indexed from the beginning of the list, with 0 representing the
-first list element. If <element index> is -1 or lesser, it is indexed
+first list element. If ``<element index>`` is -1 or lesser, it is indexed
from the end of the list, with -1 representing the last list element.
Be careful when counting with negative indices: they do not start from
0. -0 is equivalent to 0, the first list element.
diff --git a/Help/command/load_cache.rst b/Help/command/load_cache.rst
index b7484cb..f113447 100644
--- a/Help/command/load_cache.rst
+++ b/Help/command/load_cache.rst
@@ -19,9 +19,9 @@ does not create entries in the local project's cache.
Load in the values from another cache and store them in the local
project's cache as internal entries. This is useful for a project
-that depends on another project built in a different tree. EXCLUDE
+that depends on another project built in a different tree. ``EXCLUDE``
option can be used to provide a list of entries to be excluded.
-INCLUDE_INTERNALS can be used to provide a list of internal entries to
+``INCLUDE_INTERNALS`` can be used to provide a list of internal entries to
be included. Normally, no internal entries are brought in. Use of
this form of the command is strongly discouraged, but it is provided
for backward compatibility.
diff --git a/Help/command/load_command.rst b/Help/command/load_command.rst
index fc316d4..a1576e8 100644
--- a/Help/command/load_command.rst
+++ b/Help/command/load_command.rst
@@ -11,9 +11,9 @@ Load a command into a running CMake.
The given locations are searched for a library whose name is
cmCOMMAND_NAME. If found, it is loaded as a module and the command is
-added to the set of available CMake commands. Usually, TRY_COMPILE is
-used before this command to compile the module. If the command is
-successfully loaded a variable named
+added to the set of available CMake commands. Usually,
+:command:`try_compile` is used before this command to compile the
+module. If the command is successfully loaded a variable named
::
diff --git a/Help/command/make_directory.rst b/Help/command/make_directory.rst
index 44dbe97..27ecf51 100644
--- a/Help/command/make_directory.rst
+++ b/Help/command/make_directory.rst
@@ -1,7 +1,7 @@
make_directory
--------------
-Deprecated. Use the file(MAKE_DIRECTORY ) command instead.
+Deprecated. Use the :command:`file(MAKE_DIRECTORY)` command instead.
::
diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst
index 30b1289..c3f94fc 100644
--- a/Help/command/mark_as_advanced.rst
+++ b/Help/command/mark_as_advanced.rst
@@ -9,10 +9,10 @@ Mark cmake cached variables as advanced.
Mark the named cached variables as advanced. An advanced variable
will not be displayed in any of the cmake GUIs unless the show
-advanced option is on. If CLEAR is the first argument advanced
-variables are changed back to unadvanced. If FORCE is the first
-argument, then the variable is made advanced. If neither FORCE nor
-CLEAR is specified, new values will be marked as advanced, but if the
+advanced option is on. If ``CLEAR`` is the first argument advanced
+variables are changed back to unadvanced. If ``FORCE`` is the first
+argument, then the variable is made advanced. If neither ``FORCE`` nor
+``CLEAR`` is specified, new values will be marked as advanced, but if the
variable already has an advanced/non-advanced state, it will not be
changed.
diff --git a/Help/command/math.rst b/Help/command/math.rst
index 38fde1d..d4deb16 100644
--- a/Help/command/math.rst
+++ b/Help/command/math.rst
@@ -7,7 +7,7 @@ Mathematical expressions.
math(EXPR <output variable> <math expression>)
-EXPR evaluates mathematical expression and returns result in the
+``EXPR`` evaluates mathematical expression and returns result in the
output variable. Example mathematical expression is '5 * ( 10 + 13
)'. Supported operators are + - * / % | & ^ ~ << >> * / %. They have
the same meaning as they do in C code.
diff --git a/Help/command/message.rst b/Help/command/message.rst
index a20325a..04c62fd 100644
--- a/Help/command/message.rst
+++ b/Help/command/message.rst
@@ -7,7 +7,7 @@ Display a message to the user.
message([<mode>] "message to display" ...)
-The optional <mode> keyword determines the type of message:
+The optional ``<mode>`` keyword determines the type of message:
::
diff --git a/Help/command/option.rst b/Help/command/option.rst
index 244ed07..91cd0a7 100644
--- a/Help/command/option.rst
+++ b/Help/command/option.rst
@@ -8,8 +8,8 @@ Provides an option that the user can optionally select.
option(<option_variable> "help string describing option"
[initial value])
-Provide an option for the user to select as ON or OFF. If no initial
-value is provided, OFF is used.
+Provide an option for the user to select as ``ON`` or ``OFF``. If no
+initial value is provided, ``OFF`` is used.
If you have options that depend on the values of other options, see
-the module help for CMakeDependentOption.
+the module help for :module:`CMakeDependentOption`.
diff --git a/Help/command/qt_wrap_cpp.rst b/Help/command/qt_wrap_cpp.rst
index 81bbc06..3843bf5 100644
--- a/Help/command/qt_wrap_cpp.rst
+++ b/Help/command/qt_wrap_cpp.rst
@@ -9,4 +9,4 @@ Create Qt Wrappers.
SourceLists ...)
Produce moc files for all the .h files listed in the SourceLists. The
-moc files will be added to the library using the DestName source list.
+moc files will be added to the library using the ``DestName`` source list.
diff --git a/Help/command/qt_wrap_ui.rst b/Help/command/qt_wrap_ui.rst
index 4e033a8..f731ed9 100644
--- a/Help/command/qt_wrap_ui.rst
+++ b/Help/command/qt_wrap_ui.rst
@@ -9,6 +9,6 @@ Create Qt user interfaces Wrappers.
SourcesDestName SourceLists ...)
Produce .h and .cxx files for all the .ui files listed in the
-SourceLists. The .h files will be added to the library using the
-HeadersDestNamesource list. The .cxx files will be added to the
-library using the SourcesDestNamesource list.
+``SourceLists``. The .h files will be added to the library using the
+``HeadersDestNamesource`` list. The .cxx files will be added to the
+library using the ``SourcesDestNamesource`` list.
diff --git a/Help/command/remove.rst b/Help/command/remove.rst
index ddf0e9a..4628277 100644
--- a/Help/command/remove.rst
+++ b/Help/command/remove.rst
@@ -1,12 +1,12 @@
remove
------
-Deprecated. Use the list(REMOVE_ITEM ) command instead.
+Deprecated. Use the :command:`list(REMOVE_ITEM)` command instead.
::
remove(VAR VALUE VALUE ...)
-Removes VALUE from the variable VAR. This is typically used to remove
-entries from a vector (e.g. semicolon separated list). VALUE is
-expanded.
+Removes ``VALUE`` from the variable ``VAR``. This is typically used to
+remove entries from a vector (e.g. semicolon separated list). ``VALUE``
+is expanded.
diff --git a/Help/command/remove_definitions.rst b/Help/command/remove_definitions.rst
index 566da6e..ea18918 100644
--- a/Help/command/remove_definitions.rst
+++ b/Help/command/remove_definitions.rst
@@ -1,11 +1,11 @@
remove_definitions
------------------
-Removes -D define flags added by add_definitions.
+Removes -D define flags added by :command:`add_definitions`.
::
remove_definitions(-DFOO -DBAR ...)
-Removes flags (added by add_definitions) from the compiler command
-line for sources in the current directory and below.
+Removes flags (added by :command:`add_definitions`) from the compiler
+command line for sources in the current directory and below.
diff --git a/Help/command/return.rst b/Help/command/return.rst
index 899470c..e49fb3c 100644
--- a/Help/command/return.rst
+++ b/Help/command/return.rst
@@ -8,11 +8,11 @@ Return from a file, directory or function.
return()
Returns from a file, directory or function. When this command is
-encountered in an included file (via include() or find_package()), it
-causes processing of the current file to stop and control is returned
-to the including file. If it is encountered in a file which is not
-included by another file, e.g. a CMakeLists.txt, control is returned
-to the parent directory if there is one. If return is called in a
-function, control is returned to the caller of the function. Note
-that a macro is not a function and does not handle return like a
+encountered in an included file (via :command:`include` or
+:command:`find_package`), it causes processing of the current file to stop
+and control is returned to the including file. If it is encountered in a
+file which is not included by another file, e.g. a ``CMakeLists.txt``,
+control is returned to the parent directory if there is one. If return is
+called in a function, control is returned to the caller of the function.
+Note that a macro is not a function and does not handle return like a
function does.
diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst
index a876595..0e3e5a5 100644
--- a/Help/command/separate_arguments.rst
+++ b/Help/command/separate_arguments.rst
@@ -8,15 +8,15 @@ Parse space-separated arguments into a semicolon-separated list.
separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>")
Parses a unix- or windows-style command-line string "<args>" and
-stores a semicolon-separated list of the arguments in <var>. The
+stores a semicolon-separated list of the arguments in ``<var>``. The
entire command line must be given in one "<args>" argument.
-The UNIX_COMMAND mode separates arguments by unquoted whitespace. It
+The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It
recognizes both single-quote and double-quote pairs. A backslash
escapes the next literal character (\" is "); there are no special
escapes (\n is just n).
-The WINDOWS_COMMAND mode parses a windows command-line using the same
+The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same
syntax the runtime library uses to construct argv at startup. It
separates arguments by whitespace that is not double-quoted.
Backslashes are literal unless they precede double-quotes. See the
@@ -26,6 +26,6 @@ MSDN article "Parsing C Command-Line Arguments" for details.
separate_arguments(VARIABLE)
-Convert the value of VARIABLE to a semi-colon separated list. All
+Convert the value of ``VARIABLE`` to a semi-colon separated list. All
spaces are replaced with ';'. This helps with generating command
lines.
diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst
index f65ee24..2accfb0 100644
--- a/Help/command/set_target_properties.rst
+++ b/Help/command/set_target_properties.rst
@@ -12,93 +12,98 @@ Targets can have properties that affect how they are built.
Set properties on a target. The syntax for the command is to list all
the files you want to change, and then provide the values you want to
set next. You can use any prop value pair you want and extract it
-later with the GET_TARGET_PROPERTY command.
+later with the :command:`get_target_property` command.
Properties that affect the name of a target's output file are as
-follows. The PREFIX and SUFFIX properties override the default target
-name prefix (such as "lib") and suffix (such as ".so"). IMPORT_PREFIX
-and IMPORT_SUFFIX are the equivalent properties for the import library
-corresponding to a DLL (for SHARED library targets). OUTPUT_NAME sets
-the real name of a target when it is built and can be used to help
-create two targets of the same name even though CMake requires unique
-logical target names. There is also a <CONFIG>_OUTPUT_NAME that can
-set the output name on a per-configuration basis. <CONFIG>_POSTFIX
-sets a postfix for the real name of the target when it is built under
-the configuration named by <CONFIG> (in upper-case, such as
-"DEBUG_POSTFIX"). The value of this property is initialized when the
-target is created to the value of the variable CMAKE_<CONFIG>_POSTFIX
+follows. The :prop_tgt:`PREFIX` and :prop_tgt:`SUFFIX` properties
+override the default target name prefix (such as "lib") and suffix
+(such as ".so"). :prop_tgt:`IMPORT_PREFIX` and
+:prop_tgt:`IMPORT_SUFFIX` are the equivalent properties for the import
+library corresponding to a DLL (for SHARED library targets).
+:prop_tgt:`OUTPUT_NAME` sets the real name of a target when it is built
+and can be used to help create two targets of the same name even though
+CMake requires unique logical target names. There is also a
+:prop_tgt:`<CONFIG>_OUTPUT_NAME` that can set the output name on a
+per-configuration basis. :prop_tgt:`<CONFIG>_POSTFIX` sets a postfix for
+the real name of the target when it is built under the configuration named
+by ``<CONFIG>`` (in upper-case, such as "DEBUG_POSTFIX"). The value of this
+property is initialized when the target is created to the value of the
+variable :variable:`CMAKE_<CONFIG>_POSTFIX`
(except for executable targets because earlier CMake versions which
did not use this variable for executables).
-The LINK_FLAGS property can be used to add extra flags to the link
-step of a target. LINK_FLAGS_<CONFIG> will add to the configuration
-<CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO.
-DEFINE_SYMBOL sets the name of the preprocessor symbol defined when
-compiling sources in a shared library. If not set here then it is set
-to target_EXPORTS by default (with some substitutions if the target is
-not a valid C identifier). This is useful for headers to know whether
-they are being included from inside their library or outside to
-properly setup dllexport/dllimport decorations. The COMPILE_FLAGS
-property sets additional compiler flags used to build sources within
-the target. It may also be used to pass additional preprocessor
-definitions.
+The :prop_tgt:`LINK_FLAGS` property can be used to add extra flags to the
+link step of a target. :prop_tgt:`LINK_FLAGS_<CONFIG>` will add to the
+configuration ``<CONFIG>``, for example, ``DEBUG``, ``RELEASE``,
+``MINSIZEREL``,``RELWITHDEBINFO``. :prop_tgt:`DEFINE_SYMBOL` sets the name
+of the preprocessor symbol defined when compiling sources in a shared
+library. If not set here then it is set to target_EXPORTS by default
+(with some substitutions if the target is not a valid C identifier). This
+is useful for headers to know whether they are being included from inside
+their library or outside to properly setup dllexport/dllimport
+decorations. The :prop_tgt:`COMPILE_FLAGS` property sets additional
+compiler flags used to build sources within the target. It may also be
+used to pass additional preprocessor definitions.
-The LINKER_LANGUAGE property is used to change the tool used to link
-an executable or shared library. The default is set the language to
-match the files in the library. CXX and C are common values for this
+The :prop_tgt:`LINKER_LANGUAGE` property is used to change the tool used
+to link an executable or shared library. The default is set the language to
+match the files in the library. ``CXX`` and ``C`` are common values for this
property.
-For shared libraries VERSION and SOVERSION can be used to specify the
-build version and API version respectively. When building or
-installing appropriate symlinks are created if the platform supports
-symlinks and the linker supports so-names. If only one of both is
+For shared libraries :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` can be
+used to specify the build version and API version respectively. When
+building or installing appropriate symlinks are created if the platform
+supports symlinks and the linker supports so-names. If only one of both is
specified the missing is assumed to have the same version number. For
-executables VERSION can be used to specify the build version. When
-building or installing appropriate symlinks are created if the
-platform supports symlinks. For shared libraries and executables on
-Windows the VERSION attribute is parsed to extract a "major.minor"
-version number. These numbers are used as the image version of the
-binary.
+executables :prop_tgt:`VERSION` can be used to specify the build
+version. When building or installing appropriate symlinks are created if
+the platform supports symlinks. For shared libraries and executables on
+Windows the :prop_tgt:`VERSION` attribute is parsed to extract a
+"major.minor" version number. These numbers are used as the image
+version of the binary.
-There are a few properties used to specify RPATH rules. INSTALL_RPATH
-is a semicolon-separated list specifying the rpath to use in installed
-targets (for platforms that support it). INSTALL_RPATH_USE_LINK_PATH
-is a boolean that if set to true will append directories in the linker
-search path and outside the project to the INSTALL_RPATH.
-SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic
-generation of an rpath allowing the target to run from the build tree.
-BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link the
-target in the build tree with the INSTALL_RPATH. This takes
-precedence over SKIP_BUILD_RPATH and avoids the need for relinking
-before installation. INSTALL_NAME_DIR is a string specifying the
+There are a few properties used to specify RPATH rules.
+:prop_tgt:`INSTALL_RPATH` is a semicolon-separated list specifying the
+rpath to use in installed targets (for platforms that support it).
+:prop_tgt:`INSTALL_RPATH_USE_LINK_PATH` is a boolean that if set to true
+will append directories in the linker search path and outside the project
+to the :prop_tgt:`INSTALL_RPATH`. :prop_tgt:`SKIP_BUILD_RPATH` is a boolean
+specifying whether to skip automatic generation of an rpath allowing the
+target to run from the build tree. :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is
+a boolean specifying whether to link the target in the build tree with the
+:prop_tgt:`INSTALL_RPATH`. This takes precedence over
+:prop_tgt:`SKIP_BUILD_RPATH` and avoids the need for relinking before
+installation. :prop_tgt:`INSTALL_NAME_DIR` is a string specifying the
directory portion of the "install_name" field of shared libraries on
Mac OSX to use in the installed targets. When the target is created
-the values of the variables CMAKE_INSTALL_RPATH,
-CMAKE_INSTALL_RPATH_USE_LINK_PATH, CMAKE_SKIP_BUILD_RPATH,
-CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR are used to
-initialize these properties.
+the values of the variables :variable:`CMAKE_INSTALL_RPATH`,
+:variable:`CMAKE_INSTALL_RPATH_USE_LINK_PATH`,
+:variable:`CMAKE_SKIP_BUILD_RPATH`,
+:variable:`CMAKE_BUILD_WITH_INSTALL_RPATH`, and
+:variable:`CMAKE_INSTALL_NAME_DIR` are used to initialize these properties.
-PROJECT_LABEL can be used to change the name of the target in an IDE
-like visual studio. VS_KEYWORD can be set to change the visual studio
-keyword, for example Qt integration works better if this is set to
-Qt4VSv1.0.
+:prop_tgt:`PROJECT_LABEL` can be used to change the name of the target in
+an IDE like visual studio. :prop_tgt:`VS_KEYWORD` can be set to change
+the visual studio keyword, for example Qt integration works better if this
+is set to ``Qt4VSv1.0``.
-VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and
-VS_SCC_AUXPATH can be set to add support for source control bindings
-in a Visual Studio project file.
+:prop_tgt:`VS_SCC_PROJECTNAME`, :prop_tgt:`VS_SCC_LOCALPATH`,
+:prop_tgt:`VS_SCC_PROVIDER` and :prop_tgt:`VS_SCC_AUXPATH` can be set to
+add support for source control bindings in a Visual Studio project file.
-VS_GLOBAL_<variable> can be set to add a Visual Studio
+:prop_tgt:`VS_GLOBAL_<variable>` can be set to add a Visual Studio
project-specific global variable. Qt integration works better if
-VS_GLOBAL_QtVersion is set to the Qt version FindQt4.cmake found. For
-example, "4.7.3"
+``VS_GLOBAL_QtVersion`` is set to the Qt version :module:`FindQt4`
+found. For example, "4.7.3"
-The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the old
-way to specify CMake scripts to run before and after installing a
-target. They are used only when the old INSTALL_TARGETS command is
-used to install the target. Use the INSTALL command instead.
+The :prop_tgt:`PRE_INSTALL_SCRIPT` and :prop_tgt:`POST_INSTALL_SCRIPT`
+properties are the old way to specify CMake scripts to run before and
+after installing a target. They are used only when the old
+:command:`install_targets` command is used to install the target. Use the
+:command:`install` command instead.
-The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual studio
-generators. If it is set to 1 the target will not be part of the
+The :prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD` property is used by the visual
+studio generators. If it is set to 1 the target will not be part of the
default build when you select "Build Solution". This can also be set
on a per-configuration basis using
-EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>.
+:prop_tgt:`EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>`.
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 351385b..bc4399c 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -15,6 +15,7 @@ String operations.
string(REPLACE <match_string>
<replace_string> <output variable>
<input> [<input>...])
+ string(APPEND <string variable> [<input>...])
string(CONCAT <output variable> [<input>...])
string(<MD5|SHA1|SHA224|SHA256|SHA384|SHA512>
<output variable> <input>)
@@ -39,41 +40,43 @@ String operations.
string(UUID <output variable> NAMESPACE <namespace> NAME <name>
TYPE <MD5|SHA1> [UPPER])
-REGEX MATCH will match the regular expression once and store the match
+``REGEX MATCH`` will match the regular expression once and store the match
in the output variable.
-REGEX MATCHALL will match the regular expression as many times as
+``REGEX MATCHALL`` will match the regular expression as many times as
possible and store the matches in the output variable as a list.
-REGEX REPLACE will match the regular expression as many times as
+``REGEX REPLACE`` will match the regular expression as many times as
possible and substitute the replacement expression for the match in
the output. The replace expression may refer to paren-delimited
subexpressions of the match using \1, \2, ..., \9. Note that two
backslashes (\\1) are required in CMake code to get a backslash
through argument parsing.
-REPLACE will replace all occurrences of match_string in the input with
-replace_string and store the result in the output.
+``REPLACE`` will replace all occurrences of ``match_string`` in the input
+with ``replace_string`` and store the result in the output.
-CONCAT will concatenate all the input arguments together and store
+``APPEND`` will append all the input arguments to the string.
+
+``CONCAT`` will concatenate all the input arguments together and store
the result in the named output variable.
-MD5, SHA1, SHA224, SHA256, SHA384, and SHA512 will compute a
-cryptographic hash of the input string.
+``MD5``, ``SHA1``, ``SHA224``, ``SHA256``, ``SHA384``, and ``SHA512`` will
+compute a cryptographic hash of the input string.
-COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and store
-true or false in the output variable.
+``COMPARE EQUAL``/``COMPARE NOTEQUAL``/``COMPARE LESS/GREATER`` will
+compare the strings and store true or false in the output variable.
-ASCII will convert all numbers into corresponding ASCII characters.
+``ASCII`` will convert all numbers into corresponding ASCII characters.
-CONFIGURE will transform a string like CONFIGURE_FILE transforms a
-file.
+``CONFIGURE`` will transform a string like :command:`configure_file`
+transforms a file.
-TOUPPER/TOLOWER will convert string to upper/lower characters.
+``TOUPPER``/``TOLOWER`` will convert string to upper/lower characters.
-LENGTH will return a given string's length.
+``LENGTH`` will return a given string's length.
-SUBSTRING will return a substring of a given string. If length is -1
+``SUBSTRING`` will return a substring of a given string. If length is -1
the remainder of the string starting at begin will be returned.
If string is shorter than length then end of string is used instead.
@@ -81,17 +84,17 @@ If string is shorter than length then end of string is used instead.
CMake 3.1 and below reported an error if length pointed past
the end of string.
-STRIP will return a substring of a given string with leading and
+``STRIP`` will return a substring of a given string with leading and
trailing spaces removed.
-RANDOM will return a random string of given length consisting of
+``RANDOM`` will return a random string of given length consisting of
characters from the given alphabet. Default length is 5 characters
and default alphabet is all numbers and upper and lower case letters.
-If an integer RANDOM_SEED is given, its value will be used to seed the
+If an integer ``RANDOM_SEED`` is given, its value will be used to seed the
random number generator.
-FIND will return the position where the given substring was found in
-the supplied string. If the REVERSE flag was used, the command will
+``FIND`` will return the position where the given substring was found in
+the supplied string. If the ``REVERSE`` flag was used, the command will
search for the position of the last occurrence of the specified
substring.
@@ -118,21 +121,21 @@ The following characters have special meaning in regular expressions:
by all regular expression-related commands, including
e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9).
-``*``, ``+`` and ``?`` have higher precedence than concatenation. | has lower
-precedence than concatenation. This means that the regular expression
-"^ab+d$" matches "abbd" but not "ababd", and the regular expression
-"^(ab|cd)$" matches "ab" but not "abd".
+``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|``
+has lower precedence than concatenation. This means that the regular
+expression "^ab+d$" matches "abbd" but not "ababd", and the regular
+expression "^(ab|cd)$" matches "ab" but not "abd".
-TIMESTAMP will write a string representation of the current date
+``TIMESTAMP`` will write a string representation of the current date
and/or time to the output variable.
Should the command be unable to obtain a timestamp the output variable
will be set to the empty string "".
-The optional UTC flag requests the current date/time representation to
+The optional ``UTC`` flag requests the current date/time representation to
be in Coordinated Universal Time (UTC) rather than local time.
-The optional <format string> may contain the following format
+The optional ``<format string>`` may contain the following format
specifiers:
::
@@ -153,23 +156,23 @@ specifiers:
Unknown format specifiers will be ignored and copied to the output
as-is.
-If no explicit <format string> is given it will default to:
+If no explicit ``<format string>`` is given it will default to:
::
%Y-%m-%dT%H:%M:%S for local time.
%Y-%m-%dT%H:%M:%SZ for UTC.
-MAKE_C_IDENTIFIER will write a string which can be used as an
+``MAKE_C_IDENTIFIER`` will write a string which can be used as an
identifier in C.
``GENEX_STRIP`` will strip any
:manual:`generator expressions <cmake-generator-expressions(7)>` from the
``input string`` and store the result in the ``output variable``.
-UUID creates a univerally unique identifier (aka GUID) as per RFC4122
-based on the hash of the combined values of <namespace>
-(which itself has to be a valid UUID) and <name>.
+``UUID`` creates a univerally unique identifier (aka GUID) as per RFC4122
+based on the hash of the combined values of ``<namespace>``
+(which itself has to be a valid UUID) and ``<name>``.
The hash algorithm can be either ``MD5`` (Version 3 UUID) or
``SHA1`` (Version 5 UUID).
A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``
diff --git a/Help/command/subdirs.rst b/Help/command/subdirs.rst
index dee49f8..43b87d4 100644
--- a/Help/command/subdirs.rst
+++ b/Help/command/subdirs.rst
@@ -1,7 +1,7 @@
subdirs
-------
-Deprecated. Use the add_subdirectory() command instead.
+Deprecated. Use the :command:`add_subdirectory` command instead.
Add a list of subdirectories to the build.
@@ -10,12 +10,12 @@ Add a list of subdirectories to the build.
subdirs(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1 exclude_dir2 ...]
[PREORDER] )
-Add a list of subdirectories to the build. The add_subdirectory
-command should be used instead of subdirs although subdirs will still
+Add a list of subdirectories to the build. The :command:`add_subdirectory`
+command should be used instead of ``subdirs`` although ``subdirs`` will still
work. This will cause any CMakeLists.txt files in the sub directories
-to be processed by CMake. Any directories after the PREORDER flag are
-traversed first by makefile builds, the PREORDER flag has no effect on
-IDE projects. Any directories after the EXCLUDE_FROM_ALL marker will
+to be processed by CMake. Any directories after the ``PREORDER`` flag are
+traversed first by makefile builds, the ``PREORDER`` flag has no effect on
+IDE projects. Any directories after the ``EXCLUDE_FROM_ALL`` marker will
not be included in the top level makefile or project file. This is
useful for having CMake create makefiles or projects for a set of
examples in a project. You would want CMake to generate makefiles or
diff --git a/Help/command/unset.rst b/Help/command/unset.rst
index d8f0dcd..a1fc95c 100644
--- a/Help/command/unset.rst
+++ b/Help/command/unset.rst
@@ -8,14 +8,14 @@ Unset a variable, cache variable, or environment variable.
unset(<variable> [CACHE | PARENT_SCOPE])
Removes the specified variable causing it to become undefined. If
-CACHE is present then the variable is removed from the cache instead
+``CACHE`` is present then the variable is removed from the cache instead
of the current scope.
-If PARENT_SCOPE is present then the variable is removed from the scope
-above the current scope. See the same option in the set() command for
-further details.
+If ``PARENT_SCOPE`` is present then the variable is removed from the scope
+above the current scope. See the same option in the :command:`set` command
+for further details.
-<variable> can be an environment variable such as:
+``<variable>`` can be an environment variable such as:
::
diff --git a/Help/command/utility_source.rst b/Help/command/utility_source.rst
index 5122e52..ee34492 100644
--- a/Help/command/utility_source.rst
+++ b/Help/command/utility_source.rst
@@ -12,11 +12,11 @@ Specify the source tree of a third-party utility.
When a third-party utility's source is included in the distribution,
this command specifies its location and name. The cache entry will
-not be set unless the path_to_source and all listed files exist. It
+not be set unless the ``path_to_source`` and all listed files exist. It
is assumed that the source tree of the utility will have been built
before it is needed.
-When cross compiling CMake will print a warning if a utility_source()
+When cross compiling CMake will print a warning if a ``utility_source()``
command is executed, because in many cases it is used to build an
executable which is executed later on. This doesn't work when cross
compiling, since the executable can run only on their target platform.
diff --git a/Help/command/variable_requires.rst b/Help/command/variable_requires.rst
index 831dd00..9cf9f3f 100644
--- a/Help/command/variable_requires.rst
+++ b/Help/command/variable_requires.rst
@@ -3,7 +3,7 @@ variable_requires
Disallowed. See CMake Policy :policy:`CMP0035`.
-Use the if() command instead.
+Use the :command:`if` command instead.
Assert satisfaction of an option's required variables.
@@ -13,10 +13,10 @@ Assert satisfaction of an option's required variables.
REQUIRED_VARIABLE1
REQUIRED_VARIABLE2 ...)
-The first argument (TEST_VARIABLE) is the name of the variable to be
+The first argument (``TEST_VARIABLE``) is the name of the variable to be
tested, if that variable is false nothing else is done. If
-TEST_VARIABLE is true, then the next argument (RESULT_VARIABLE) is a
-variable that is set to true if all the required variables are set.
+``TEST_VARIABLE`` is true, then the next argument (``RESULT_VARIABLE``)
+is a variable that is set to true if all the required variables are set.
The rest of the arguments are variables that must be true or not set
to NOTFOUND to avoid an error. If any are not true, an error is
reported.
diff --git a/Help/command/while.rst b/Help/command/while.rst
index 72c055d..7509da3 100644
--- a/Help/command/while.rst
+++ b/Help/command/while.rst
@@ -11,7 +11,7 @@ Evaluate a group of commands while a condition is true
...
endwhile(condition)
-All commands between while and the matching endwhile are recorded
-without being invoked. Once the endwhile is evaluated, the recorded
-list of commands is invoked as long as the condition is true. The
-condition is evaluated using the same logic as the if command.
+All commands between while and the matching :command:`endwhile` are recorded
+without being invoked. Once the :command:`endwhile` is evaluated, the
+recorded list of commands is invoked as long as the condition is true. The
+condition is evaluated using the same logic as the :command:`if` command.
diff --git a/Help/command/write_file.rst b/Help/command/write_file.rst
index 015514b..40e7557 100644
--- a/Help/command/write_file.rst
+++ b/Help/command/write_file.rst
@@ -1,20 +1,20 @@
write_file
----------
-Deprecated. Use the file(WRITE ) command instead.
+Deprecated. Use the :command:`file(WRITE)` command instead.
::
write_file(filename "message to write"... [APPEND])
The first argument is the file name, the rest of the arguments are
-messages to write. If the argument APPEND is specified, then the
+messages to write. If the argument ``APPEND`` is specified, then the
message will be appended.
-NOTE 1: file(WRITE ... and file(APPEND ... do exactly the same as
-this one but add some more functionality.
+NOTE 1: :command:`file(WRITE)` and :command:`file(APPEND)` do exactly
+the same as this one but add some more functionality.
-NOTE 2: When using write_file the produced file cannot be used as an
+NOTE 2: When using ``write_file`` the produced file cannot be used as an
input to CMake (CONFIGURE_FILE, source file ...) because it will lead
-to an infinite loop. Use configure_file if you want to generate input
-files to CMake.
+to an infinite loop. Use :command:`configure_file` if you want to
+generate input files to CMake.
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index c456590..aefdb71 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -632,7 +632,7 @@ may be enabled, with an equivalent effect to:
.. code-block:: cmake
- set_property(TARGET tgt APPEND PROPERTY
+ set_property(TARGET tgt APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>
)
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index ab74140..90a081d 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -867,7 +867,6 @@ look.
find_path(Foo_INCLUDE_DIR
NAMES foo.h
PATHS ${PC_Foo_INCLUDE_DIRS}
- # if you need to put #include <Foo/foo.h> in your code, add:
PATH_SUFFIXES Foo
)
find_library(Foo_LIBRARY
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index c5970bb..0a313cd 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -20,11 +20,11 @@ for a policy, also avoiding the warning. Each policy can also be set to
either ``NEW`` or ``OLD`` behavior explicitly on the command line with the
:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable.
-Note that policies are not reliable feature toggles. A policy should
-almost never be set to ``OLD``, except to silence warnings in an otherwise
-frozen or stable codebase, or temporarily as part of a larger migration
-path. The ``OLD`` behavior of each policy is undesirable and will be
-replaced with an error condition in a future release.
+A policy is a deprecation mechanism and not a reliable feature toggle.
+A policy should almost never be set to ``OLD``, except to silence warnings
+in an otherwise frozen or stable codebase, or temporarily as part of a
+larger migration path. The ``OLD`` behavior of each policy is undesirable
+and will be replaced with an error condition in a future release.
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
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 615254e..b767ed6 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -177,6 +177,7 @@ Properties on Targets
/prop_tgt/JOB_POOL_COMPILE
/prop_tgt/JOB_POOL_LINK
/prop_tgt/LABELS
+ /prop_tgt/LANG_COMPILER_LAUNCHER
/prop_tgt/LANG_INCLUDE_WHAT_YOU_USE
/prop_tgt/LANG_VISIBILITY_PRESET
/prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG
@@ -250,6 +251,7 @@ Properties on Targets
/prop_tgt/VS_WINRT_EXTENSIONS
/prop_tgt/VS_WINRT_REFERENCES
/prop_tgt/WIN32_EXECUTABLE
+ /prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
/prop_tgt/XCTEST
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index bd02f8b..f54436a 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -117,6 +117,8 @@ Variables that Change Behavior
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
/variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY
/variable/CMAKE_SYSROOT
+ /variable/CMAKE_FIND_APPBUNDLE
+ /variable/CMAKE_FIND_FRAMEWORK
/variable/CMAKE_FIND_LIBRARY_PREFIXES
/variable/CMAKE_FIND_LIBRARY_SUFFIXES
/variable/CMAKE_FIND_NO_INSTALL_PREFIX
@@ -147,6 +149,8 @@ Variables that Change Behavior
/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX
+ /variable/CMAKE_SYSTEM_APPBUNDLE_PATH
+ /variable/CMAKE_SYSTEM_FRAMEWORK_PATH
/variable/CMAKE_SYSTEM_IGNORE_PATH
/variable/CMAKE_SYSTEM_INCLUDE_PATH
/variable/CMAKE_SYSTEM_LIBRARY_PATH
@@ -235,6 +239,7 @@ Variables that Control the Build
/variable/CMAKE_INSTALL_NAME_DIR
/variable/CMAKE_INSTALL_RPATH
/variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH
+ /variable/CMAKE_LANG_COMPILER_LAUNCHER
/variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE
/variable/CMAKE_LANG_VISIBILITY_PRESET
/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY
@@ -270,6 +275,7 @@ Variables that Control the Build
/variable/CMAKE_USE_RELATIVE_PATHS
/variable/CMAKE_VISIBILITY_INLINES_HIDDEN
/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD
+ /variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
/variable/CMAKE_WIN32_EXECUTABLE
/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute
/variable/EXECUTABLE_OUTPUT_PATH
@@ -381,6 +387,7 @@ Variables for CTest
/variable/CTEST_SVN_COMMAND
/variable/CTEST_SVN_OPTIONS
/variable/CTEST_SVN_UPDATE_OPTIONS
+ /variable/CTEST_TEST_LOAD
/variable/CTEST_TEST_TIMEOUT
/variable/CTEST_TRIGGER_SITE
/variable/CTEST_UPDATE_COMMAND
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index c91321b..50c856a 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -66,6 +66,13 @@ Options
number of jobs. This option can also be set by setting the
environment variable ``CTEST_PARALLEL_LEVEL``.
+``--test-load <level>``
+ While running tests in parallel (e.g. with ``-j``), try not to start
+ tests when they may cause the CPU load to pass above a given threshold.
+
+ When ``ctest`` is run as a `Dashboard Client`_ this sets the
+ ``TestLoad`` option of the `CTest Test Step`_.
+
``-Q,--quiet``
Make ctest quiet.
@@ -776,6 +783,13 @@ Arguments to the command may specify some of the step settings.
Configuration settings include:
+``TestLoad``
+ While running tests in parallel (e.g. with ``-j``), try not to start
+ tests when they may cause the CPU load to pass above a given threshold.
+
+ * `CTest Script`_ variable: :variable:`CTEST_TEST_LOAD`
+ * :module:`CTest` module variable: ``CTEST_TEST_LOAD``
+
``TimeOut``
The default timeout for each test if not specified by the
:prop_test:`TIMEOUT` test property.
diff --git a/Help/policy/CMP0000.rst b/Help/policy/CMP0000.rst
index 9fbf842..97ea633 100644
--- a/Help/policy/CMP0000.rst
+++ b/Help/policy/CMP0000.rst
@@ -28,3 +28,5 @@ a warning. An included file may set CMP0000 explicitly to affect how
this policy is enforced for the main CMakeLists.txt file.
This policy was introduced in CMake version 2.6.0.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0001.rst b/Help/policy/CMP0001.rst
index 344f1e2..09ad387 100644
--- a/Help/policy/CMP0001.rst
+++ b/Help/policy/CMP0001.rst
@@ -17,3 +17,5 @@ below.
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0002.rst b/Help/policy/CMP0002.rst
index 2c15bd4..7cc53ef 100644
--- a/Help/policy/CMP0002.rst
+++ b/Help/policy/CMP0002.rst
@@ -24,3 +24,5 @@ property ALLOW_DUPLICATE_CUSTOM_TARGETS with a Makefiles generator).
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0003.rst b/Help/policy/CMP0003.rst
index 27b83f8..16b0451 100644
--- a/Help/policy/CMP0003.rst
+++ b/Help/policy/CMP0003.rst
@@ -100,3 +100,5 @@ when setting the policy once will probably fix all targets.
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0004.rst b/Help/policy/CMP0004.rst
index 80045f5..55da4d2 100644
--- a/Help/policy/CMP0004.rst
+++ b/Help/policy/CMP0004.rst
@@ -21,3 +21,5 @@ target is created by an add_executable or add_library command.
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0005.rst b/Help/policy/CMP0005.rst
index c11a9e6..66d125f 100644
--- a/Help/policy/CMP0005.rst
+++ b/Help/policy/CMP0005.rst
@@ -22,3 +22,5 @@ limitations of the escaping implementation.
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0006.rst b/Help/policy/CMP0006.rst
index 8d1e5bd..d1b9ece 100644
--- a/Help/policy/CMP0006.rst
+++ b/Help/policy/CMP0006.rst
@@ -20,3 +20,5 @@ without a BUNDLE DESTINATION.
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0007.rst b/Help/policy/CMP0007.rst
index f0d8c16..3927645 100644
--- a/Help/policy/CMP0007.rst
+++ b/Help/policy/CMP0007.rst
@@ -13,3 +13,5 @@ empty elements in a list.
This policy was introduced in CMake version 2.6.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst
index b118ece..f1e2ddd 100644
--- a/Help/policy/CMP0008.rst
+++ b/Help/policy/CMP0008.rst
@@ -30,3 +30,5 @@ pass it directly to the native build tool unchanged.
This policy was introduced in CMake version 2.6.1. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0009.rst b/Help/policy/CMP0009.rst
index 481af1a..44baeb4 100644
--- a/Help/policy/CMP0009.rst
+++ b/Help/policy/CMP0009.rst
@@ -17,3 +17,5 @@ as an additional argument to the FILE command.
This policy was introduced in CMake version 2.6.2. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0010.rst b/Help/policy/CMP0010.rst
index 9d2eb76..344d704 100644
--- a/Help/policy/CMP0010.rst
+++ b/Help/policy/CMP0010.rst
@@ -16,3 +16,5 @@ and is treated as always being ``NEW``.
This policy was introduced in CMake version 2.6.3. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0011.rst b/Help/policy/CMP0011.rst
index 0f41fff..d281e0e 100644
--- a/Help/policy/CMP0011.rst
+++ b/Help/policy/CMP0011.rst
@@ -20,3 +20,5 @@ cmake_policy PUSH and POP.
This policy was introduced in CMake version 2.6.3. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0012.rst b/Help/policy/CMP0012.rst
index 7a749bf..85d64f4 100644
--- a/Help/policy/CMP0012.rst
+++ b/Help/policy/CMP0012.rst
@@ -23,3 +23,5 @@ dereferencing variables with such names.
This policy was introduced in CMake version 2.8.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0013.rst b/Help/policy/CMP0013.rst
index e99997b..2fabb89 100644
--- a/Help/policy/CMP0013.rst
+++ b/Help/policy/CMP0013.rst
@@ -17,3 +17,5 @@ with an error.
This policy was introduced in CMake version 2.8.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0014.rst b/Help/policy/CMP0014.rst
index 37178d1..f1f7b77 100644
--- a/Help/policy/CMP0014.rst
+++ b/Help/policy/CMP0014.rst
@@ -13,3 +13,5 @@ behavior for this policy is to report an error.
This policy was introduced in CMake version 2.8.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0015.rst b/Help/policy/CMP0015.rst
index 1b54979..9a48e3d 100644
--- a/Help/policy/CMP0015.rst
+++ b/Help/policy/CMP0015.rst
@@ -15,3 +15,5 @@ paths by appending the relative path to CMAKE_CURRENT_SOURCE_DIR.
This policy was introduced in CMake version 2.8.1. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0016.rst b/Help/policy/CMP0016.rst
index 743b1a9..cc898c8 100644
--- a/Help/policy/CMP0016.rst
+++ b/Help/policy/CMP0016.rst
@@ -11,3 +11,5 @@ in this case.
This policy was introduced in CMake version 2.8.3. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0017.rst b/Help/policy/CMP0017.rst
index f74e6f0..9f0f038 100644
--- a/Help/policy/CMP0017.rst
+++ b/Help/policy/CMP0017.rst
@@ -17,3 +17,5 @@ from the CMake modules directory.
This policy was introduced in CMake version 2.8.4. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0018.rst b/Help/policy/CMP0018.rst
index 0f68267..a3a7a12 100644
--- a/Help/policy/CMP0018.rst
+++ b/Help/policy/CMP0018.rst
@@ -30,3 +30,5 @@ honor the POSITION_INDEPENDENT_CODE target property.
This policy was introduced in CMake version 2.8.9. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0019.rst b/Help/policy/CMP0019.rst
index 2b37fa1..2e3557d 100644
--- a/Help/policy/CMP0019.rst
+++ b/Help/policy/CMP0019.rst
@@ -18,3 +18,5 @@ the values untouched.
This policy was introduced in CMake version 2.8.11. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0020.rst b/Help/policy/CMP0020.rst
index 6767d08..75ca9de 100644
--- a/Help/policy/CMP0020.rst
+++ b/Help/policy/CMP0020.rst
@@ -23,3 +23,5 @@ automatically when they link to QtCore IMPORTED target.
This policy was introduced in CMake version 2.8.11. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0021.rst b/Help/policy/CMP0021.rst
index 3f5bd03..3a792ca 100644
--- a/Help/policy/CMP0021.rst
+++ b/Help/policy/CMP0021.rst
@@ -16,3 +16,5 @@ relative path.
This policy was introduced in CMake version 2.8.12. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst
index 22c7c4f..579d09a 100644
--- a/Help/policy/CMP0022.rst
+++ b/Help/policy/CMP0022.rst
@@ -35,3 +35,5 @@ property for in-build targets, and ignore the old properties matching
This policy was introduced in CMake version 2.8.12. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0023.rst b/Help/policy/CMP0023.rst
index 962b624..76a4900 100644
--- a/Help/policy/CMP0023.rst
+++ b/Help/policy/CMP0023.rst
@@ -31,3 +31,5 @@ signatures.
This policy was introduced in CMake version 2.8.12. 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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst
index ee53d5f..272a56c 100644
--- a/Help/policy/CMP0024.rst
+++ b/Help/policy/CMP0024.rst
@@ -20,3 +20,5 @@ allow including the result of an export() command.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0025.rst b/Help/policy/CMP0025.rst
index 8d19edf..62dd509 100644
--- a/Help/policy/CMP0025.rst
+++ b/Help/policy/CMP0025.rst
@@ -25,3 +25,5 @@ by default when this policy is not set and simply uses OLD behavior.
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0025 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0026.rst b/Help/policy/CMP0026.rst
index 4889249..3fe1374 100644
--- a/Help/policy/CMP0026.rst
+++ b/Help/policy/CMP0026.rst
@@ -24,3 +24,5 @@ not to allow reading the LOCATION properties from build-targets.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0027.rst b/Help/policy/CMP0027.rst
index bedaffe..28913ce 100644
--- a/Help/policy/CMP0027.rst
+++ b/Help/policy/CMP0027.rst
@@ -23,3 +23,5 @@ conditionally linked IMPORTED target does not exist.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0028.rst b/Help/policy/CMP0028.rst
index 24889ec..be57125 100644
--- a/Help/policy/CMP0028.rst
+++ b/Help/policy/CMP0028.rst
@@ -21,3 +21,5 @@ double-colons but is not an IMPORTED target or an ALIAS target.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0029.rst b/Help/policy/CMP0029.rst
index 8f58a12..aa10b97 100644
--- a/Help/policy/CMP0029.rst
+++ b/Help/policy/CMP0029.rst
@@ -8,3 +8,5 @@ but was kept in CMake for compatibility for a long time.
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0030.rst b/Help/policy/CMP0030.rst
index 9e31b38..81bbb84 100644
--- a/Help/policy/CMP0030.rst
+++ b/Help/policy/CMP0030.rst
@@ -9,3 +9,5 @@ not used it in years.
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0031.rst b/Help/policy/CMP0031.rst
index 6b89558..8c3eef6 100644
--- a/Help/policy/CMP0031.rst
+++ b/Help/policy/CMP0031.rst
@@ -11,3 +11,5 @@ the CMake process. It has been mostly superseded by the
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0032.rst b/Help/policy/CMP0032.rst
index f394a06..5c1fa4b 100644
--- a/Help/policy/CMP0032.rst
+++ b/Help/policy/CMP0032.rst
@@ -11,3 +11,5 @@ functionality is better achieved through dedicated outside tools.
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0033.rst b/Help/policy/CMP0033.rst
index b420065..4a6cc59 100644
--- a/Help/policy/CMP0033.rst
+++ b/Help/policy/CMP0033.rst
@@ -12,3 +12,5 @@ The functionality has been superseded by the :command:`export` and
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0034.rst b/Help/policy/CMP0034.rst
index 2133997..0f3934a 100644
--- a/Help/policy/CMP0034.rst
+++ b/Help/policy/CMP0034.rst
@@ -9,3 +9,5 @@ generate other files. This approach has long been replaced by
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0035.rst b/Help/policy/CMP0035.rst
index 7335b22..58199a4 100644
--- a/Help/policy/CMP0035.rst
+++ b/Help/policy/CMP0035.rst
@@ -8,3 +8,5 @@ logic. It has long been replaced by the :command:`if` command.
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0036.rst b/Help/policy/CMP0036.rst
index 817f156..4bcfc54 100644
--- a/Help/policy/CMP0036.rst
+++ b/Help/policy/CMP0036.rst
@@ -10,3 +10,5 @@ and :variable:`CMAKE_<LANG>_COMPILER` variables.
.. |disallowed_version| replace:: 3.0
.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst
index 4d485bf..9f8457c 100644
--- a/Help/policy/CMP0037.rst
+++ b/Help/policy/CMP0037.rst
@@ -24,3 +24,5 @@ if an add_* command is used with an invalid target name.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0038.rst b/Help/policy/CMP0038.rst
index df5af6a..a306d90 100644
--- a/Help/policy/CMP0038.rst
+++ b/Help/policy/CMP0038.rst
@@ -14,3 +14,5 @@ report an error if a target attempts to link to itself.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0039.rst b/Help/policy/CMP0039.rst
index 58ccc41..97d78ae 100644
--- a/Help/policy/CMP0039.rst
+++ b/Help/policy/CMP0039.rst
@@ -15,3 +15,5 @@ utility target.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst
index 77a3c81..e746c03 100644
--- a/Help/policy/CMP0040.rst
+++ b/Help/policy/CMP0040.rst
@@ -14,3 +14,5 @@ if the target referenced in :command:`add_custom_command` is unknown.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0041.rst b/Help/policy/CMP0041.rst
index 5a47de0..f027d5d 100644
--- a/Help/policy/CMP0041.rst
+++ b/Help/policy/CMP0041.rst
@@ -23,3 +23,5 @@ relative.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0042.rst b/Help/policy/CMP0042.rst
index fce870c..31314b2 100644
--- a/Help/policy/CMP0042.rst
+++ b/Help/policy/CMP0042.rst
@@ -17,3 +17,5 @@ variables.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0043.rst b/Help/policy/CMP0043.rst
index 629e502..9e427c3 100644
--- a/Help/policy/CMP0043.rst
+++ b/Help/policy/CMP0043.rst
@@ -43,3 +43,5 @@ of the :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property .
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0044.rst b/Help/policy/CMP0044.rst
index 4a3e215..02afa9f 100644
--- a/Help/policy/CMP0044.rst
+++ b/Help/policy/CMP0044.rst
@@ -17,3 +17,5 @@ the ``<LANG>_COMPILER_ID`` expression.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0045.rst b/Help/policy/CMP0045.rst
index 58c422f..c7e1a90f6 100644
--- a/Help/policy/CMP0045.rst
+++ b/Help/policy/CMP0045.rst
@@ -15,3 +15,5 @@ non-existent target.
This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0046.rst b/Help/policy/CMP0046.rst
index 1a3bc65..576d1b1 100644
--- a/Help/policy/CMP0046.rst
+++ b/Help/policy/CMP0046.rst
@@ -15,3 +15,5 @@ This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0047.rst b/Help/policy/CMP0047.rst
index 26ae439..882dd78 100644
--- a/Help/policy/CMP0047.rst
+++ b/Help/policy/CMP0047.rst
@@ -26,3 +26,5 @@ by default when this policy is not set and simply uses OLD behavior.
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0047 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst
index a54205e..0e7e606 100644
--- a/Help/policy/CMP0048.rst
+++ b/Help/policy/CMP0048.rst
@@ -20,3 +20,5 @@ This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0049.rst b/Help/policy/CMP0049.rst
index 5c8d4a8..a3ce4b1 100644
--- a/Help/policy/CMP0049.rst
+++ b/Help/policy/CMP0049.rst
@@ -21,3 +21,5 @@ This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0050.rst b/Help/policy/CMP0050.rst
index 76ae0aa..39e40b6 100644
--- a/Help/policy/CMP0050.rst
+++ b/Help/policy/CMP0050.rst
@@ -16,3 +16,5 @@ This policy was introduced in CMake version 3.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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0051.rst b/Help/policy/CMP0051.rst
index 1b56cb0..6b679e5 100644
--- a/Help/policy/CMP0051.rst
+++ b/Help/policy/CMP0051.rst
@@ -22,3 +22,5 @@ This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set it
to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst
index 48cfc9c..0ea5ace 100644
--- a/Help/policy/CMP0052.rst
+++ b/Help/policy/CMP0052.rst
@@ -22,3 +22,5 @@ This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set it
to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst
index bb0ff8b..2620a60 100644
--- a/Help/policy/CMP0053.rst
+++ b/Help/policy/CMP0053.rst
@@ -42,3 +42,5 @@ This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set
it to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst
index 3754fda..1e000a6 100644
--- a/Help/policy/CMP0054.rst
+++ b/Help/policy/CMP0054.rst
@@ -48,3 +48,5 @@ This policy was introduced in CMake version 3.1.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set
it to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0055.rst b/Help/policy/CMP0055.rst
index fe7ab6f..b3df758 100644
--- a/Help/policy/CMP0055.rst
+++ b/Help/policy/CMP0055.rst
@@ -15,3 +15,5 @@ This policy was introduced in CMake version 3.2.
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.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0056.rst b/Help/policy/CMP0056.rst
index 3c75ff4..3ba89d5 100644
--- a/Help/policy/CMP0056.rst
+++ b/Help/policy/CMP0056.rst
@@ -30,3 +30,5 @@ CMake version |release| does *not* warn by default when this policy
is not set and simply uses OLD behavior. See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0056 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst
index 1298a16..83db186 100644
--- a/Help/policy/CMP0057.rst
+++ b/Help/policy/CMP0057.rst
@@ -12,3 +12,5 @@ This policy was introduced in CMake version 3.3.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set
it to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0058.rst b/Help/policy/CMP0058.rst
index 0f20383..05efd48 100644
--- a/Help/policy/CMP0058.rst
+++ b/Help/policy/CMP0058.rst
@@ -106,3 +106,5 @@ out-of-source build trees if the policy is not set and then uses
the policy to ``OLD`` or ``NEW`` explicitly. The policy setting
must be in scope at the end of the top-level ``CMakeLists.txt``
file of the project and has global effect.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0059.rst b/Help/policy/CMP0059.rst
index e40f450..5da479a 100644
--- a/Help/policy/CMP0059.rst
+++ b/Help/policy/CMP0059.rst
@@ -15,3 +15,5 @@ This policy was introduced in CMake version 3.3.
CMake version |release| warns when the policy is not set and uses
``OLD`` behavior. Use the :command:`cmake_policy` command to set
it to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0060.rst b/Help/policy/CMP0060.rst
index cc37b1b..8611aff 100644
--- a/Help/policy/CMP0060.rst
+++ b/Help/policy/CMP0060.rst
@@ -61,3 +61,5 @@ CMake version |release| does *not* warn by default when this policy
is not set and simply uses OLD behavior. See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0060 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0061.rst b/Help/policy/CMP0061.rst
index 069a1ab..cb2ac28 100644
--- a/Help/policy/CMP0061.rst
+++ b/Help/policy/CMP0061.rst
@@ -22,3 +22,5 @@ add ``-i``.
This policy was introduced in CMake version 3.3. Unlike most policies,
CMake version |release| does *not* warn when this policy is not set and
simply uses OLD behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0062.rst b/Help/policy/CMP0062.rst
index e2f5a5a..9047fff 100644
--- a/Help/policy/CMP0062.rst
+++ b/Help/policy/CMP0062.rst
@@ -25,3 +25,5 @@ This policy was introduced in CMake version 3.3. CMake version
|release| warns when the policy is not set and uses ``OLD`` behavior. Use
the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW``
explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0063.rst b/Help/policy/CMP0063.rst
index 298e9c2..d736d06 100644
--- a/Help/policy/CMP0063.rst
+++ b/Help/policy/CMP0063.rst
@@ -24,3 +24,5 @@ This policy was introduced in CMake version 3.3. CMake version
|release| warns when the policy is not set and uses ``OLD`` behavior. Use
the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW``
explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/DEPRECATED.txt b/Help/policy/DEPRECATED.txt
new file mode 100644
index 0000000..f66de55
--- /dev/null
+++ b/Help/policy/DEPRECATED.txt
@@ -0,0 +1,4 @@
+.. note::
+ The ``OLD`` behavior of a policy is
+ :manual:`deprecated by definition <cmake-policies(7)>`
+ and may be removed in a future version of CMake.
diff --git a/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst b/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst
index f2c875e..a61c702 100644
--- a/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst
+++ b/Help/prop_tgt/CONFIG_OUTPUT_NAME.rst
@@ -2,6 +2,7 @@
--------------------
Old per-configuration target file base name.
+Use :prop_tgt:`OUTPUT_NAME_<CONFIG>` instead.
-This is a configuration-specific version of OUTPUT_NAME. Use
-OUTPUT_NAME_<CONFIG> instead.
+This is a configuration-specific version of the :prop_tgt:`OUTPUT_NAME`
+target property.
diff --git a/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
new file mode 100644
index 0000000..0fe0b31
--- /dev/null
+++ b/Help/prop_tgt/LANG_COMPILER_LAUNCHER.rst
@@ -0,0 +1,13 @@
+<LANG>_COMPILER_LAUNCHER
+------------------------
+
+This property is implemented only when ``<LANG>`` is ``C`` or ``CXX``.
+
+Specify a :ref:`;-list <CMake Language Lists>` containing a command line
+for a compiler launching tool. The :ref:`Makefile Generators` and the
+:generator:`Ninja` generator will run this tool and pass the compiler and
+its arguments to the tool. Some example tools are distcc and ccache.
+
+This property is initialized by the value of
+the :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/OUTPUT_NAME.rst b/Help/prop_tgt/OUTPUT_NAME.rst
index 97bf010..f1bdb7c 100644
--- a/Help/prop_tgt/OUTPUT_NAME.rst
+++ b/Help/prop_tgt/OUTPUT_NAME.rst
@@ -6,3 +6,16 @@ Output name for target files.
This sets the base name for output files created for an executable or
library target. If not set, the logical target name is used by
default.
+
+Contents of ``OUTPUT_NAME`` and the variants listed below may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+See also the variants:
+
+* :prop_tgt:`OUTPUT_NAME_<CONFIG>`
+* :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>`
+* :prop_tgt:`ARCHIVE_OUTPUT_NAME`
+* :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>`
+* :prop_tgt:`LIBRARY_OUTPUT_NAME`
+* :prop_tgt:`RUNTIME_OUTPUT_NAME_<CONFIG>`
+* :prop_tgt:`RUNTIME_OUTPUT_NAME`
diff --git a/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst b/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst
index 7bfbcbc..41b782f 100644
--- a/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst
+++ b/Help/prop_tgt/OUTPUT_NAME_CONFIG.rst
@@ -3,4 +3,5 @@ OUTPUT_NAME_<CONFIG>
Per-configuration target file base name.
-This is the configuration-specific version of OUTPUT_NAME.
+This is the configuration-specific version of the :prop_tgt:`OUTPUT_NAME`
+target property.
diff --git a/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst
new file mode 100644
index 0000000..3f48af8
--- /dev/null
+++ b/Help/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.rst
@@ -0,0 +1,18 @@
+WINDOWS_EXPORT_ALL_SYMBOLS
+--------------------------
+
+This property is implemented only for MS-compatible tools on Windows.
+
+Enable this boolean property to automatically create a module definition
+(``.def``) file with all global symbols found in the input ``.obj`` files
+for a ``SHARED`` library on Windows. The module definition file will be
+passed to the linker causing all symbols to be exported from the ``.dll``.
+For global *data* symbols, ``__declspec(dllimport)`` must still be used when
+compiling against the code in the ``.dll``. All other function symbols will
+be automatically exported and imported by callers. This simplifies porting
+projects to Windows by reducing the need for explicit ``dllexport`` markup,
+even in ``C++`` classes.
+
+This property is initialized by the value of
+the :variable:`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` variable if it is set
+when a target is created.
diff --git a/Help/release/3.3.rst b/Help/release/3.3.rst
index 15127cc..0beb354 100644
--- a/Help/release/3.3.rst
+++ b/Help/release/3.3.rst
@@ -251,12 +251,6 @@ Deprecated and Removed Features
Projects may populate the :ref:`User Package Registry` to aid
users building multiple dependent projects one after another.
-* When building with GNU tools on Windows (MinGW tools), the
- :command:`find_library` command will no longer consider
- ``.dll`` files to be linkable libraries. All dynamic link
- libraries are expected to provide separate ``.dll.a`` or
- ``.lib`` import libraries.
-
* The :command:`add_definitions()` command no longer causes a
:prop_dir:`DEFINITIONS` directory property to be populated. See policy
:policy:`CMP0059`.
diff --git a/Help/release/dev/ConcurrentFortran-compiler-id.rst b/Help/release/dev/ConcurrentFortran-compiler-id.rst
new file mode 100644
index 0000000..71e79aa
--- /dev/null
+++ b/Help/release/dev/ConcurrentFortran-compiler-id.rst
@@ -0,0 +1,5 @@
+ConcurrentFortran-compiler-id
+-----------------------------
+
+* The `Concurrent Fortran 77 <https://ccur.com>`__ compiler is now supported.
+ Its :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` is ``CCur``.
diff --git a/Help/release/dev/ExternalProject-USES_TERMINAL.rst b/Help/release/dev/ExternalProject-USES_TERMINAL.rst
new file mode 100644
index 0000000..415540d
--- /dev/null
+++ b/Help/release/dev/ExternalProject-USES_TERMINAL.rst
@@ -0,0 +1,7 @@
+ExternalProject-USES_TERMINAL
+-----------------------------
+
+* The :module:`ExternalProject` module learned new ``USES_TERMINAL``
+ arguments for giving steps exclusive terminal access. Especially
+ useful with the :generator:`Ninja` generator to monitor CMake
+ superbuild progress and prevent CPU oversubscription.
diff --git a/Help/release/dev/ExternalProject_init_selected_submodules.rst b/Help/release/dev/ExternalProject_init_selected_submodules.rst
new file mode 100644
index 0000000..e642c19
--- /dev/null
+++ b/Help/release/dev/ExternalProject_init_selected_submodules.rst
@@ -0,0 +1,7 @@
+ExternalProject_init_selected_submodules
+----------------------------------------
+
+* The :module:`ExternalProject` module :command:`ExternalProject_Add`
+ function ``GIT_SUBMODULES`` option now also limits the set of
+ submodules that are initialized in addition to the prior behavior
+ of limiting the set of submodules that are updated.
diff --git a/Help/release/dev/FindBISON-DEFINES_FILE.rst b/Help/release/dev/FindBISON-DEFINES_FILE.rst
new file mode 100644
index 0000000..815d560
--- /dev/null
+++ b/Help/release/dev/FindBISON-DEFINES_FILE.rst
@@ -0,0 +1,6 @@
+FindBISON-DEFINES_FILE
+----------------------
+
+* The :module:`FindBISON` module ``BISON_TARGET`` macro learned a
+ new ``DEFINES_FILE`` option to specify a custom output header
+ to be generated.
diff --git a/Help/release/dev/FindIce-imported-targets.rst b/Help/release/dev/FindIce-imported-targets.rst
new file mode 100644
index 0000000..7e1b2f4
--- /dev/null
+++ b/Help/release/dev/FindIce-imported-targets.rst
@@ -0,0 +1,4 @@
+FindIce-imported-targets
+------------------------
+
+* The :module:`FindIce` module now provides imported targets.
diff --git a/Help/release/dev/GNUInstallDirs-special-prefixes.rst b/Help/release/dev/GNUInstallDirs-special-prefixes.rst
new file mode 100644
index 0000000..83c1352
--- /dev/null
+++ b/Help/release/dev/GNUInstallDirs-special-prefixes.rst
@@ -0,0 +1,9 @@
+GNUInstallDirs-special-prefixes
+-------------------------------
+
+* The :module:`GNUInstallDirs` module learned special default values
+ for certain installation prefixes according to the `GNU Coding
+ Standards`_ and the `Filesystem Hierarchy Standard`_.
+
+.. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+.. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
diff --git a/Help/release/dev/OUTPUT_NAME-genex.rst b/Help/release/dev/OUTPUT_NAME-genex.rst
new file mode 100644
index 0000000..0a39820
--- /dev/null
+++ b/Help/release/dev/OUTPUT_NAME-genex.rst
@@ -0,0 +1,5 @@
+OUTPUT_NAME-genex
+-----------------
+
+* The :prop_tgt:`OUTPUT_NAME` target property and its variants learned to
+ support :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/add-apple-swift-language.rst b/Help/release/dev/add-apple-swift-language.rst
new file mode 100644
index 0000000..60ce5d8
--- /dev/null
+++ b/Help/release/dev/add-apple-swift-language.rst
@@ -0,0 +1,9 @@
+add-apple-swift-language
+------------------------
+
+* CMake learned rudimentary support for the Apple Swift language. When using
+ the :generator:`Xcode` generator with Xcode 6.1 or higher, one may enable
+ the ``Swift`` language with the :command:`enable_language` command or the
+ :command:`project` command (this is an error with other generators or when
+ Xcode is too old). Then one may list ``.swift`` source files in targets
+ for compilation.
diff --git a/Help/release/dev/auto_export_dll_symbols.rst b/Help/release/dev/auto_export_dll_symbols.rst
new file mode 100644
index 0000000..9db2b5e
--- /dev/null
+++ b/Help/release/dev/auto_export_dll_symbols.rst
@@ -0,0 +1,6 @@
+auto_export_dll_symbols
+-----------------------
+
+* On Windows with MS-compatible tools, CMake learned to optionally
+ generate a module definition (``.def``) file for ``SHARED`` libraries.
+ See the :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property.
diff --git a/Help/release/dev/compiler-launcher.rst b/Help/release/dev/compiler-launcher.rst
new file mode 100644
index 0000000..3ba692d
--- /dev/null
+++ b/Help/release/dev/compiler-launcher.rst
@@ -0,0 +1,8 @@
+compiler-launcher
+-----------------
+
+* The :ref:`Makefile Generators` and the :generator:`Ninja` generator
+ learned to add compiler launcher tools like distcc and ccache along with the
+ compiler for ``C`` and ``CXX`` languages. See the
+ :variable:`CMAKE_<LANG>_COMPILER_LAUNCHER` variable and
+ :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property for details.
diff --git a/Help/release/dev/ctest-test-load-option.rst b/Help/release/dev/ctest-test-load-option.rst
new file mode 100644
index 0000000..069f49a
--- /dev/null
+++ b/Help/release/dev/ctest-test-load-option.rst
@@ -0,0 +1,9 @@
+ctest-test-load-option
+----------------------
+
+* CTest learned to optionally measure the CPU load during parallel
+ testing and avoid starting tests that may cause the load to exceed
+ a given threshold. See the :manual:`ctest(1)` command ``--test-load``
+ option, the ``TestLoad`` setting of the :ref:`CTest Test Step`,
+ the :variable:`CTEST_TEST_LOAD` variable, and the ``TEST_LOAD``
+ option of the :command:`ctest_test` command.
diff --git a/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst
new file mode 100644
index 0000000..dd52ace
--- /dev/null
+++ b/Help/release/dev/remove-CMAKE_USE_RELATIVE_PATHS.rst
@@ -0,0 +1,5 @@
+remove-CMAKE_USE_RELATIVE_PATHS
+-------------------------------
+
+* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any
+ effect. Previously it was partially implemented and unreliable.
diff --git a/Help/release/dev/string-append.rst b/Help/release/dev/string-append.rst
new file mode 100644
index 0000000..190b51e
--- /dev/null
+++ b/Help/release/dev/string-append.rst
@@ -0,0 +1,4 @@
+string-append
+-------------
+
+* The :command:`string` command learned a new ``APPEND`` subcommand.
diff --git a/Help/variable/CMAKE_APPBUNDLE_PATH.rst b/Help/variable/CMAKE_APPBUNDLE_PATH.rst
index 469b316..2bc79ac 100644
--- a/Help/variable/CMAKE_APPBUNDLE_PATH.rst
+++ b/Help/variable/CMAKE_APPBUNDLE_PATH.rst
@@ -1,5 +1,6 @@
CMAKE_APPBUNDLE_PATH
--------------------
-Search path for OS X application bundles used by the :command:`find_program`,
-and :command:`find_package` commands.
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for OS X application bundles used by the :command:`find_program`, and
+:command:`find_package` commands.
diff --git a/Help/variable/CMAKE_FIND_APPBUNDLE.rst b/Help/variable/CMAKE_FIND_APPBUNDLE.rst
new file mode 100644
index 0000000..e0727b5
--- /dev/null
+++ b/Help/variable/CMAKE_FIND_APPBUNDLE.rst
@@ -0,0 +1,22 @@
+CMAKE_FIND_APPBUNDLE
+--------------------
+
+This variable affects how ``find_*`` commands choose between
+OS X Application Bundles and unix-style package components.
+
+On Darwin or systems supporting OS X Application Bundles, the
+``CMAKE_FIND_APPBUNDLE`` variable can be set to empty or
+one of the following:
+
+``FIRST``
+ Try to find application bundles before standard programs.
+ This is the default on Darwin.
+
+``LAST``
+ Try to find application bundles after standard programs.
+
+``ONLY``
+ Only try to find application bundles.
+
+``NEVER``
+ Never try to find application bundles.
diff --git a/Help/variable/CMAKE_FIND_FRAMEWORK.rst b/Help/variable/CMAKE_FIND_FRAMEWORK.rst
new file mode 100644
index 0000000..790694a
--- /dev/null
+++ b/Help/variable/CMAKE_FIND_FRAMEWORK.rst
@@ -0,0 +1,22 @@
+CMAKE_FIND_FRAMEWORK
+--------------------
+
+This variable affects how ``find_*`` commands choose between
+OS X Frameworks and unix-style package components.
+
+On Darwin or systems supporting OS X Frameworks, the
+``CMAKE_FIND_FRAMEWORK`` variable can be set to empty or
+one of the following:
+
+``FIRST``
+ Try to find frameworks before standard libraries or headers.
+ This is the default on Darwin.
+
+``LAST``
+ Try to find frameworks after standard libraries or headers.
+
+``ONLY``
+ Only try to find frameworks.
+
+``NEVER``
+ Never try to find frameworks.
diff --git a/Help/variable/CMAKE_FIND_ROOT_PATH.rst b/Help/variable/CMAKE_FIND_ROOT_PATH.rst
index 67948f7..ccf5234 100644
--- a/Help/variable/CMAKE_FIND_ROOT_PATH.rst
+++ b/Help/variable/CMAKE_FIND_ROOT_PATH.rst
@@ -1,7 +1,7 @@
CMAKE_FIND_ROOT_PATH
--------------------
-List of root paths to search on the filesystem.
+:ref:`;-list <CMake Language Lists>` of root paths to search on the filesystem.
This variable is most useful when cross-compiling. CMake uses the paths in
this list as alternative roots to find filesystem items with :command:`find_package`,
diff --git a/Help/variable/CMAKE_FRAMEWORK_PATH.rst b/Help/variable/CMAKE_FRAMEWORK_PATH.rst
index f1bc75e..5ff08e6 100644
--- a/Help/variable/CMAKE_FRAMEWORK_PATH.rst
+++ b/Help/variable/CMAKE_FRAMEWORK_PATH.rst
@@ -1,6 +1,7 @@
CMAKE_FRAMEWORK_PATH
--------------------
-Search path for OS X frameworks used by the :command:`find_library`,
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for OS X frameworks used by the :command:`find_library`,
:command:`find_package`, :command:`find_path`, and :command:`find_file`
commands.
diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
index 5809b6a..5559eb7 100644
--- a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
+++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
@@ -5,7 +5,7 @@ Generator-specific target platform name specified by user.
Some CMake generators support a target platform name to be given
to the native build system to choose a compiler toolchain.
-If the user specifies a toolset name (e.g. via the cmake -A option)
+If the user specifies a platform name (e.g. via the cmake -A option)
the value will be available in this variable.
The value of this variable should never be modified by project code.
diff --git a/Help/variable/CMAKE_IGNORE_PATH.rst b/Help/variable/CMAKE_IGNORE_PATH.rst
index a818f74..92f3770 100644
--- a/Help/variable/CMAKE_IGNORE_PATH.rst
+++ b/Help/variable/CMAKE_IGNORE_PATH.rst
@@ -1,17 +1,18 @@
CMAKE_IGNORE_PATH
-----------------
-Path to be ignored by FIND_XXX() commands.
+:ref:`;-list <CMake Language Lists>` of directories to be *ignored* by
+the :command:`find_program`, :command:`find_library`, :command:`find_file`,
+and :command:`find_path` commands. This is useful in cross-compiling
+environments where some system directories contain incompatible but
+possibly linkable libraries. For example, on cross-compiled cluster
+environments, this allows a user to ignore directories containing
+libraries meant for the front-end machine.
-Specifies directories to be ignored by searches in FIND_XXX()
-commands. This is useful in cross-compiled environments where some
-system directories contain incompatible but possibly linkable
-libraries. For example, on cross-compiled cluster environments, this
-allows a user to ignore directories containing libraries meant for the
-front-end machine that modules like FindX11 (and others) would
-normally search. By default this is empty; it is intended to be set
-by the project. Note that CMAKE_IGNORE_PATH takes a list of directory
-names, NOT a list of prefixes. If you want to ignore paths under
-prefixes (bin, include, lib, etc.), you'll need to specify them
-explicitly. See also CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH,
-CMAKE_INCLUDE_PATH, CMAKE_PROGRAM_PATH.
+By default this is empty; it is intended to be set by the project.
+Note that ``CMAKE_IGNORE_PATH`` takes a list of directory names, *not*
+a list of prefixes. To ignore paths under prefixes (``bin``, ``include``,
+``lib``, etc.), specify them explicitly.
+
+See also the :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_LIBRARY_PATH`,
+:variable:`CMAKE_INCLUDE_PATH`, and :variable:`CMAKE_PROGRAM_PATH` variables.
diff --git a/Help/variable/CMAKE_INCLUDE_PATH.rst b/Help/variable/CMAKE_INCLUDE_PATH.rst
index 360b403..e4e7f2c 100644
--- a/Help/variable/CMAKE_INCLUDE_PATH.rst
+++ b/Help/variable/CMAKE_INCLUDE_PATH.rst
@@ -1,10 +1,7 @@
CMAKE_INCLUDE_PATH
------------------
-Path used for searching by FIND_FILE() and FIND_PATH().
-
-Specifies a path which will be used both by FIND_FILE() and
-FIND_PATH(). Both commands will check each of the contained
-directories for the existence of the file which is currently searched.
-By default it is empty, it is intended to be set by the project. See
-also CMAKE_SYSTEM_INCLUDE_PATH, CMAKE_PREFIX_PATH.
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for the :command:`find_file` and :command:`find_path` commands. By default it
+is empty, it is intended to be set by the project. See also
+:variable:`CMAKE_SYSTEM_INCLUDE_PATH` and :variable:`CMAKE_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index f554f4e..1c3b134 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -11,6 +11,7 @@ include:
Absoft = Absoft Fortran (absoft.com)
ADSP = Analog VisualDSP++ (analog.com)
AppleClang = Apple Clang (apple.com)
+ CCur = Concurrent Fortran (ccur.com)
Clang = LLVM Clang (clang.llvm.org)
Cray = Cray Compiler (cray.com)
Embarcadero, Borland = Embarcadero (embarcadero.com)
diff --git a/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
new file mode 100644
index 0000000..7961f60
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_COMPILER_LAUNCHER.rst
@@ -0,0 +1,6 @@
+CMAKE_<LANG>_COMPILER_LAUNCHER
+------------------------------
+
+Default value for :prop_tgt:`<LANG>_COMPILER_LAUNCHER` target property.
+This variable is used to initialize the property on each target as it is
+created. This is done only when ``<LANG>`` is ``C`` or ``CXX``.
diff --git a/Help/variable/CMAKE_LIBRARY_PATH.rst b/Help/variable/CMAKE_LIBRARY_PATH.rst
index e77dd34..b1770dc 100644
--- a/Help/variable/CMAKE_LIBRARY_PATH.rst
+++ b/Help/variable/CMAKE_LIBRARY_PATH.rst
@@ -1,10 +1,7 @@
CMAKE_LIBRARY_PATH
------------------
-Path used for searching by FIND_LIBRARY().
-
-Specifies a path which will be used by FIND_LIBRARY(). FIND_LIBRARY()
-will check each of the contained directories for the existence of the
-library which is currently searched. By default it is empty, it is
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for the :command:`find_library` command. By default it is empty, it is
intended to be set by the project. See also
-CMAKE_SYSTEM_LIBRARY_PATH, CMAKE_PREFIX_PATH.
+:variable:`CMAKE_SYSTEM_LIBRARY_PATH` and :variable:`CMAKE_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_MODULE_PATH.rst b/Help/variable/CMAKE_MODULE_PATH.rst
index a2dde45..5ea7cbb 100644
--- a/Help/variable/CMAKE_MODULE_PATH.rst
+++ b/Help/variable/CMAKE_MODULE_PATH.rst
@@ -1,8 +1,7 @@
CMAKE_MODULE_PATH
-----------------
-List of directories to search for CMake modules.
-
-Commands like include() and find_package() search for files in
-directories listed by this variable before checking the default
-modules that come with CMake.
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for CMake modules to be loaded by the the :command:`include` or
+:command:`find_package` commands before checking the default modules that come
+with CMake. By default it is empty, it is intended to be set by the project.
diff --git a/Help/variable/CMAKE_PREFIX_PATH.rst b/Help/variable/CMAKE_PREFIX_PATH.rst
index 4c21d5e..c2a4a60 100644
--- a/Help/variable/CMAKE_PREFIX_PATH.rst
+++ b/Help/variable/CMAKE_PREFIX_PATH.rst
@@ -1,13 +1,15 @@
CMAKE_PREFIX_PATH
-----------------
-Path used for searching by FIND_XXX(), with appropriate suffixes added.
+:ref:`;-list <CMake Language Lists>` of directories specifying installation
+*prefixes* to be searched by the :command:`find_package`,
+:command:`find_program`, :command:`find_library`, :command:`find_file`, and
+:command:`find_path` commands. Each command will add appropriate
+subdirectories (like ``bin``, ``lib``, or ``include``) as specified in its own
+documentation.
-Specifies a path which will be used by the FIND_XXX() commands. It
-contains the "base" directories, the FIND_XXX() commands append
-appropriate subdirectories to the base directories. So FIND_PROGRAM()
-adds /bin to each of the directories in the path, FIND_LIBRARY()
-appends /lib to each of the directories, and FIND_PATH() and
-FIND_FILE() append /include . By default it is empty, it is intended
-to be set by the project. See also CMAKE_SYSTEM_PREFIX_PATH,
-CMAKE_INCLUDE_PATH, CMAKE_LIBRARY_PATH, CMAKE_PROGRAM_PATH.
+By default this is empty. It is intended to be set by the project.
+
+See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`, :variable:`CMAKE_INCLUDE_PATH`,
+:variable:`CMAKE_LIBRARY_PATH`, :variable:`CMAKE_PROGRAM_PATH`, and
+:variable:`CMAKE_IGNORE_PATH`.
diff --git a/Help/variable/CMAKE_PROGRAM_PATH.rst b/Help/variable/CMAKE_PROGRAM_PATH.rst
index 02c5e02..799e119 100644
--- a/Help/variable/CMAKE_PROGRAM_PATH.rst
+++ b/Help/variable/CMAKE_PROGRAM_PATH.rst
@@ -1,10 +1,7 @@
CMAKE_PROGRAM_PATH
------------------
-Path used for searching by FIND_PROGRAM().
-
-Specifies a path which will be used by FIND_PROGRAM(). FIND_PROGRAM()
-will check each of the contained directories for the existence of the
-program which is currently searched. By default it is empty, it is
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for the :command:`find_program` command. By default it is empty, it is
intended to be set by the project. See also
-CMAKE_SYSTEM_PROGRAM_PATH, CMAKE_PREFIX_PATH.
+:variable:`CMAKE_SYSTEM_PROGRAM_PATH` and :variable:`CMAKE_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst
new file mode 100644
index 0000000..3c6687c
--- /dev/null
+++ b/Help/variable/CMAKE_SYSTEM_APPBUNDLE_PATH.rst
@@ -0,0 +1,7 @@
+CMAKE_SYSTEM_APPBUNDLE_PATH
+---------------------------
+
+Search path for OS X application bundles used by the :command:`find_program`,
+and :command:`find_package` commands. By default it contains the standard
+directories for the current system. It is *not* intended to be modified by
+the project, use :variable:`CMAKE_APPBUNDLE_PATH` for this.
diff --git a/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst
new file mode 100644
index 0000000..1e8b0d9
--- /dev/null
+++ b/Help/variable/CMAKE_SYSTEM_FRAMEWORK_PATH.rst
@@ -0,0 +1,8 @@
+CMAKE_SYSTEM_FRAMEWORK_PATH
+---------------------------
+
+Search path for OS X frameworks used by the :command:`find_library`,
+:command:`find_package`, :command:`find_path`, and :command:`find_file`
+commands. By default it contains the standard directories for the
+current system. It is *not* intended to be modified by the project,
+use :variable:`CMAKE_FRAMEWORK_PATH` for this.
diff --git a/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst b/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst
index 9e6b195..4ad7e33 100644
--- a/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_IGNORE_PATH.rst
@@ -1,15 +1,18 @@
CMAKE_SYSTEM_IGNORE_PATH
------------------------
-Path to be ignored by FIND_XXX() commands.
+:ref:`;-list <CMake Language Lists>` of directories to be *ignored* by
+the :command:`find_program`, :command:`find_library`, :command:`find_file`,
+and :command:`find_path` commands. This is useful in cross-compiling
+environments where some system directories contain incompatible but
+possibly linkable libraries. For example, on cross-compiled cluster
+environments, this allows a user to ignore directories containing
+libraries meant for the front-end machine.
-Specifies directories to be ignored by searches in FIND_XXX()
-commands. This is useful in cross-compiled environments where some
-system directories contain incompatible but possibly linkable
-libraries. For example, on cross-compiled cluster environments, this
-allows a user to ignore directories containing libraries meant for the
-front-end machine that modules like FindX11 (and others) would
-normally search. By default this contains a list of directories
-containing incompatible binaries for the host system. See also
-CMAKE_SYSTEM_PREFIX_PATH, CMAKE_SYSTEM_LIBRARY_PATH,
-CMAKE_SYSTEM_INCLUDE_PATH, and CMAKE_SYSTEM_PROGRAM_PATH.
+By default this contains a list of directories containing incompatible
+binaries for the host system. See the :variable:`CMAKE_IGNORE_PATH` variable
+that is intended to be set by the project.
+
+See also the :variable:`CMAKE_SYSTEM_PREFIX_PATH`,
+:variable:`CMAKE_SYSTEM_LIBRARY_PATH`, :variable:`CMAKE_SYSTEM_INCLUDE_PATH`,
+and :variable:`CMAKE_SYSTEM_PROGRAM_PATH` variables.
diff --git a/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst b/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst
index 1734185..2c14345 100644
--- a/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_INCLUDE_PATH.rst
@@ -1,11 +1,8 @@
CMAKE_SYSTEM_INCLUDE_PATH
-------------------------
-Path used for searching by FIND_FILE() and FIND_PATH().
-
-Specifies a path which will be used both by FIND_FILE() and
-FIND_PATH(). Both commands will check each of the contained
-directories for the existence of the file which is currently searched.
-By default it contains the standard directories for the current
-system. It is NOT intended to be modified by the project, use
-CMAKE_INCLUDE_PATH for this. See also CMAKE_SYSTEM_PREFIX_PATH.
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for the :command:`find_file` and :command:`find_path` commands. By default
+this contains the standard directories for the current system. It is *not*
+intended to be modified by the project; use :variable:`CMAKE_INCLUDE_PATH` for
+this. See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst b/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst
index 4778646..3969cb9 100644
--- a/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_LIBRARY_PATH.rst
@@ -1,11 +1,8 @@
CMAKE_SYSTEM_LIBRARY_PATH
-------------------------
-Path used for searching by FIND_LIBRARY().
-
-Specifies a path which will be used by FIND_LIBRARY(). FIND_LIBRARY()
-will check each of the contained directories for the existence of the
-library which is currently searched. By default it contains the
-standard directories for the current system. It is NOT intended to be
-modified by the project, use CMAKE_LIBRARY_PATH for this. See also
-CMAKE_SYSTEM_PREFIX_PATH.
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for the :command:`find_library` command. By default this contains the
+standard directories for the current system. It is *not* intended to be
+modified by the project; use :variable:`CMAKE_LIBRARY_PATH` for this.
+See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
index 537eaba..e74dfad 100644
--- a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
@@ -1,16 +1,18 @@
CMAKE_SYSTEM_PREFIX_PATH
------------------------
-Path used for searching by FIND_XXX(), with appropriate suffixes added.
+:ref:`;-list <CMake Language Lists>` of directories specifying installation
+*prefixes* to be searched by the :command:`find_package`,
+:command:`find_program`, :command:`find_library`, :command:`find_file`, and
+:command:`find_path` commands. Each command will add appropriate
+subdirectories (like ``bin``, ``lib``, or ``include``) as specified in its own
+documentation.
-Specifies a path which will be used by the FIND_XXX() commands. It
-contains the "base" directories, the FIND_XXX() commands append
-appropriate subdirectories to the base directories. So FIND_PROGRAM()
-adds /bin to each of the directories in the path, FIND_LIBRARY()
-appends /lib to each of the directories, and FIND_PATH() and
-FIND_FILE() append /include . By default this contains the standard
-directories for the current system, the CMAKE_INSTALL_PREFIX and
-the :variable:`CMAKE_STAGING_PREFIX`. It is NOT intended to be modified by
-the project, use CMAKE_PREFIX_PATH for this. See also CMAKE_SYSTEM_INCLUDE_PATH,
-CMAKE_SYSTEM_LIBRARY_PATH, CMAKE_SYSTEM_PROGRAM_PATH, and
-CMAKE_SYSTEM_IGNORE_PATH.
+By default this contains the standard directories for the current system, the
+:variable:`CMAKE_INSTALL_PREFIX`, and the :variable:`CMAKE_STAGING_PREFIX`.
+It is *not* intended to be modified by the project; use
+:variable:`CMAKE_PREFIX_PATH` for this.
+
+See also :variable:`CMAKE_SYSTEM_INCLUDE_PATH`,
+:variable:`CMAKE_SYSTEM_LIBRARY_PATH`, :variable:`CMAKE_SYSTEM_PROGRAM_PATH`,
+and :variable:`CMAKE_SYSTEM_IGNORE_PATH`.
diff --git a/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst b/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst
index e1fad63..cf1b83e 100644
--- a/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_PROGRAM_PATH.rst
@@ -1,11 +1,8 @@
CMAKE_SYSTEM_PROGRAM_PATH
-------------------------
-Path used for searching by FIND_PROGRAM().
-
-Specifies a path which will be used by FIND_PROGRAM(). FIND_PROGRAM()
-will check each of the contained directories for the existence of the
-program which is currently searched. By default it contains the
-standard directories for the current system. It is NOT intended to be
-modified by the project, use CMAKE_PROGRAM_PATH for this. See also
-CMAKE_SYSTEM_PREFIX_PATH.
+:ref:`;-list <CMake Language Lists>` of directories specifying a search path
+for the :command:`find_program` command. By default this contains the
+standard directories for the current system. It is *not* intended to be
+modified by the project; use :variable:`CMAKE_PROGRAM_PATH` for this.
+See also :variable:`CMAKE_SYSTEM_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst
index af6f08c..06fe0fb 100644
--- a/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst
+++ b/Help/variable/CMAKE_USE_RELATIVE_PATHS.rst
@@ -1,10 +1,5 @@
CMAKE_USE_RELATIVE_PATHS
------------------------
-Use relative paths (May not work!).
-
-If this is set to TRUE, then CMake will use relative paths between the
-source and binary tree. This option does not work for more
-complicated projects, and relative paths are used when possible. In
-general, it is not possible to move CMake generated makefiles to a
-different location regardless of the value of this variable.
+This variable has no effect. The partially implemented effect it
+had in previous releases was removed in CMake 3.4.
diff --git a/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst b/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst
new file mode 100644
index 0000000..1636842
--- /dev/null
+++ b/Help/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.rst
@@ -0,0 +1,6 @@
+CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
+--------------------------------
+
+Default value for :prop_tgt:`WINDOWS_EXPORT_ALL_SYMBOLS` target property.
+This variable is used to initialize the property on each target as it is
+created.
diff --git a/Help/variable/CTEST_TEST_LOAD.rst b/Help/variable/CTEST_TEST_LOAD.rst
new file mode 100644
index 0000000..80823fe
--- /dev/null
+++ b/Help/variable/CTEST_TEST_LOAD.rst
@@ -0,0 +1,7 @@
+CTEST_TEST_LOAD
+---------------
+
+Specify the ``TestLoad`` setting in the :ref:`CTest Test Step`
+of a :manual:`ctest(1)` dashboard client script. This sets the
+default value for the ``TEST_LOAD`` option of the :command:`ctest_test`
+command.
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 937aa8c..492c3ea 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -80,6 +80,7 @@ else()
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification file.
+ set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST)
set(CMAKE_C_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
@@ -104,6 +105,14 @@ if(NOT CMAKE_C_COMPILER_ID_RUN)
set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
+ # Match the link line from xcodebuild output of the form
+ # Ld ...
+ # ...
+ # /path/to/cc ...CompilerIdC/...
+ # to extract the compiler front-end for the language.
+ set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.xctest/)?CompilerIdC[ \t\n\\\"]")
+ set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 893c454..2032015 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -78,6 +78,7 @@ else()
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification file.
+ set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST)
set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
@@ -99,6 +100,14 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN)
set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR )
set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
+ # Match the link line from xcodebuild output of the form
+ # Ld ...
+ # ...
+ # /path/to/cc ...CompilerIdCXX/...
+ # to extract the compiler front-end for the language.
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.xctest/)?CompilerIdCXX[ \t\n\\\"]")
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 403ac08..c699315 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -34,12 +34,19 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
# Try building with no extra flags and then try each set
# of helper flags. Stop when the compiler is identified.
- foreach(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
- if(NOT CMAKE_${lang}_COMPILER_ID)
- CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
- foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
- CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
- endforeach()
+ foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
+ ""
+ ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
+ CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
+ CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
+ endif()
+ foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
+ CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
+ endforeach()
+ if(CMAKE_${lang}_COMPILER_ID)
+ break()
endif()
endforeach()
@@ -210,7 +217,7 @@ Id flags: ${testflags}
set(id_subsystem 1)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
- get_filename_component(id_src "${src}" NAME)
+ set(id_src "${src}")
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")
@@ -249,7 +256,7 @@ Id flags: ${testflags}
set(id_lang "${lang}")
set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE})
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
- get_filename_component(id_src "${src}" NAME)
+ set(id_src "${src}")
if(CMAKE_XCODE_PLATFORM_TOOLSET)
set(id_toolset "GCC_VERSION = ${CMAKE_XCODE_PLATFORM_TOOLSET};")
else()
@@ -297,15 +304,12 @@ Id flags: ${testflags}
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}")
endif()
- # Match the link line from xcodebuild output of the form
- # Ld ...
- # ...
- # /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}.xctest/)?CompilerId${lang}[ \t\n\\\"]")
- set(_comp "${CMAKE_MATCH_2}")
- if(EXISTS "${_comp}")
- set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ if(DEFINED CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX)
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX}")
+ set(_comp "${CMAKE_MATCH_${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_INDEX}}")
+ if(EXISTS "${_comp}")
+ set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ endif()
endif()
endif()
else()
@@ -355,6 +359,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# No output files should be inspected.
set(COMPILER_${lang}_PRODUCED_FILES)
+ set(COMPILER_${lang}_PRODUCED_OUTPUT)
else()
# Compilation succeeded.
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
@@ -395,10 +400,24 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
"${src}\" did not produce an executable in \""
"${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n")
endif()
+
+ set(COMPILER_${lang}_PRODUCED_OUTPUT "${CMAKE_${lang}_COMPILER_ID_OUTPUT}")
endif()
# Return the files produced by the compilation.
set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
+ set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
+endfunction()
+
+#-----------------------------------------------------------------------------
+# Function to extract the compiler id from compiler output.
+function(CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR lang output)
+ foreach(vendor ${CMAKE_${lang}_COMPILER_ID_MATCH_VENDORS})
+ if(output MATCHES "${CMAKE_${lang}_COMPILER_ID_MATCH_VENDOR_REGEX_${vendor}}")
+ set(CMAKE_${lang}_COMPILER_ID "${vendor}")
+ endif()
+ endforeach()
+ set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 3a27127..911ffac 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -98,6 +98,10 @@ else()
# Each entry in this list is a set of extra flags to try
# adding to the compile line to see if it helps produce
# a valid identification executable.
+ set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST
+ # Get verbose output to help distinguish compilers.
+ "-v"
+ )
set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS
# Try compiling to an object file only.
"-c"
@@ -111,6 +115,10 @@ endif()
if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(CMAKE_Fortran_COMPILER_ID_RUN 1)
+ # Table of per-vendor compiler output regular expressions.
+ list(APPEND CMAKE_Fortran_COMPILER_ID_MATCH_VENDORS CCur)
+ set(CMAKE_Fortran_COMPILER_ID_MATCH_VENDOR_REGEX_CCur "Concurrent Fortran [0-9]+ Compiler")
+
# Table of per-vendor compiler id flags with expected output.
list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq)
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what")
@@ -119,6 +127,14 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V")
set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler")
+ # Match the link line from xcodebuild output of the form
+ # Ld ...
+ # ...
+ # /path/to/cc ...CompilerIdFortran/...
+ # to extract the compiler front-end for the language.
+ set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdFortran/(\\./)?(CompilerIdFortran.xctest/)?CompilerIdFortran[ \t\n\\\"]")
+ set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
set(_version_info "")
foreach(m MAJOR MINOR PATCH TWEAK)
set(_COMP "_${m}")
diff --git a/Modules/CMakeDetermineSwiftCompiler.cmake b/Modules/CMakeDetermineSwiftCompiler.cmake
new file mode 100644
index 0000000..bff1ae9
--- /dev/null
+++ b/Modules/CMakeDetermineSwiftCompiler.cmake
@@ -0,0 +1,53 @@
+
+#=============================================================================
+# Copyright 2002-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+
+if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
+ if(XCODE_VERSION VERSION_LESS 6.1)
+ message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}")
+ endif()
+ set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift)
+ _cmake_find_compiler_path(Swift)
+else()
+ message(FATAL_ERROR "Swift language not supported by \"${CMAKE_GENERATOR}\" generator")
+endif()
+
+# Build a small source file to identify the compiler.
+if(NOT CMAKE_Swift_COMPILER_ID_RUN)
+ set(CMAKE_Swift_COMPILER_ID_RUN 1)
+
+ list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple)
+ set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler")
+
+ set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwiftSources[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift")
+ set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
+ # Try to identify the compiler.
+ set(CMAKE_Swift_COMPILER_ID)
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(Swift "" CompilerId/main.swift)
+endif()
+
+if (NOT _CMAKE_TOOLCHAIN_LOCATION)
+ get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH)
+endif ()
+
+include(CMakeFindBinUtils)
+
+# configure variables set in this file for fast reload later on
+configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake
+ @ONLY
+ )
diff --git a/Modules/CMakeSwiftCompiler.cmake.in b/Modules/CMakeSwiftCompiler.cmake.in
new file mode 100644
index 0000000..45f0a31
--- /dev/null
+++ b/Modules/CMakeSwiftCompiler.cmake.in
@@ -0,0 +1,5 @@
+set(CMAKE_Swift_COMPILER "@CMAKE_Swift_COMPILER@")
+set(CMAKE_Swift_COMPILER_ID "@CMAKE_Swift_COMPILER_ID@")
+
+set(CMAKE_Swift_COMPILER_ID_RUN 1)
+set(CMAKE_Swift_SOURCE_FILE_EXTENSIONS swift)
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
new file mode 100644
index 0000000..61ad928
--- /dev/null
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# Copyright 2004-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+set(CMAKE_Swift_OUTPUT_EXTENSION .o)
+
+# Load compiler-specific information.
+if(CMAKE_Swift_COMPILER_ID)
+ include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
+endif()
+
+# load the system- and compiler specific files
+if(CMAKE_Swift_COMPILER_ID)
+ # load a hardware specific file, mostly useful for embedded compilers
+ if(CMAKE_SYSTEM_PROCESSOR)
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ endif()
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
+endif()
+
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+if(NOT CMAKE_MODULE_EXISTS)
+ set(CMAKE_SHARED_MODULE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_Swift_FLAGS})
+ set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Swift_FLAGS})
+endif()
+
+include(CMakeCommonLanguageInclude)
+
+set(CMAKE_Swift_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeTestSwiftCompiler.cmake b/Modules/CMakeTestSwiftCompiler.cmake
new file mode 100644
index 0000000..9186426
--- /dev/null
+++ b/Modules/CMakeTestSwiftCompiler.cmake
@@ -0,0 +1,15 @@
+
+#=============================================================================
+# Copyright 2003-2015 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+set(CMAKE_Swift_COMPILER_WORKS 1)
diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake
index 226153c..09cddcd 100644
--- a/Modules/CPackDeb.cmake
+++ b/Modules/CPackDeb.cmake
@@ -352,10 +352,11 @@ function(cpack_deb_prepare_package_vars)
OUTPUT_VARIABLE _TMP_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX MATCH "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)"
- SHLIBDEPS_EXECUTABLE_VERSION
- "${_TMP_VERSION}")
- set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
+ if(_TMP_VERSION MATCHES "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)")
+ set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}")
+ else()
+ set(SHLIBDEPS_EXECUTABLE_VERSION "")
+ endif()
if(CPACK_DEBIAN_PACKAGE_DEBUG)
message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'")
@@ -398,9 +399,12 @@ function(cpack_deb_prepare_package_vars)
file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian)
file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "")
- # only set ignore-missing-info flag for dpkg-shlibdeps that have --version option
- # (those are newer and also have --ignore-missing-info flag)
- if(SHLIBDEPS_EXECUTABLE_VERSION)
+ # Add --ignore-missing-info if the tool supports it
+ execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --help
+ OUTPUT_VARIABLE _TMP_HELP
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(_TMP_HELP MATCHES "--ignore-missing-info")
set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info")
endif()
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index 750e4fb..53f3454 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -13,7 +13,7 @@
# Will be created as an internal cache variable.
#
# This internally calls the check_c_source_compiles macro and sets
-# CMAKE_REQUIRED_FLAGS to <flag>. See help for
+# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
# CheckCSourceCompiles for a listing of variables that can otherwise
# modify the build. The result only tells that the compiler does not
# give an error message when it encounters the flag. If the flag has
@@ -38,8 +38,8 @@ include(CheckCSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
+ set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
# Normalize locale during test compilation.
set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
@@ -60,5 +60,5 @@ macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
unset(_CheckCCompilerFlag_LOCALE_VARS)
unset(_CheckCCompilerFlag_COMMON_PATTERNS)
- set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index 71b3fd2..fab3a05 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -12,7 +12,7 @@
# <var> - variable to store the result
#
# This internally calls the check_cxx_source_compiles macro and sets
-# CMAKE_REQUIRED_FLAGS to <flag>. See help for
+# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
# CheckCXXSourceCompiles for a listing of variables that can otherwise
# modify the build. The result only tells that the compiler does not
# give an error message when it encounters the flag. If the flag has
@@ -37,8 +37,8 @@ include(CheckCXXSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
+ set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
# Normalize locale during test compilation.
set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
@@ -59,6 +59,6 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
unset(_CheckCXXCompilerFlag_LOCALE_VARS)
unset(_CheckCXXCompilerFlag_COMMON_PATTERNS)
- set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
index c476661..53fd8d6 100644
--- a/Modules/CheckFortranCompilerFlag.cmake
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -13,7 +13,7 @@
# Will be created as an internal cache variable.
#
# This internally calls the check_fortran_source_compiles macro and
-# sets CMAKE_REQUIRED_FLAGS to <flag>. See help for
+# sets CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for
# CheckFortranSourceCompiles for a listing of variables that can
# otherwise modify the build. The result only tells that the compiler
# does not give an error message when it encounters the flag. If the
@@ -40,8 +40,8 @@ include(CheckFortranSourceCompiles)
include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
- set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
+ set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+ set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
# Normalize locale during test compilation.
set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
@@ -62,5 +62,5 @@ macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
unset(_CheckFortranCompilerFlag_LOCALE_VARS)
unset(_CheckFortranCompilerFlag_COMMON_PATTERNS)
- set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+ set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index 402b37c..ef1e39d 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -2,30 +2,34 @@
# CheckIncludeFile
# ----------------
#
-# macro which checks the include file exists.
+# Provides a macro to check if a header file can be included in ``C``.
#
-# CHECK_INCLUDE_FILE(INCLUDE VARIABLE)
+# .. command:: CHECK_INCLUDE_FILE
#
-# ::
+# ::
#
-# INCLUDE - name of include file
-# VARIABLE - variable to return result
-# Will be created as an internal cache variable.
+# CHECK_INCLUDE_FILE(<include> <variable> [<flags>])
#
-#
-#
-# an optional third argument is the CFlags to add to the compile line or
-# you can use CMAKE_REQUIRED_FLAGS
+# Check if the given ``<include>`` file may be included in a ``C``
+# source file and store the result in an internal cache entry named
+# ``<variable>``. The optional third argument may be used to add
+# compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below).
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
#
-# ::
+# ``CMAKE_REQUIRED_FLAGS``
+# string of compile command line flags
+# ``CMAKE_REQUIRED_DEFINITIONS``
+# list of macros to define (-DFOO=bar)
+# ``CMAKE_REQUIRED_INCLUDES``
+# list of include directories
+# ``CMAKE_REQUIRED_QUIET``
+# execute quietly without messages
#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+# See the :module:`CheckIncludeFiles` module to check for multiple headers
+# at once. See the :module:`CheckIncludeFileCXX` module to check for headers
+# using the ``CXX`` language.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index eae1730..9a6df3b 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -2,34 +2,33 @@
# CheckIncludeFileCXX
# -------------------
#
-# Check if the include file exists.
+# Provides a macro to check if a header file can be included in ``CXX``.
#
-# ::
+# .. command:: CHECK_INCLUDE_FILE_CXX
#
-# CHECK_INCLUDE_FILE_CXX(INCLUDE VARIABLE)
+# ::
#
+# CHECK_INCLUDE_FILE_CXX(<include> <variable> [<flags>])
#
-#
-# ::
-#
-# INCLUDE - name of include file
-# VARIABLE - variable to return result
-# Will be created as an internal cache variable.
-#
-#
-#
-# An optional third argument is the CFlags to add to the compile line or
-# you can use CMAKE_REQUIRED_FLAGS.
+# Check if the given ``<include>`` file may be included in a ``CXX``
+# source file and store the result in an internal cache entry named
+# ``<variable>``. The optional third argument may be used to add
+# compilation flags to the check (or use ``CMAKE_REQUIRED_FLAGS`` below).
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
#
-# ::
+# ``CMAKE_REQUIRED_FLAGS``
+# string of compile command line flags
+# ``CMAKE_REQUIRED_DEFINITIONS``
+# list of macros to define (-DFOO=bar)
+# ``CMAKE_REQUIRED_INCLUDES``
+# list of include directories
+# ``CMAKE_REQUIRED_QUIET``
+# execute quietly without messages
#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
+# to check for one or more ``C`` headers.
#=============================================================================
# Copyright 2002-2009 Kitware, Inc.
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 2494862..843cd35 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -2,29 +2,34 @@
# CheckIncludeFiles
# -----------------
#
-# Check if the files can be included
+# Provides a macro to check if a list of one or more header files can
+# be included together in ``C``.
#
+# .. command:: CHECK_INCLUDE_FILES
#
+# ::
#
-# CHECK_INCLUDE_FILES(INCLUDE VARIABLE)
-#
-# ::
-#
-# INCLUDE - list of files to include
-# VARIABLE - variable to return result
-# Will be created as an internal cache variable.
-#
+# CHECK_INCLUDE_FILES("<includes>" <variable>)
#
+# Check if the given ``<includes>`` list may be included together
+# in a ``C`` source file and store the result in an internal cache
+# entry named ``<variable>``. Specify the ``<includes>`` argument
+# as a :ref:`;-list <CMake Language Lists>` of header file names.
#
# The following variables may be set before calling this macro to modify
# the way the check is run:
#
-# ::
+# ``CMAKE_REQUIRED_FLAGS``
+# string of compile command line flags
+# ``CMAKE_REQUIRED_DEFINITIONS``
+# list of macros to define (-DFOO=bar)
+# ``CMAKE_REQUIRED_INCLUDES``
+# list of include directories
+# ``CMAKE_REQUIRED_QUIET``
+# execute quietly without messages
#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-# CMAKE_REQUIRED_QUIET = execute quietly without messages
+# See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
+# to check for a single header file in ``C`` or ``CXX`` languages.
#=============================================================================
# Copyright 2003-2012 Kitware, Inc.
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 5194da4..1ba8a77 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -13,7 +13,10 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
# AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
diff --git a/Modules/Compiler/CCur-Fortran.cmake b/Modules/Compiler/CCur-Fortran.cmake
new file mode 100644
index 0000000..6ec06ae
--- /dev/null
+++ b/Modules/Compiler/CCur-Fortran.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-Fortran)
diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake
index 07507f9..212179e 100644
--- a/Modules/Compiler/XL-ASM.cmake
+++ b/Modules/Compiler/XL-ASM.cmake
@@ -1,9 +1,8 @@
set(CMAKE_ASM_VERBOSE_FLAG "-V")
# -qthreaded = Ensures that all optimizations will be thread-safe
-# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer)
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler")
+set(CMAKE_ASM_FLAGS_INIT "-qthreaded -qhalt=e -qsourcetype=assembler")
set(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
set(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG")
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index 09a5529..97dd017 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -4,6 +4,5 @@ set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG")
# -qthreaded = Ensures that all optimizations will be thread-safe
-# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer)
# -qhalt=e = Halt on error messages (rather than just severe errors)
-set(CMAKE_C_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e")
+set(CMAKE_C_FLAGS_INIT "-qthreaded -qhalt=e")
diff --git a/Modules/CompilerId/main.swift.in b/Modules/CompilerId/main.swift.in
new file mode 100644
index 0000000..962e857
--- /dev/null
+++ b/Modules/CompilerId/main.swift.in
@@ -0,0 +1 @@
+println("CMakeSwiftCompilerId")
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 37a0a40..918b407 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -95,6 +95,10 @@ SlurmRunCommand: @SLURM_SRUN_COMMAND@
# Currently set to 25 minutes
TimeOut: @DART_TESTING_TIMEOUT@
+# During parallel testing CTest will not start a new test if doing
+# so would cause the system load to exceed this value.
+TestLoad: @CTEST_TEST_LOAD@
+
UseLaunchers: @CTEST_USE_LAUNCHERS@
CurlOptions: @CTEST_CURL_OPTIONS@
# warning, if you add new options here that have to do with submit,
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 11a24b8..f6844be 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -175,6 +175,23 @@ Create custom targets to build projects in external trees
``LOG_INSTALL 1``
Wrap install in script to log output
+ Steps can be given direct access to the terminal if possible. With
+ the :generator:`Ninja` generator, this places the steps in the
+ ``console`` :prop_gbl:`pool <JOB_POOLS>`. Options are:
+
+ ``USES_TERMINAL_DOWNLOAD 1``
+ Give download terminal access.
+ ``USES_TERMINAL_UPDATE 1``
+ Give update terminal access.
+ ``USES_TERMINAL_CONFIGURE 1``
+ Give configure terminal access.
+ ``USES_TERMINAL_BUILD 1``
+ Give build terminal access.
+ ``USES_TERMINAL_TEST 1``
+ Give test terminal access.
+ ``USES_TERMINAL_INSTALL 1``
+ Give install terminal access.
+
Other options are:
``STEP_TARGETS <step-target>...``
@@ -256,6 +273,8 @@ Create custom targets to build projects in external trees
Working directory for command
``LOG 1``
Wrap step in script to log output
+ ``USES_TERMINAL 1``
+ Give the step direct access to the terminal if possible.
The command line, comment, working directory, and byproducts of every
standard and custom step are processed to replace tokens ``<SOURCE_DIR>``,
@@ -529,7 +548,7 @@ if(error_code)
endif()
execute_process(
- COMMAND \"${git_EXECUTABLE}\" submodule init
+ COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules}
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
@@ -1463,6 +1482,14 @@ function(ExternalProject_Add_Step name step)
get_property(comment TARGET ${name} PROPERTY _EP_${step}_COMMENT)
endif()
+ # Uses terminal?
+ get_property(uses_terminal TARGET ${name} PROPERTY _EP_${step}_USES_TERMINAL)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL)
+ else()
+ set(uses_terminal "")
+ endif()
+
# Run every time?
get_property(always TARGET ${name} PROPERTY _EP_${step}_ALWAYS)
if(always)
@@ -1505,6 +1532,7 @@ function(ExternalProject_Add_Step name step)
DEPENDS ${depends}
WORKING_DIRECTORY ${work_dir}
VERBATIM
+ ${uses_terminal}
)
set_property(TARGET ${name} APPEND PROPERTY _EP_STEPS ${step})
@@ -1890,6 +1918,14 @@ function(_ep_add_download_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_DOWNLOAD)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} download
COMMENT ${comment}
COMMAND ${cmd}
@@ -1897,6 +1933,7 @@ function(_ep_add_download_command name)
DEPENDS ${depends}
DEPENDEES mkdir
${log}
+ ${uses_terminal}
)
endfunction()
@@ -2001,6 +2038,14 @@ Update to Mercurial >= 2.1.1.
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_UPDATE)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} update
COMMENT ${comment}
COMMAND ${cmd}
@@ -2009,6 +2054,7 @@ Update to Mercurial >= 2.1.1.
WORKING_DIRECTORY ${work_dir}
DEPENDEES download
${log}
+ ${uses_terminal}
)
if(always AND update_disconnected)
@@ -2021,6 +2067,7 @@ Update to Mercurial >= 2.1.1.
WORKING_DIRECTORY ${work_dir}
DEPENDEES download
${log}
+ ${uses_terminal}
)
set_property(SOURCE ${skip-update_stamp_file} PROPERTY SYMBOLIC 1)
endif()
@@ -2149,6 +2196,14 @@ function(_ep_add_configure_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_CONFIGURE)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET)
if(update_disconnected_set)
get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED)
@@ -2167,6 +2222,7 @@ function(_ep_add_configure_command name)
DEPENDEES ${update_dep} patch
DEPENDS ${file_deps}
${log}
+ ${uses_terminal}
)
endfunction()
@@ -2188,6 +2244,14 @@ function(_ep_add_build_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_BUILD)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS)
if(build_always)
set(always 1)
@@ -2204,6 +2268,7 @@ function(_ep_add_build_command name)
DEPENDEES configure
ALWAYS ${always}
${log}
+ ${uses_terminal}
)
endfunction()
@@ -2225,11 +2290,20 @@ function(_ep_add_install_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_INSTALL)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} install
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
DEPENDEES build
${log}
+ ${uses_terminal}
)
endfunction()
@@ -2277,6 +2351,14 @@ function(_ep_add_test_command name)
set(log "")
endif()
+ get_property(uses_terminal TARGET ${name} PROPERTY
+ _EP_USES_TERMINAL_TEST)
+ if(uses_terminal)
+ set(uses_terminal USES_TERMINAL 1)
+ else()
+ set(uses_terminal "")
+ endif()
+
ExternalProject_Add_Step(${name} test
COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir}
@@ -2284,6 +2366,7 @@ function(_ep_add_test_command name)
${dependers_args}
${exclude_args}
${log}
+ ${uses_terminal}
)
endif()
endfunction()
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index ec3ee78..7d81276 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -2,60 +2,75 @@
# FindBISON
# ---------
#
-# Find bison executable and provides macros to generate custom build rules
+# Find ``bison`` executable and provide a macro to generate custom build rules.
#
# The module defines the following variables:
#
-# ::
+# ``BISON_EXECUTABLE``
+# path to the ``bison`` program
#
-# BISON_EXECUTABLE - path to the bison program
-# BISON_VERSION - version of bison
-# BISON_FOUND - true if the program was found
+# ``BISON_VERSION``
+# version of ``bison``
#
+# ``BISON_FOUND``
+# true if the program was found
#
+# The minimum required version of ``bison`` can be specified using the
+# standard CMake syntax, e.g. ``find_package(BISON 2.1.3)``.
#
-# The minimum required version of bison can be specified using the
-# standard CMake syntax, e.g. find_package(BISON 2.1.3)
+# If ``bison`` is found, the module defines the macro::
#
-# If bison is found, the module defines the macros:
+# BISON_TARGET(<Name> <YaccInput> <CodeOutput>
+# [COMPILE_FLAGS <flags>]
+# [DEFINES_FILE <file>]
+# [VERBOSE <file>]
+# )
#
-# ::
+# which will create a custom rule to generate a parser. ``<YaccInput>`` is
+# the path to a yacc file. ``<CodeOutput>`` is the name of the source file
+# generated by bison. A header file is also be generated, and contains
+# the token list.
#
-# BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>]
-# [COMPILE_FLAGS <string>])
+# The options are:
#
-# which will create a custom rule to generate a parser. <YaccInput> is
-# the path to a yacc file. <CodeOutput> is the name of the source file
-# generated by bison. A header file is also be generated, and contains
-# the token list. If COMPILE_FLAGS option is specified, the next
-# parameter is added in the bison command line. if VERBOSE option is
-# specified, <file> is created and contains verbose descriptions of the
-# grammar and parser. The macro defines a set of variables:
+# ``COMPILE_FLAGS <flags>``
+# Specify flags to be added to the ``bison`` command line.
+#
+# ``DEFINES_FILE <file>``
+# Specify a non-default header ``<file>`` to be generated by ``bison``.
+#
+# ``VERBOSE <file>``
+# Tell ``bison`` to write verbose descriptions of the grammar and
+# parser to the given ``<file>``.
#
-# ::
+# The macro defines the following variables:
#
-# BISON_${Name}_DEFINED - true is the macro ran successfully
-# BISON_${Name}_INPUT - The input source file, an alias for <YaccInput>
-# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison
-# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison
-# BISON_${Name}_OUTPUTS - The sources files generated by bison
-# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line
+# ``BISON_<Name>_DEFINED``
+# true is the macro ran successfully
#
+# ``BISON_<Name>_INPUT``
+# The input source file, an alias for <YaccInput>
#
+# ``BISON_<Name>_OUTPUT_SOURCE``
+# The source file generated by bison
#
-# ::
+# ``BISON_<Name>_OUTPUT_HEADER``
+# The header file generated by bison
#
-# ====================================================================
-# Example:
+# ``BISON_<Name>_OUTPUTS``
+# The sources files generated by bison
#
+# ``BISON_<Name>_COMPILE_FLAGS``
+# Options used in the ``bison`` command line
#
+# Example usage:
#
-# ::
+# .. code-block:: cmake
#
-# find_package(BISON)
-# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
-# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
-# ====================================================================
+# find_package(BISON)
+# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
+# DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h)
+# add_executable(Foo main.cpp ${BISON_MyParser_OUTPUTS})
#=============================================================================
# Copyright 2009 Kitware, Inc.
@@ -74,6 +89,8 @@
find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
mark_as_advanced(BISON_EXECUTABLE)
+include(CMakeParseArguments)
+
if(BISON_EXECUTABLE)
# the bison commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated
@@ -128,6 +145,12 @@ if(BISON_EXECUTABLE)
list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
endmacro()
+ # internal macro
+ macro(BISON_TARGET_option_defines Header)
+ set(BISON_TARGET_output_header "${Header}")
+ list(APPEND BISON_TARGET_cmdopt --defines=${BISON_TARGET_output_header})
+ endmacro()
+
#============================================================
# BISON_TARGET (public macro)
#============================================================
@@ -136,51 +159,61 @@ if(BISON_EXECUTABLE)
set(BISON_TARGET_output_header "")
set(BISON_TARGET_cmdopt "")
set(BISON_TARGET_outputs "${BisonOutput}")
- if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+
+ # Parsing parameters
+ set(BISON_TARGET_PARAM_OPTIONS)
+ set(BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS
+ VERBOSE
+ COMPILE_FLAGS
+ DEFINES_FILE
+ )
+ set(BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS)
+ cmake_parse_arguments(
+ BISON_TARGET_ARG
+ "${BISON_TARGET_PARAM_OPTIONS}"
+ "${BISON_TARGET_PARAM_ONE_VALUE_KEYWORDS}"
+ "${BISON_TARGET_PARAM_MULTI_VALUE_KEYWORDS}"
+ ${ARGN}
+ )
+
+ if(NOT "${BISON_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
message(SEND_ERROR "Usage")
else()
- # Parsing parameters
- if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
- if("${ARGV3}" STREQUAL "VERBOSE")
- BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
- endif()
- if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
- BISON_TARGET_option_extraopts("${ARGV4}")
- endif()
+ if(NOT "${BISON_TARGET_ARG_VERBOSE}" STREQUAL "")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${BISON_TARGET_ARG_VERBOSE}")
endif()
-
- if(${ARGC} EQUAL 7)
- if("${ARGV5}" STREQUAL "VERBOSE")
- BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
- endif()
-
- if("${ARGV5}" STREQUAL "COMPILE_FLAGS")
- BISON_TARGET_option_extraopts("${ARGV6}")
- endif()
+ if(NOT "${BISON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
+ BISON_TARGET_option_extraopts("${BISON_TARGET_ARG_COMPILE_FLAGS}")
+ endif()
+ if(NOT "${BISON_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
+ BISON_TARGET_option_defines("${BISON_TARGET_ARG_DEFINES_FILE}")
endif()
- # Header's name generated by bison (see option -d)
- list(APPEND BISON_TARGET_cmdopt "-d")
- string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
- string(REPLACE "c" "h" _fileext ${_fileext})
- string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
- BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
- list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
+ if("${BISON_TARGET_output_header}" STREQUAL "")
+ # Header's name generated by bison (see option -d)
+ list(APPEND BISON_TARGET_cmdopt "-d")
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${BisonOutput}")
+ string(REPLACE "c" "h" _fileext ${_fileext})
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ BISON_TARGET_output_header "${BisonOutput}")
+ endif()
+ list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}")
add_custom_command(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE}
- ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
- DEPENDS ${ARGV1}
+ ARGS ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
+ DEPENDS ${BisonInput}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# define target variables
set(BISON_${Name}_DEFINED TRUE)
- set(BISON_${Name}_INPUT ${ARGV1})
+ set(BISON_${Name}_INPUT ${BisonInput})
set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+ set(BISON_${Name}_OUTPUT_HEADER "${BISON_TARGET_output_header}")
endif()
endmacro()
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index e8e1fb1..f4b0783 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -468,17 +468,31 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
else()
- # Using cc which is symlink to clang may let NVCC think it is GCC and issue
- # unhandled -dumpspecs option to clang. Also in case neither
- # CMAKE_C_COMPILER is defined (project does not use C language) nor
- # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let
- # nvcc use its own default C compiler.
- if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER)
- get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH)
+ if(APPLE
+ AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang"
+ AND "${CMAKE_C_COMPILER}" MATCHES "/cc$")
+ # Using cc which is symlink to clang may let NVCC think it is GCC and issue
+ # unhandled -dumpspecs option to clang. Also in case neither
+ # CMAKE_C_COMPILER is defined (project does not use C language) nor
+ # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let
+ # nvcc use its own default C compiler.
+ # Only care about this on APPLE with clang to avoid
+ # following symlinks to things like ccache
+ if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER)
+ get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH)
+ # if the real path does not end up being clang then
+ # go back to using CMAKE_C_COMPILER
+ if(NOT "${c_compiler_realpath}" MATCHES "/clang$")
+ set(c_compiler_realpath "${CMAKE_C_COMPILER}")
+ endif()
+ else()
+ set(c_compiler_realpath "")
+ endif()
+ set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
else()
- set(c_compiler_realpath "")
+ set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}"
+ CACHE FILEPATH "Host side compiler used by NVCC")
endif()
- set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
endif()
# Propagate the host flags to the host compiler via -Xcompiler
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
index 8493d80..3fa6cab 100644
--- a/Modules/FindIce.cmake
+++ b/Modules/FindIce.cmake
@@ -20,7 +20,14 @@
# Ice_SLICE_DIRS - the directories containing the Ice slice interface
# definitions
#
-# Ice programs are reported in::
+# Imported targets::
+#
+# Ice::<C>
+#
+# Where ``<C>`` is the name of an Ice component, for example
+# ``Ice::Glacier2``.
+#
+# Ice slice programs are reported in::
#
# Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
# Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
@@ -28,10 +35,49 @@
# Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
# Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
# Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
+# Ice_SLICE2JS_EXECUTABLE - path to slice2js executable
# Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
# Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
# Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
#
+# Ice programs are reported in::
+#
+# Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable
+# Ice_ICEBOX_EXECUTABLE - path to icebox executable
+# Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable
+# Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable
+# Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable
+# Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable
+# Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable
+# Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable
+# Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable
+# Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable
+# Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable
+# Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable
+# Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable
+# Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable
+# Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable
+# Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable
+#
+# Ice db programs (Windows only; standard system versions on all other
+# platforms) are reported in::
+#
+# Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable
+# Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable
+# Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable
+# Ice_DB_DUMP_EXECUTABLE - path to db_dump executable
+# Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable
+# Ice_DB_LOAD_EXECUTABLE - path to db_load executable
+# Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable
+# Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable
+# Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable
+# Ice_DB_STAT_EXECUTABLE - path to db_stat executable
+# Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable
+# Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable
+# Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable
+# Ice_DUMPDB_EXECUTABLE - path to dumpdb executable
+# Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable
+#
# Ice component libraries are reported in::
#
# Ice_<C>_FOUND - ON if component was found
@@ -76,7 +122,7 @@
# Written by Roger Leigh <rleigh@codelibre.net>
#=============================================================================
-# Copyright 2014 University of Dundee
+# Copyright 2014-2015 University of Dundee
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -94,6 +140,8 @@ function(_Ice_FIND)
# Released versions of Ice, including generic short forms
set(ice_versions
3
+ 3.6
+ 3.6.0
3.5
3.5.1
3.5.0
@@ -198,19 +246,55 @@ function(_Ice_FIND)
endforeach()
endif()
+ set(db_programs
+ db_archive
+ db_checkpoint
+ db_deadlock
+ db_dump
+ db_hotbackup
+ db_load
+ db_log_verify
+ db_printlog
+ db_recover
+ db_stat
+ db_tuner
+ db_upgrade
+ db_verify
+ dumpdb
+ transformdb)
+
set(ice_programs
+ glacier2router
+ icebox
+ iceboxadmin
+ iceboxd
+ iceboxnet
+ icegridadmin
+ icegridnode
+ icegridnoded
+ icegridregistry
+ icegridregistryd
+ icepatch2calc
+ icepatch2client
+ icepatch2server
+ iceserviceinstall
+ icestormadmin
+ icestormmigrate)
+
+ set(slice_programs
slice2cpp
slice2cs
slice2freezej
slice2freeze
slice2html
slice2java
+ slice2js
slice2php
slice2py
slice2rb)
# Find all Ice programs
- foreach(program ${ice_programs})
+ foreach(program ${db_programs} ${ice_programs} ${slice_programs})
string(TOUPPER "${program}" program_upcase)
set(cache_var "Ice_${program_upcase}_EXECUTABLE")
set(program_var "Ice_${program_upcase}_EXECUTABLE")
@@ -356,13 +440,21 @@ if(Ice_FOUND)
set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY")
set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES")
set(_Ice_component_found "${_Ice_component_upcase}_FOUND")
+ set(_Ice_imported_target "Ice::${_Ice_component}")
if(${_Ice_component_found})
set("${_Ice_component_lib}" "${${_Ice_component_cache}}")
+ if(NOT TARGET ${_Ice_imported_target})
+ add_library(${_Ice_imported_target} UNKNOWN IMPORTED)
+ set_target_properties(${_Ice_imported_target} PROPERTIES
+ IMPORTED_LOCATION "${${_Ice_component_cache}}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIR}")
+ endif()
endif()
unset(_Ice_component_upcase)
unset(_Ice_component_cache)
unset(_Ice_component_lib)
unset(_Ice_component_found)
+ unset(_Ice_imported_target)
endforeach()
endif()
@@ -373,15 +465,51 @@ if(Ice_DEBUG)
message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}")
message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}")
message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}")
+
message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}")
message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}")
message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}")
message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}")
message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}")
message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}")
+ message(STATUS "slice2js executable: ${Ice_SLICE2JS_EXECUTABLE}")
message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}")
message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}")
message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}")
+ message(STATUS "glacier2router executable: ${Ice_GLACIER2ROUTER_EXECUTABLE}")
+
+ message(STATUS "icebox executable: ${Ice_ICEBOX_EXECUTABLE}")
+ message(STATUS "iceboxadmin executable: ${Ice_ICEBOXADMIN_EXECUTABLE}")
+ message(STATUS "iceboxd executable: ${Ice_ICEBOXD_EXECUTABLE}")
+ message(STATUS "iceboxnet executable: ${Ice_ICEBOXNET_EXECUTABLE}")
+ message(STATUS "icegridadmin executable: ${Ice_ICEGRIDADMIN_EXECUTABLE}")
+ message(STATUS "icegridnode executable: ${Ice_ICEGRIDNODE_EXECUTABLE}")
+ message(STATUS "icegridnoded executable: ${Ice_ICEGRIDNODED_EXECUTABLE}")
+ message(STATUS "icegridregistry executable: ${Ice_ICEGRIDREGISTRY_EXECUTABLE}")
+ message(STATUS "icegridregistryd executable: ${Ice_ICEGRIDREGISTRYD_EXECUTABLE}")
+ message(STATUS "icepatch2calc executable: ${Ice_ICEPATCH2CALC_EXECUTABLE}")
+ message(STATUS "icepatch2client executable: ${Ice_ICEPATCH2CLIENT_EXECUTABLE}")
+ message(STATUS "icepatch2server executable: ${Ice_ICEPATCH2SERVER_EXECUTABLE}")
+ message(STATUS "iceserviceinstall executable: ${Ice_ICESERVICEINSTALL_EXECUTABLE}")
+ message(STATUS "icestormadmin executable: ${Ice_ICESTORMADMIN_EXECUTABLE}")
+ message(STATUS "icestormmigrate executable: ${Ice_ICESTORMMIGRATE_EXECUTABLE}")
+
+ message(STATUS "db_archive executable: ${Ice_DB_ARCHIVE_EXECUTABLE}")
+ message(STATUS "db_checkpoint executable: ${Ice_DB_CHECKPOINT_EXECUTABLE}")
+ message(STATUS "db_deadlock executable: ${Ice_DB_DEADLOCK_EXECUTABLE}")
+ message(STATUS "db_dump executable: ${Ice_DB_DUMP_EXECUTABLE}")
+ message(STATUS "db_hotbackup executable: ${Ice_DB_HOTBACKUP_EXECUTABLE}")
+ message(STATUS "db_load executable: ${Ice_DB_LOAD_EXECUTABLE}")
+ message(STATUS "db_log_verify executable: ${Ice_DB_LOG_VERIFY_EXECUTABLE}")
+ message(STATUS "db_printlog executable: ${Ice_DB_PRINTLOG_EXECUTABLE}")
+ message(STATUS "db_recover executable: ${Ice_DB_RECOVER_EXECUTABLE}")
+ message(STATUS "db_stat executable: ${Ice_DB_STAT_EXECUTABLE}")
+ message(STATUS "db_tuner executable: ${Ice_DB_TUNER_EXECUTABLE}")
+ message(STATUS "db_upgrade executable: ${Ice_DB_UPGRADE_EXECUTABLE}")
+ message(STATUS "db_verify executable: ${Ice_DB_VERIFY_EXECUTABLE}")
+ message(STATUS "dumpdb executable: ${Ice_DUMPDB_EXECUTABLE}")
+ message(STATUS "transformdb executable: ${Ice_TRANSFORMDB_EXECUTABLE}")
+
foreach(component ${Ice_FIND_COMPONENTS})
string(TOUPPER "${component}" component_upcase)
set(component_lib "Ice_${component_upcase}_LIBRARIES")
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 028bf5a..a47a69c 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -55,7 +55,7 @@
# returning an exit code can be used as well (0 indicating a success).
#
# Module Input Variables
-# ----------------------
+# ^^^^^^^^^^^^^^^^^^^^^^
#
# Users or projects may set the following variables to configure the module
# behaviour:
@@ -69,10 +69,10 @@
# versions.
#
# Variables defined by the module
-# -------------------------------
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Result variables
-# ^^^^^^^^^^^^^^^^
+# """"""""""""""""
#
# ``Matlab_FOUND``
# ``TRUE`` if the Matlab installation is found, ``FALSE``
@@ -100,7 +100,7 @@
# Available only if the component ``MEX_COMPILER`` is asked
#
# Cached variables
-# ^^^^^^^^^^^^^^^^
+# """"""""""""""""
#
# ``Matlab_MEX_EXTENSION``
# the extension of the mex files for the current platform (given by Matlab).
@@ -109,7 +109,7 @@
# is changed by the user, the result variables are recomputed.
#
# Provided macros
-# ---------------
+# ^^^^^^^^^^^^^^^
#
# :command:`matlab_get_version_from_release_name`
# returns the version from the release name
@@ -117,7 +117,7 @@
# returns the release name from the Matlab version
#
# Provided functions
-# ------------------
+# ^^^^^^^^^^^^^^^^^^
#
# :command:`matlab_add_mex`
# adds a target compiling a MEX file.
@@ -139,7 +139,7 @@
#
#
# Known issues
-# ------------
+# ^^^^^^^^^^^^
#
# **Symbol clash in a MEX target**
# By default, every symbols inside a MEX
@@ -166,7 +166,7 @@
#
#
# Reference
-# --------------
+# ^^^^^^^^^
#
# .. variable:: Matlab_ROOT_DIR
#
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index cc875ad..b80d3ce 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -53,6 +53,15 @@ include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
# Search for the python framework on Apple.
CMAKE_FIND_FRAMEWORKS(Python)
+# Save CMAKE_FIND_FRAMEWORK
+if(DEFINED CMAKE_FIND_FRAMEWORK)
+ set(_PythonLibs_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+else()
+ unset(_PythonLibs_CMAKE_FIND_FRAMEWORK)
+endif()
+# To avoid picking up the system Python.h pre-maturely.
+set(CMAKE_FIND_FRAMEWORK LAST)
+
set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)
@@ -111,14 +120,22 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
)
endif()
+ set(PYTHON_FRAMEWORK_LIBRARIES)
+ if(Python_FRAMEWORKS AND NOT PYTHON_LIBRARY)
+ foreach(dir ${Python_FRAMEWORKS})
+ list(APPEND PYTHON_FRAMEWORK_LIBRARIES
+ ${dir}/Versions/${_CURRENT_VERSION}/lib)
+ endforeach()
+ endif()
find_library(PYTHON_LIBRARY
NAMES
- python${_CURRENT_VERSION_NO_DOTS}
- python${_CURRENT_VERSION}mu
- python${_CURRENT_VERSION}m
- python${_CURRENT_VERSION}u
- python${_CURRENT_VERSION}
+ python${_CURRENT_VERSION_NO_DOTS}
+ python${_CURRENT_VERSION}mu
+ python${_CURRENT_VERSION}m
+ python${_CURRENT_VERSION}u
+ python${_CURRENT_VERSION}
PATHS
+ ${PYTHON_FRAMEWORK_LIBRARIES}
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
# Avoid finding the .dll in the PATH. We want the .lib.
@@ -143,8 +160,8 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
set(PYTHON_FRAMEWORK_INCLUDES)
if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
foreach(dir ${Python_FRAMEWORKS})
- set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
- ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION})
+ list(APPEND PYTHON_FRAMEWORK_INCLUDES
+ ${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION})
endforeach()
endif()
@@ -201,6 +218,14 @@ SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
# for historical reasons.
unset(PYTHON_FOUND)
+# Restore CMAKE_FIND_FRAMEWORK
+if(DEFINED _PythonLibs_CMAKE_FIND_FRAMEWORK)
+ set(CMAKE_FIND_FRAMEWORK ${_PythonLibs_CMAKE_FIND_FRAMEWORK})
+ unset(_PythonLibs_CMAKE_FIND_FRAMEWORK)
+else()
+ unset(CMAKE_FIND_FRAMEWORK)
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index 5a8ea9d..984f1b9 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -62,7 +62,7 @@ find_path(XercesC_INCLUDE_DIR
mark_as_advanced(XercesC_INCLUDE_DIR)
# Find all XercesC libraries
-find_library(XercesC_LIBRARY "xerces-c"
+find_library(XercesC_LIBRARY NAMES "xerces-c" "xerces-c_3"
DOC "Xerces-C++ libraries")
mark_as_advanced(XercesC_LIBRARY)
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index c16c011..9a70678 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -740,7 +740,8 @@ else()
# UNIX: Start actual work.
#-----------------------------------------------------------------
# Support cross-compiling, only search in the target platform.
- find_program(wxWidgets_CONFIG_EXECUTABLE wx-config wx-config-3.0
+ find_program(wxWidgets_CONFIG_EXECUTABLE
+ NAMES wx-config wx-config-3.0 wx-config-2.9 wx-config-2.8
DOC "Location of wxWidgets library configuration provider binary (wx-config)."
ONLY_CMAKE_FIND_ROOT_PATH
)
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index c61e7e9..b42084e 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -4,59 +4,104 @@
#
# Define GNU standard installation directories
#
-# Provides install directory variables as defined for GNU software:
+# Provides install directory variables as defined by the
+# `GNU Coding Standards`_.
#
-# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+# .. _`GNU Coding Standards`: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
#
# Inclusion of this module defines the following variables:
#
# ``CMAKE_INSTALL_<dir>``
-# destination for files of a given type
+#
+# Destination for files of a given type. This value may be passed to
+# the ``DESTINATION`` options of :command:`install` commands for the
+# corresponding file type.
+#
# ``CMAKE_INSTALL_FULL_<dir>``
-# corresponding absolute path
#
-# where <dir> is one of:
+# The absolute path generated from the corresponding ``CMAKE_INSTALL_<dir>``
+# value. If the value is not already an absolute path, an absolute path
+# is constructed typically by prepending the value of the
+# :variable:`CMAKE_INSTALL_PREFIX` variable. However, there are some
+# `special cases`_ as documented below.
+#
+# where ``<dir>`` is one of:
#
# ``BINDIR``
-# user executables (bin)
+# user executables (``bin``)
# ``SBINDIR``
-# system admin executables (sbin)
+# system admin executables (``sbin``)
# ``LIBEXECDIR``
-# program executables (libexec)
+# program executables (``libexec``)
# ``SYSCONFDIR``
-# read-only single-machine data (etc)
+# read-only single-machine data (``etc``)
# ``SHAREDSTATEDIR``
-# modifiable architecture-independent data (com)
+# modifiable architecture-independent data (``com``)
# ``LOCALSTATEDIR``
-# modifiable single-machine data (var)
+# modifiable single-machine data (``var``)
# ``LIBDIR``
-# object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
+# object code libraries (``lib`` or ``lib64``
+# or ``lib/<multiarch-tuple>`` on Debian)
# ``INCLUDEDIR``
-# C header files (include)
+# C header files (``include``)
# ``OLDINCLUDEDIR``
-# C header files for non-gcc (/usr/include)
+# C header files for non-gcc (``/usr/include``)
# ``DATAROOTDIR``
-# read-only architecture-independent data root (share)
+# read-only architecture-independent data root (``share``)
# ``DATADIR``
-# read-only architecture-independent data (DATAROOTDIR)
+# read-only architecture-independent data (``DATAROOTDIR``)
# ``INFODIR``
-# info documentation (DATAROOTDIR/info)
+# info documentation (``DATAROOTDIR/info``)
# ``LOCALEDIR``
-# locale-dependent data (DATAROOTDIR/locale)
+# locale-dependent data (``DATAROOTDIR/locale``)
# ``MANDIR``
-# man documentation (DATAROOTDIR/man)
+# man documentation (``DATAROOTDIR/man``)
# ``DOCDIR``
-# documentation root (DATAROOTDIR/doc/PROJECT_NAME)
+# documentation root (``DATAROOTDIR/doc/PROJECT_NAME``)
+#
+# If the includer does not define a value the above-shown default will be
+# used and the value will appear in the cache for editing by the user.
+#
+# Special Cases
+# ^^^^^^^^^^^^^
+#
+# The following values of :variable:`CMAKE_INSTALL_PREFIX` are special:
+#
+# ``/``
+#
+# For ``<dir>`` other than the ``SYSCONFDIR`` and ``LOCALSTATEDIR``,
+# the value of ``CMAKE_INSTALL_<dir>`` is prefixed with ``usr/`` if
+# it is not user-specified as an absolute path. For example, the
+# ``INCLUDEDIR`` value ``include`` becomes ``usr/include``.
+# This is required by the `GNU Coding Standards`_, which state:
+#
+# When building the complete GNU system, the prefix will be empty
+# and ``/usr`` will be a symbolic link to ``/``.
+#
+# ``/usr``
#
-# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION
-# options of install() commands for the corresponding file type. If the
-# includer does not define a value the above-shown default will be used
-# and the value will appear in the cache for editing by the user. Each
-# CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
-# from the corresponding destination by prepending (if necessary) the
-# value of CMAKE_INSTALL_PREFIX.
+# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
+# ``CMAKE_INSTALL_FULL_<dir>`` is computed by prepending just ``/``
+# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
+# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
+# becomes ``/etc``. This is required by the `GNU Coding Standards`_.
+#
+# ``/opt/...``
+#
+# For ``<dir>`` equal to ``SYSCONFDIR`` or ``LOCALSTATEDIR``, the
+# ``CMAKE_INSTALL_FULL_<dir>`` is computed by *appending* the prefix
+# to the value of ``CMAKE_INSTALL_<dir>`` if it is not user-specified
+# as an absolute path. For example, the ``SYSCONFDIR`` value ``etc``
+# becomes ``/etc/opt/...``. This is defined by the
+# `Filesystem Hierarchy Standard`_.
+#
+# .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
#=============================================================================
+# Copyright 2015 Alex Turbov <i.zaufi@gmail.com>
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
# Copyright 2011 Kitware, Inc.
#
@@ -274,8 +319,35 @@ foreach(dir
MANDIR
DOCDIR
)
- if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
- set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}")
+ # Handle special cases:
+ # - CMAKE_INSTALL_PREFIX == /
+ # - CMAKE_INSTALL_PREFIX == /usr
+ # - CMAKE_INSTALL_PREFIX == /opt/...
+ if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/")
+ if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ else()
+ if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/")
+ set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}")
+ endif()
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ endif()
+ elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
+ if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ endif()
+ elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*")
+ if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR")
+ set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}")
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ endif()
+ else()
+ set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
+ endif()
else()
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
endif()
diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake
new file mode 100644
index 0000000..ceecc2f
--- /dev/null
+++ b/Modules/Platform/Linux-CCur-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-GNU-Fortran)
diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake
index 68e9540..85e1226 100644
--- a/Modules/Platform/Linux-GNU-Fortran.cmake
+++ b/Modules/Platform/Linux-GNU-Fortran.cmake
@@ -1,2 +1,3 @@
include(Platform/Linux-GNU)
__linux_compiler_gnu(Fortran)
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "")
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 26b3c0c..58ef3ca 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -74,6 +74,12 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT})
+# The Borland link tool does not support multiple concurrent
+# invocations within a single working directory.
+if(NOT DEFINED CMAKE_JOB_POOL_LINK)
+ set(CMAKE_JOB_POOL_LINK BCC32LinkPool)
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1)
+endif()
macro(__embarcadero_language lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index b571b16..b97409c 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -35,7 +35,7 @@ endif()
if(MINGW)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32")
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
endif()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 13fe8bc..f72a7f2 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -46,8 +46,10 @@ else()
set(_PLATFORM_LINK_FLAGS "")
endif()
+set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 1)
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
set (CMAKE_NO_BUILD_TYPE 1)
+ set(CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS 0) # not implemented for VS6
endif()
if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
set (CMAKE_NO_BUILD_TYPE 1)
@@ -230,6 +232,7 @@ elseif(MSVC_Fortran_ARCHITECTURE_ID)
set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
endif()
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}")
+set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS_INIT} ${_MACHINE_ARCH_FLAG}")
unset(_MACHINE_ARCH_FLAG)
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
diff --git a/README.rst b/README.rst
index e8524f8..120705c 100644
--- a/README.rst
+++ b/README.rst
@@ -82,7 +82,7 @@ If you have found a bug:
1. If you have a patch, please read the `CONTRIBUTING.rst`_ document.
-2. Otherwise, please join the the `CMake Users List`_ and ask about
+2. Otherwise, please join the `CMake Users List`_ and ask about
the expected and observed behaviors to determine if it is really
a bug.
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index a7adb51..d5fe7d1 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -165,6 +165,8 @@ set(SRCS
cmCommandArgumentLexer.cxx
cmCommandArgumentParser.cxx
cmCommandArgumentParserHelper.cxx
+ cmCommonTargetGenerator.cxx
+ cmCommonTargetGenerator.h
cmComputeComponentGraph.cxx
cmComputeComponentGraph.h
cmComputeLinkDepends.cxx
@@ -260,6 +262,8 @@ set(SRCS
cmGeneratorExpression.h
cmGeneratorTarget.cxx
cmGeneratorTarget.h
+ cmGlobalCommonGenerator.cxx
+ cmGlobalCommonGenerator.h
cmGlobalGenerator.cxx
cmGlobalGenerator.h
cmGlobalGeneratorFactory.h
@@ -281,9 +285,12 @@ set(SRCS
cmInstallTargetGenerator.cxx
cmInstallDirectoryGenerator.h
cmInstallDirectoryGenerator.cxx
+ cmLinkedTree.h
cmListFileCache.cxx
cmListFileCache.h
cmListFileLexer.c
+ cmLocalCommonGenerator.cxx
+ cmLocalCommonGenerator.h
cmLocalGenerator.cxx
cmLocalGenerator.h
cmLocalUnixMakefileGenerator3.cxx
@@ -299,6 +306,8 @@ set(SRCS
cmMakefileUtilityTargetGenerator.cxx
cmOSXBundleGenerator.cxx
cmOSXBundleGenerator.h
+ cmOutputConverter.cxx
+ cmOutputConverter.h
cmNewLineStyle.h
cmNewLineStyle.cxx
cmOrderDirectories.cxx
@@ -427,6 +436,7 @@ if (WIN32)
set(SRCS ${SRCS}
cmCallVisualStudioMacro.cxx
cmCallVisualStudioMacro.h
+ bindexplib.cxx
)
if(NOT UNIX)
@@ -731,9 +741,17 @@ endif()
include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
-install(TARGETS cmake ctest cpack DESTINATION bin)
+# Install tools
+
+set(_tools cmake ctest cpack)
+
if(APPLE)
- install(TARGETS cmakexbuild DESTINATION bin)
+ list(APPEND _tools cmakexbuild)
endif()
+foreach(_tool ${_tools})
+ CMake_OPTIONAL_COMPONENT(${_tool})
+ install(TARGETS ${_tool} DESTINATION bin ${COMPONENT})
+endforeach()
+
install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 4db774f..b382750 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
-set(CMake_VERSION_MINOR 2)
-set(CMake_VERSION_PATCH 20150602)
+set(CMake_VERSION_MINOR 3)
+set(CMake_VERSION_PATCH 20150713)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 80ba068..09e123c 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -254,9 +254,11 @@ int cmCPackIFWGenerator::InitializeInternal()
const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
+ const std::string FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION";
if(!this->IsSet(BinCreatorOpt) ||
- !this->IsSet(RepoGenOpt))
+ !this->IsSet(RepoGenOpt) ||
+ !this->IsSet(FrameworkVersionOpt))
{
this->ReadListFile("CPackIFW.cmake");
}
@@ -296,7 +298,7 @@ int cmCPackIFWGenerator::InitializeInternal()
// Framework version
if(const char* FrameworkVersionSrt =
- this->GetOption("CPACK_IFW_FRAMEWORK_VERSION"))
+ this->GetOption(FrameworkVersionOpt))
{
FrameworkVersion = FrameworkVersionSrt;
}
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index e141b60..6dbb245 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -920,7 +920,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
char* data;
int length;
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+ cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT,
" Each symbol represents " << tick_len << " bytes of output."
<< std::endl
<< (this->UseCTestLaunch? "" :
@@ -968,7 +968,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
this->ProcessBuffer(0, 0, tick, tick_len, ofs, &this->BuildProcessingQueue);
this->ProcessBuffer(0, 0, tick, tick_len, ofs,
&this->BuildProcessingErrorQueue);
- cmCTestOptionalLog(this->CTest, OUTPUT, " Size of output: "
+ cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size of output: "
<< ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl,
this->Quiet);
@@ -1175,12 +1175,12 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
while ( this->BuildOutputLogSize > (tick * tick_len) )
{
tick ++;
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, this->LastTickChar,
- this->Quiet);
+ cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT,
+ this->LastTickChar, this->Quiet);
tickDisplayed = true;
if ( tick % tick_line_len == 0 && tick > 0 )
{
- cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Size: "
+ cmCTestOptionalLog(this->CTest, HANDLER_PROGRESS_OUTPUT, " Size: "
<< ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl
<< " ", this->Quiet);
}
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 81eb0a8..ad79ba2 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -23,6 +23,7 @@ cmCTestGenericHandler::cmCTestGenericHandler()
this->SubmitIndex = 0;
this->AppendXML = false;
this->Quiet = false;
+ this->TestLoad = 0;
}
//----------------------------------------------------------------------
@@ -70,6 +71,7 @@ void cmCTestGenericHandler::SetPersistentOption(const std::string& op,
void cmCTestGenericHandler::Initialize()
{
this->AppendXML = false;
+ this->TestLoad = 0;
this->Options.clear();
t_StringToString::iterator it;
for ( it = this->PersistentOptions.begin();
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index 8567dd7..4b7ae79 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -89,6 +89,8 @@ public:
void SetAppendXML(bool b) { this->AppendXML = b; }
void SetQuiet(bool b) { this->Quiet = b; }
bool GetQuiet() { return this->Quiet; }
+ void SetTestLoad(unsigned long load) { this->TestLoad = load; }
+ unsigned long GetTestLoad() const { return this->TestLoad; }
protected:
bool StartResultingXML(cmCTest::Part part,
@@ -97,6 +99,7 @@ protected:
bool AppendXML;
bool Quiet;
+ unsigned long TestLoad;
cmSystemTools::OutputOption HandlerVerbose;
cmCTest *CTest;
t_StringToString Options;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index bd090db..4832186 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -13,12 +13,15 @@
#include "cmProcess.h"
#include "cmStandardIncludes.h"
#include "cmCTest.h"
+#include "cmCTestScriptHandler.h"
#include "cmSystemTools.h"
#include <stdlib.h>
#include <stack>
#include <list>
#include <float.h>
+#include <math.h>
#include <cmsys/FStream.hxx>
+#include <cmsys/SystemInformation.hxx>
class TestComparator
{
@@ -40,10 +43,12 @@ private:
cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
{
this->ParallelLevel = 1;
+ this->TestLoad = 0;
this->Completed = 0;
this->RunningCount = 0;
this->StopTimePassed = false;
this->HasCycles = false;
+ this->SerialTestRunning = false;
}
cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler()
@@ -83,6 +88,11 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level)
this->ParallelLevel = level < 1 ? 1 : level;
}
+void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load)
+{
+ this->TestLoad = load;
+}
+
//---------------------------------------------------------
void cmCTestMultiProcessHandler::RunTests()
{
@@ -172,6 +182,11 @@ void cmCTestMultiProcessHandler::LockResources(int index)
this->LockedResources.insert(
this->Properties[index]->LockedResources.begin(),
this->Properties[index]->LockedResources.end());
+
+ if (this->Properties[index]->RunSerial)
+ {
+ this->SerialTestRunning = true;
+ }
}
//---------------------------------------------------------
@@ -198,17 +213,20 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test)
{
size_t processors =
static_cast<int>(this->Properties[test]->Processors);
- //If this is set to run serially, it must run alone.
- //Also, if processors setting is set higher than the -j
+ //If processors setting is set higher than the -j
//setting, we default to using all of the process slots.
- if(this->Properties[test]->RunSerial
- || processors > this->ParallelLevel)
+ if (processors > this->ParallelLevel)
{
processors = this->ParallelLevel;
}
return processors;
}
+std::string cmCTestMultiProcessHandler::GetName(int test)
+{
+ return this->Properties[test]->Name;
+}
+
//---------------------------------------------------------
bool cmCTestMultiProcessHandler::StartTest(int test)
{
@@ -248,22 +266,136 @@ void cmCTestMultiProcessHandler::StartNextTests()
return;
}
+ // Don't start any new tests if one with the RUN_SERIAL property
+ // is already running.
+ if (this->SerialTestRunning)
+ {
+ return;
+ }
+
+ bool allTestsFailedTestLoadCheck = false;
+ bool usedFakeLoadForTesting = false;
+ size_t minProcessorsRequired = this->ParallelLevel;
+ std::string testWithMinProcessors = "";
+
+ cmsys::SystemInformation info;
+
+ unsigned long systemLoad = 0;
+ size_t spareLoad = 0;
+ if (this->TestLoad > 0)
+ {
+ // Activate possible wait.
+ allTestsFailedTestLoadCheck = true;
+
+ // Check for a fake load average value used in testing.
+ if (const char* fake_load_value =
+ cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING"))
+ {
+ usedFakeLoadForTesting = true;
+ if (!cmSystemTools::StringToULong(fake_load_value, &systemLoad))
+ {
+ cmSystemTools::Error("Failed to parse fake load value: ",
+ fake_load_value);
+ }
+ }
+ // If it's not set, look up the true load average.
+ else
+ {
+ systemLoad = static_cast<unsigned long>(ceil(info.GetLoadAverage()));
+ }
+ spareLoad = (this->TestLoad > systemLoad ?
+ this->TestLoad - systemLoad : 0);
+
+ // Don't start more tests than the spare load can support.
+ if (numToStart > spareLoad)
+ {
+ numToStart = spareLoad;
+ }
+ }
+
TestList copy = this->SortedTests;
for(TestList::iterator test = copy.begin(); test != copy.end(); ++test)
{
+ // Take a nap if we're currently performing a RUN_SERIAL test.
+ if (this->SerialTestRunning)
+ {
+ break;
+ }
+ // We can only start a RUN_SERIAL test if no other tests are also running.
+ if (this->Properties[*test]->RunSerial && this->RunningCount > 0)
+ {
+ continue;
+ }
+
size_t processors = GetProcessorsUsed(*test);
+ bool testLoadOk = true;
+ if (this->TestLoad > 0)
+ {
+ if (processors <= spareLoad)
+ {
+ cmCTestLog(this->CTest, DEBUG,
+ "OK to run " << GetName(*test) <<
+ ", it requires " << processors <<
+ " procs & system load is: " <<
+ systemLoad << std::endl);
+ allTestsFailedTestLoadCheck = false;
+ }
+ else
+ {
+ testLoadOk = false;
+ }
+ }
- if(processors <= numToStart && this->StartTest(*test))
+ if (processors <= minProcessorsRequired)
{
- if(this->StopTimePassed)
- {
- return;
- }
- numToStart -= processors;
+ minProcessorsRequired = processors;
+ testWithMinProcessors = GetName(*test);
+ }
+
+ if(testLoadOk && processors <= numToStart && this->StartTest(*test))
+ {
+ if(this->StopTimePassed)
+ {
+ return;
+ }
+
+ numToStart -= processors;
}
else if(numToStart == 0)
{
- return;
+ break;
+ }
+ }
+
+ if (allTestsFailedTestLoadCheck)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "***** WAITING, ");
+ if (this->SerialTestRunning)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ "Waiting for RUN_SERIAL test to finish.");
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ "System Load: " << systemLoad << ", "
+ "Max Allowed Load: " << this->TestLoad << ", "
+ "Smallest test " << testWithMinProcessors <<
+ " requires " << minProcessorsRequired);
+ }
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl);
+
+ if (usedFakeLoadForTesting)
+ {
+ // Break out of the infinite loop of waiting for our fake load
+ // to come down.
+ this->StopTimePassed = true;
+ }
+ else
+ {
+ // Wait between 1 and 5 seconds before trying again.
+ cmCTestScriptHandler::SleepInSeconds(
+ cmSystemTools::RandomSeed() % 5 + 1);
}
}
}
@@ -319,6 +451,11 @@ bool cmCTestMultiProcessHandler::CheckOutput()
this->WriteCheckpoint(test);
this->UnlockResources(test);
this->RunningCount -= GetProcessorsUsed(test);
+ if (this->Properties[test]->RunSerial)
+ {
+ this->SerialTestRunning = false;
+ }
+
delete p;
}
return true;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 6440fbc..ed3e155 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -37,6 +37,7 @@ public:
void SetTests(TestMap& tests, PropertiesMap& properties);
// Set the max number of tests that can be run at the same time.
void SetParallelLevel(size_t);
+ void SetTestLoad(unsigned long load);
virtual void RunTests();
void PrintTestList();
void PrintLabels();
@@ -93,6 +94,7 @@ protected:
bool CheckCycles();
int FindMaxIndex();
inline size_t GetProcessorsUsed(int index);
+ std::string GetName(int index);
void LockResources(int index);
void UnlockResources(int index);
@@ -116,11 +118,13 @@ protected:
std::set<std::string> LockedResources;
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
size_t ParallelLevel; // max number of process that can be run at once
+ unsigned long TestLoad;
std::set<cmCTestRunTest*> RunningTests; // current running tests
cmCTestTestHandler * TestHandler;
cmCTest* CTest;
bool HasCycles;
bool Quiet;
+ bool SerialTestRunning;
};
#endif
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index d9e4bd4..d108592 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -57,8 +57,7 @@ bool cmCTestRunTest::CheckOutput()
// Process has terminated and all output read.
return false;
}
- else if(p == cmsysProcess_Pipe_STDOUT ||
- p == cmsysProcess_Pipe_STDERR)
+ else if(p == cmsysProcess_Pipe_STDOUT)
{
// Store this line of output.
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 1e493b0..047bd98 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -421,6 +421,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
}
+#if defined(__CYGWIN__)
+ this->Makefile->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
+#endif
+
// always add a function blocker to update the elapsed time
cmCTestScriptFunctionBlocker *f = new cmCTestScriptFunctionBlocker();
f->CTestScriptHandler = this;
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index 8b357ac..b7d8318 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -26,6 +26,7 @@ cmCTestTestCommand::cmCTestTestCommand()
this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL";
this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM";
this->Arguments[ctt_STOP_TIME] = "STOP_TIME";
+ this->Arguments[ctt_TEST_LOAD] = "TEST_LOAD";
this->Arguments[ctt_LAST] = 0;
this->Last = ctt_LAST;
}
@@ -103,6 +104,38 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
{
this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]);
}
+
+ // Test load is determined by: TEST_LOAD argument,
+ // or CTEST_TEST_LOAD script variable, or ctest --test-load
+ // command line argument... in that order.
+ unsigned long testLoad;
+ const char* ctestTestLoad
+ = this->Makefile->GetDefinition("CTEST_TEST_LOAD");
+ if(this->Values[ctt_TEST_LOAD] && *this->Values[ctt_TEST_LOAD])
+ {
+ if (!cmSystemTools::StringToULong(this->Values[ctt_TEST_LOAD], &testLoad))
+ {
+ testLoad = 0;
+ cmCTestLog(this->CTest, WARNING, "Invalid value for 'TEST_LOAD' : "
+ << this->Values[ctt_TEST_LOAD] << std::endl);
+ }
+ }
+ else if(ctestTestLoad && *ctestTestLoad)
+ {
+ if (!cmSystemTools::StringToULong(ctestTestLoad, &testLoad))
+ {
+ testLoad = 0;
+ cmCTestLog(this->CTest, WARNING,
+ "Invalid value for 'CTEST_TEST_LOAD' : " <<
+ ctestTestLoad << std::endl);
+ }
+ }
+ else
+ {
+ testLoad = this->CTest->GetTestLoad();
+ }
+ handler->SetTestLoad(testLoad);
+
handler->SetQuiet(this->Quiet);
return handler;
}
diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h
index a1e5f36..0dfca97 100644
--- a/Source/CTest/cmCTestTestCommand.h
+++ b/Source/CTest/cmCTestTestCommand.h
@@ -60,6 +60,7 @@ protected:
ctt_PARALLEL_LEVEL,
ctt_SCHEDULE_RANDOM,
ctt_STOP_TIME,
+ ctt_TEST_LOAD,
ctt_LAST
};
};
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 70b7f5c..5faf001 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -656,9 +656,8 @@ int cmCTestTestHandler::ProcessHandler()
void cmCTestTestHandler::PrintLabelSummary()
{
cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
- cmCTestTestHandler::TestResultsVector::iterator ri =
- this->TestResults.begin();
std::map<std::string, double> labelTimes;
+ std::map<std::string, int> labelCounts;
std::set<std::string> labels;
// initialize maps
std::string::size_type maxlen = 0;
@@ -676,10 +675,12 @@ void cmCTestTestHandler::PrintLabelSummary()
}
labels.insert(*l);
labelTimes[*l] = 0;
+ labelCounts[*l] = 0;
}
}
}
- ri = this->TestResults.begin();
+ cmCTestTestHandler::TestResultsVector::iterator ri =
+ this->TestResults.begin();
// fill maps
for(; ri != this->TestResults.end(); ++ri)
{
@@ -691,6 +692,7 @@ void cmCTestTestHandler::PrintLabelSummary()
l != p.Labels.end(); ++l)
{
labelTimes[*l] += result.ExecutionTime;
+ ++labelCounts[*l];
}
}
}
@@ -705,10 +707,21 @@ void cmCTestTestHandler::PrintLabelSummary()
{
std::string label = *i;
label.resize(maxlen +3, ' ');
+
char buf[1024];
sprintf(buf, "%6.2f sec", labelTimes[*i]);
+
+ std::ostringstream labelCountStr;
+ labelCountStr << "(" << labelCounts[*i] << " test";
+ if (labelCounts[*i] > 1)
+ {
+ labelCountStr << "s";
+ }
+ labelCountStr << ")";
+
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\n"
- << label << " = " << buf, this->Quiet );
+ << label << " = " << buf << " " << labelCountStr.str(),
+ this->Quiet );
if ( this->LogFile )
{
*this->LogFile << "\n" << *i << " = "
@@ -1062,6 +1075,14 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
parallel->SetParallelLevel(this->CTest->GetParallelLevel());
parallel->SetTestHandler(this);
parallel->SetQuiet(this->Quiet);
+ if(this->TestLoad > 0)
+ {
+ parallel->SetTestLoad(this->TestLoad);
+ }
+ else
+ {
+ parallel->SetTestLoad(this->CTest->GetTestLoad());
+ }
*this->LogFile << "Start testing: "
<< this->CTest->CurrentTime() << std::endl
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 8494d28..963e501 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -283,13 +283,13 @@ int cmCTestUpdateHandler::ProcessHandler()
{
xml.Content("Update command failed:\n");
xml.Content(vc->GetUpdateCommandLine());
- cmCTestLog(this->CTest, ERROR_MESSAGE, " Update command failed: "
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, " Update command failed: "
<< vc->GetUpdateCommandLine() << "\n");
}
xml.EndElement(); // UpdateReturnStatus
xml.EndElement(); // Update
xml.EndDocument();
- return numUpdated;
+ return updated? numUpdated : -1;
}
//----------------------------------------------------------------------
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index e1bd02b..0c25f40 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -62,6 +62,7 @@ bool cmProcess::StartProcess()
this->WorkingDirectory.c_str());
}
cmsysProcess_SetTimeout(this->Process, this->Timeout);
+ cmsysProcess_SetOption(this->Process, cmsysProcess_Option_MergeOutput, 1);
cmsysProcess_Execute(this->Process);
return (cmsysProcess_GetState(this->Process)
== cmsysProcess_State_Executing);
@@ -124,14 +125,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
for(;;)
{
// Look for lines already buffered.
- if(this->StdOut.GetLine(line))
+ if(this->Output.GetLine(line))
{
return cmsysProcess_Pipe_STDOUT;
}
- else if(this->StdErr.GetLine(line))
- {
- return cmsysProcess_Pipe_STDERR;
- }
// Check for more data from the process.
char* data;
@@ -143,11 +140,7 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
}
else if(p == cmsysProcess_Pipe_STDOUT)
{
- this->StdOut.insert(this->StdOut.end(), data, data+length);
- }
- else if(p == cmsysProcess_Pipe_STDERR)
- {
- this->StdErr.insert(this->StdErr.end(), data, data+length);
+ this->Output.insert(this->Output.end(), data, data+length);
}
else // p == cmsysProcess_Pipe_None
{
@@ -157,14 +150,10 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
}
// Look for partial last lines.
- if(this->StdOut.GetLast(line))
+ if(this->Output.GetLast(line))
{
return cmsysProcess_Pipe_STDOUT;
}
- else if(this->StdErr.GetLast(line))
- {
- return cmsysProcess_Pipe_STDERR;
- }
// No more data. Wait for process exit.
if(!cmsysProcess_WaitForExit(this->Process, &timeout))
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index 1479df0..eddeeab 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -48,8 +48,7 @@ public:
* Read one line of output but block for no more than timeout.
* Returns:
* cmsysProcess_Pipe_None = Process terminated and all output read
- * cmsysProcess_Pipe_STDOUT = Line came from stdout
- * cmsysProcess_Pipe_STDOUT = Line came from stderr
+ * cmsysProcess_Pipe_STDOUT = Line came from stdout or stderr
* cmsysProcess_Pipe_Timeout = Timeout expired while waiting
*/
int GetNextOutputLine(std::string& line, double timeout);
@@ -68,13 +67,11 @@ private:
bool GetLine(std::string& line);
bool GetLast(std::string& line);
};
- Buffer StdErr;
- Buffer StdOut;
+ Buffer Output;
std::string Command;
std::string WorkingDirectory;
std::vector<std::string> Arguments;
std::vector<const char*> ProcessArgs;
- std::string Output;
int Id;
int ExitValue;
};
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index 7d4e88c..93ff425 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -47,4 +47,5 @@ else()
target_link_libraries(ccmake cmForm)
endif()
-install(TARGETS ccmake DESTINATION bin)
+CMake_OPTIONAL_COMPONENT(ccmake)
+install(TARGETS ccmake DESTINATION bin ${COMPONENT})
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 168f57d..038c411 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -14,6 +14,7 @@ project(QtDialog)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # Drop when CMake >= 2.8.11 required
endif()
+CMake_OPTIONAL_COMPONENT(cmake-gui)
find_package(Qt5Widgets QUIET)
if (Qt5Widgets_FOUND)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
@@ -47,7 +48,8 @@ if (Qt5Widgets_FOUND)
get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME)
set(_qt_plugin_dest "PlugIns/${_qt_plugin_type}")
install(FILES "${_qt_plugin_path}"
- DESTINATION "${_qt_plugin_dest}")
+ DESTINATION "${_qt_plugin_dest}"
+ ${COMPONENT})
set(${_qt_plugins_var}
"${${_qt_plugins_var}};\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}")
else()
@@ -58,7 +60,8 @@ if (Qt5Widgets_FOUND)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
"[Paths]\nPlugins = PlugIns\n")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
- DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources")
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources"
+ ${COMPONENT})
endif()
if(WIN32 AND TARGET Qt5::Core)
@@ -130,7 +133,8 @@ endif()
if(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
install(FILES ${CMake_SOURCE_DIR}/Licenses/LGPLv2.1.txt
- DESTINATION ${CMAKE_DATA_DIR}/Licenses)
+ DESTINATION ${CMAKE_DATA_DIR}/Licenses
+ ${COMPONENT})
set_property(SOURCE CMakeSetupDialog.cxx
PROPERTY COMPILE_DEFINITIONS CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL)
endif()
@@ -163,27 +167,36 @@ if(APPLE)
)
endif()
set(CMAKE_INSTALL_DESTINATION_ARGS
- BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}")
+ BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" ${COMPONENT})
-install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS})
+install(TARGETS cmake-gui
+ RUNTIME DESTINATION bin ${COMPONENT}
+ ${CMAKE_INSTALL_DESTINATION_ARGS})
if(UNIX AND NOT APPLE)
foreach (size IN ITEMS 32 128)
install(
FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png"
DESTINATION "share/icons/hicolor/${size}x${size}/apps"
+ ${COMPONENT}
RENAME "CMakeSetup.png")
endforeach ()
# install a desktop file so CMake appears in the application start menu
# with an icon
- install(FILES CMake.desktop DESTINATION share/applications )
- install(FILES cmakecache.xml DESTINATION share/mime/packages )
+ install(FILES CMake.desktop
+ DESTINATION share/applications
+ ${COMPONENT})
+ install(FILES cmakecache.xml
+ DESTINATION share/mime/packages
+ ${COMPONENT})
endif()
if(APPLE)
- install(CODE "execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui
- WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)")
+ install(CODE "
+ execute_process(COMMAND ln -s \"../MacOS/CMake\" cmake-gui
+ WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)
+ " ${COMPONENT})
endif()
if(APPLE OR WIN32)
@@ -197,7 +210,7 @@ if(APPLE OR WIN32)
include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${fixup_exe}\" \"${QT_PLUGINS}\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\")
- ")
+ " ${COMPONENT})
endif()
set(CMAKE_PACKAGE_QTGUI TRUE)
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 38d6d44..4f93a77 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -86,7 +86,7 @@ int main(int argc, char** argv)
#if defined(Q_OS_MAC)
if (argc2 == 2 && strcmp(argv2[1], "--install") == 0)
{
- return cmOSXInstall("/usr/bin");
+ return cmOSXInstall("/usr/local/bin");
}
if (argc2 == 2 && cmHasLiteralPrefix(argv2[1], "--install="))
{
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 426fa12..03417f3 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -425,7 +425,7 @@ void CMakeSetupDialog::doInstallForCommandLine()
"\n"
" PATH=\"%1\":\"$PATH\"\n"
"\n"
- "Or, to install symlinks to '/usr/bin', run:\n"
+ "Or, to install symlinks to '/usr/local/bin', run:\n"
"\n"
" sudo \"%2\" --install\n"
"\n"
@@ -445,6 +445,7 @@ void CMakeSetupDialog::doInstallForCommandLine()
l->addWidget(lab);
lab->setText(msg);
lab->setWordWrap(false);
+ lab->setTextInteractionFlags(Qt::TextSelectableByMouse);
QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs
new file mode 100644
index 0000000..219a0a9
--- /dev/null
+++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs
@@ -0,0 +1,21 @@
+// Component: CMake.Dialogs.QtGUI
+
+function Component()
+{
+ // Default constructor
+}
+
+Component.prototype.createOperations = function()
+{
+ // Create shortcut
+ if (installer.value("os") === "win") {
+
+ component.addOperation("CreateShortcut",
+ installer.value("TargetDir") + "/bin/cmake-gui.exe",
+ installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk");
+
+ }
+
+ // Call default implementation
+ component.createOperations();
+}
diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in
new file mode 100644
index 0000000..5c929e8
--- /dev/null
+++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in
@@ -0,0 +1,21 @@
+// Component: CMake.Documentation.SphinxHTML
+
+function Component()
+{
+ // Default constructor
+}
+
+Component.prototype.createOperations = function()
+{
+ // Create shortcut
+ if (installer.value("os") === "win") {
+
+ component.addOperation("CreateShortcut",
+ installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html",
+ installer.value("StartMenuDir") + "/CMake Documentation.lnk");
+
+ }
+
+ // Call default implementation
+ component.createOperations();
+}
diff --git a/Source/QtIFW/CMake.qs.in b/Source/QtIFW/CMake.qs.in
new file mode 100644
index 0000000..828cc7c
--- /dev/null
+++ b/Source/QtIFW/CMake.qs.in
@@ -0,0 +1,22 @@
+function Component()
+{
+ // Default constructor
+}
+
+Component.prototype.createOperations = function()
+{
+ // Create shortcut
+ if (installer.value("os") === "win") {
+
+ component.addOperation("CreateShortcut",
+ installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html",
+ installer.value("StartMenuDir") + "/CMake Web Site.lnk");
+
+ component.addOperation("CreateShortcut",
+ installer.value("TargetDir") + "/cmake-maintenance.exe",
+ installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk");
+ }
+
+ // Call default implementation
+ component.createOperations();
+}
diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in
index 570dba1..3411e34 100644
--- a/Source/QtIFW/installscript.qs.in
+++ b/Source/QtIFW/installscript.qs.in
@@ -5,20 +5,20 @@ function Component()
Component.prototype.createOperations = function()
{
- // call default implementation to actually install applications!
- component.createOperations();
-
// Create shortcut
if (installer.value("os") === "win") {
@_CPACK_IFW_SHORTCUT_OPTIONAL@
component.addOperation("CreateShortcut",
- installer.value("TargetDir") + "/cmake.org.html",
+ installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html",
installer.value("StartMenuDir") + "/CMake Web Site.lnk");
component.addOperation("CreateShortcut",
installer.value("TargetDir") + "/cmake-maintenance.exe",
installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk");
}
+
+ // Call default implementation
+ component.createOperations();
}
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
new file mode 100644
index 0000000..11e3f34
--- /dev/null
+++ b/Source/bindexplib.cxx
@@ -0,0 +1,428 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 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.
+============================================================================*/
+/*-------------------------------------------------------------------------
+ Portions of this source have been derived from the 'bindexplib' tool
+ provided by the CERN ROOT Data Analysis Framework project (root.cern.ch).
+ Permission has been granted by Pere Mato <pere.mato@cern.ch> to distribute
+ this derived work under the CMake license.
+-------------------------------------------------------------------------*/
+
+/*
+*----------------------------------------------------------------------
+* Program: dumpexts.exe
+* Author: Gordon Chaffee
+*
+* History: The real functionality of this file was written by
+* Matt Pietrek in 1993 in his pedump utility. I've
+* modified it to dump the externals in a bunch of object
+* files to create a .def file.
+*
+* Notes: Visual C++ puts an underscore before each exported symbol.
+* This file removes them. I don't know if this is a problem
+* this other compilers. If _MSC_VER is defined,
+* the underscore is removed. If not, it isn't. To get a
+* full dump of an object file, use the -f option. This can
+* help determine the something that may be different with a
+* compiler other than Visual C++.
+* ======================================
+* Corrections (Axel 2006-04-04):
+* Conversion to C++. Mostly.
+*
+ * Extension (Axel 2006-03-15)
+ * As soon as an object file contains an /EXPORT directive (which
+ * is generated by the compiler when a symbol is declared as
+ * declspec(dllexport)) no to-be-exported symbols are printed,
+ * as the linker will see these directives, and if those directives
+ * are present we only export selectively (i.e. we trust the
+ * programmer).
+ *
+ * ======================================
+* ======================================
+* Corrections (Valery Fine 23/02/98):
+*
+* The "(vector) deleting destructor" MUST not be exported
+* To recognize it the following test are introduced:
+* "@@UAEPAXI@Z" scalar deleting dtor
+* "@@QAEPAXI@Z" vector deleting dtor
+* "AEPAXI@Z" vector deleting dtor with thunk adjustor
+* ======================================
+* Corrections (Valery Fine 12/02/97):
+*
+* It created a wrong EXPORTS for the global pointers and constants.
+* The Section Header has been involved to discover the missing information
+* Now the pointers are correctly supplied supplied with "DATA" descriptor
+* the constants with no extra descriptor.
+*
+* Corrections (Valery Fine 16/09/96):
+*
+* It didn't work for C++ code with global variables and class definitons
+* The DumpExternalObject function has been introduced to generate .DEF file
+*
+* Author: Valery Fine 16/09/96 (E-mail: fine@vxcern.cern.ch)
+*----------------------------------------------------------------------
+*/
+
+#include <cmsys/Encoding.hxx>
+#include <windows.h>
+#include <stdio.h>
+#include <string>
+#include <fstream>
+#include <iostream>
+
+typedef struct cmANON_OBJECT_HEADER_BIGOBJ {
+ /* same as ANON_OBJECT_HEADER_V2 */
+ WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN
+ WORD Sig2; // Must be 0xffff
+ WORD Version; // >= 2 (implies the Flags field is present)
+ WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx
+ DWORD TimeDateStamp;
+ CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8}
+ DWORD SizeOfData; // Size of data that follows the header
+ DWORD Flags; // 0x1 -> contains metadata
+ DWORD MetaDataSize; // Size of CLR metadata
+ DWORD MetaDataOffset; // Offset of CLR metadata
+
+ /* bigobj specifics */
+ DWORD NumberOfSections; // extended from WORD
+ DWORD PointerToSymbolTable;
+ DWORD NumberOfSymbols;
+} cmANON_OBJECT_HEADER_BIGOBJ;
+
+typedef struct _cmIMAGE_SYMBOL_EX {
+ union {
+ BYTE ShortName[8];
+ struct {
+ DWORD Short; // if 0, use LongName
+ DWORD Long; // offset into string table
+ } Name;
+ DWORD LongName[2]; // PBYTE [2]
+ } N;
+ DWORD Value;
+ LONG SectionNumber;
+ WORD Type;
+ BYTE StorageClass;
+ BYTE NumberOfAuxSymbols;
+} cmIMAGE_SYMBOL_EX;
+typedef cmIMAGE_SYMBOL_EX UNALIGNED *cmPIMAGE_SYMBOL_EX;
+
+PIMAGE_SECTION_HEADER GetSectionHeaderOffset(PIMAGE_FILE_HEADER
+ pImageFileHeader)
+{
+ return (PIMAGE_SECTION_HEADER)
+ ((DWORD_PTR)pImageFileHeader +
+ IMAGE_SIZEOF_FILE_HEADER +
+ pImageFileHeader->SizeOfOptionalHeader);
+}
+
+PIMAGE_SECTION_HEADER GetSectionHeaderOffset(cmANON_OBJECT_HEADER_BIGOBJ*
+ pImageFileHeader)
+{
+ return (PIMAGE_SECTION_HEADER)
+ ((DWORD_PTR)pImageFileHeader +
+ sizeof(cmANON_OBJECT_HEADER_BIGOBJ));
+}
+
+/*
++ * Utility func, strstr with size
++ */
+const char* StrNStr(const char* start, const char* find, size_t &size) {
+ size_t len;
+ const char* hint;
+
+ if (!start || !find || !size) {
+ size = 0;
+ return 0;
+ }
+ len = strlen(find);
+
+ while ((hint = (const char*) memchr(start, find[0], size-len+1))) {
+ size -= (hint - start);
+ if (!strncmp(hint, find, len))
+ return hint;
+ start = hint + 1;
+ }
+
+ size = 0;
+ return 0;
+}
+
+template <
+ // cmANON_OBJECT_HEADER_BIGOBJ or IMAGE_FILE_HEADER
+ class ObjectHeaderType,
+ // cmPIMAGE_SYMBOL_EX or PIMAGE_SYMBOL
+ class SymbolTableType>
+class DumpSymbols
+{
+public:
+ /*
+ *----------------------------------------------------------------------
+ * Constructor --
+ *
+ * Initialize variables from pointer to object header.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ DumpSymbols(ObjectHeaderType* ih,
+ FILE* fout) {
+ this->ObjectImageHeader = ih;
+ this->SymbolTable = (SymbolTableType*)
+ ((DWORD_PTR)this->ObjectImageHeader
+ + this->ObjectImageHeader->PointerToSymbolTable);
+ this->FileOut = fout;
+ this->SectionHeaders =
+ GetSectionHeaderOffset(this->ObjectImageHeader);
+ this->ImportFlag = true;
+ this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols;
+ }
+
+ /*
+ *----------------------------------------------------------------------
+ * HaveExportedObjects --
+ *
+ * Returns true if export directives (declspec(dllexport)) exist.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ bool HaveExportedObjects() {
+ WORD i = 0;
+ size_t size = 0;
+ const char * rawdata = 0;
+ PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0;
+ PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders;
+ for(i = 0; (i < this->ObjectImageHeader->NumberOfSections &&
+ !pDirectivesSectionHeader); i++)
+ if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8))
+ pDirectivesSectionHeader = &pSectionHeaders[i];
+ if (!pDirectivesSectionHeader) return 0;
+
+ rawdata=(const char*)
+ this->ObjectImageHeader+pDirectivesSectionHeader->PointerToRawData;
+ if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0;
+
+ size = pDirectivesSectionHeader->SizeOfRawData;
+ const char* posImportFlag = rawdata;
+ while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) {
+ const char* lookingForDict = posImportFlag + 9;
+ if (!strncmp(lookingForDict, "_G__cpp_",8) ||
+ !strncmp(lookingForDict, "_G__set_cpp_",12)) {
+ posImportFlag = lookingForDict;
+ continue;
+ }
+
+ const char* lookingForDATA = posImportFlag + 9;
+ while (*(++lookingForDATA) && *lookingForDATA != ' ');
+ lookingForDATA -= 5;
+ // ignore DATA exports
+ if (strncmp(lookingForDATA, ",DATA", 5)) break;
+ posImportFlag = lookingForDATA + 5;
+ }
+ if(posImportFlag) {
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ *----------------------------------------------------------------------
+ * DumpObjFile --
+ *
+ * Dump an object file's exported symbols.
+ *----------------------------------------------------------------------
+ */
+ void DumpObjFile() {
+ if(!HaveExportedObjects()) {
+ this->DumpExternalsObjects();
+ }
+ }
+
+ /*
+ *----------------------------------------------------------------------
+ * DumpExternalsObjects --
+ *
+ * Dumps a COFF symbol table from an OBJ.
+ *----------------------------------------------------------------------
+ */
+ void DumpExternalsObjects() {
+ unsigned i;
+ PSTR stringTable;
+ std::string symbol;
+ DWORD SectChar;
+ /*
+ * The string table apparently starts right after the symbol table
+ */
+ stringTable = (PSTR)&this->SymbolTable[this->SymbolCount];
+ SymbolTableType* pSymbolTable = this->SymbolTable;
+ for ( i=0; i < this->SymbolCount; i++ ) {
+ if (pSymbolTable->SectionNumber > 0 &&
+ ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) {
+ if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
+ /*
+ * The name of the Function entry points
+ */
+ if (pSymbolTable->N.Name.Short != 0) {
+ symbol = "";
+ symbol.insert(0, (const char *)pSymbolTable->N.ShortName, 8);
+ } else {
+ symbol = stringTable + pSymbolTable->N.Name.Long;
+ }
+
+ // clear out any leading spaces
+ while (isspace(symbol[0])) symbol.erase(0,1);
+ // if it starts with _ and has an @ then it is a __cdecl
+ // so remove the @ stuff for the export
+ if(symbol[0] == '_') {
+ std::string::size_type posAt = symbol.find('@');
+ if (posAt != std::string::npos) {
+ symbol.erase(posAt);
+ }
+ }
+ if (symbol[0] == '_') symbol.erase(0,1);
+ if (this->ImportFlag) {
+ this->ImportFlag = false;
+ fprintf(this->FileOut,"EXPORTS \n");
+ }
+ /*
+ Check whether it is "Scalar deleting destructor" and
+ "Vector deleting destructor"
+ */
+ const char *scalarPrefix = "??_G";
+ const char *vectorPrefix = "??_E";
+ // original code had a check for
+ // symbol.find("real@") == std::string::npos)
+ // but if this disallows memmber functions with the name real
+ // if scalarPrefix and vectorPrefix are not found then print
+ // the symbol
+ if (symbol.compare(0, 4, scalarPrefix) &&
+ symbol.compare(0, 4, vectorPrefix) )
+ {
+ SectChar =
+ this->
+ SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics;
+ if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
+ // Read only (i.e. constants) must be excluded
+ fprintf(this->FileOut, "\t%s \t DATA\n", symbol.c_str());
+ } else {
+ if ( pSymbolTable->Type ||
+ !(SectChar & IMAGE_SCN_MEM_READ)) {
+ fprintf(this->FileOut, "\t%s\n", symbol.c_str());
+ } else {
+ // printf(" strange symbol: %s \n",symbol.c_str());
+ }
+ }
+ }
+ }
+ }
+ else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED &&
+ !pSymbolTable->Type && 0) {
+ /*
+ * The IMPORT global variable entry points
+ */
+ if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
+ symbol = stringTable + pSymbolTable->N.Name.Long;
+ while (isspace(symbol[0])) symbol.erase(0,1);
+ if (symbol[0] == '_') symbol.erase(0,1);
+ if (!this->ImportFlag) {
+ this->ImportFlag = true;
+ fprintf(this->FileOut,"IMPORTS \n");
+ }
+ fprintf(this->FileOut, "\t%s DATA \n", symbol.c_str()+1);
+ }
+ }
+
+ /*
+ * Take into account any aux symbols
+ */
+ i += pSymbolTable->NumberOfAuxSymbols;
+ pSymbolTable += pSymbolTable->NumberOfAuxSymbols;
+ pSymbolTable++;
+ }
+ }
+private:
+ bool ImportFlag;
+ FILE* FileOut;
+ DWORD_PTR SymbolCount;
+ PIMAGE_SECTION_HEADER SectionHeaders;
+ ObjectHeaderType* ObjectImageHeader;
+ SymbolTableType* SymbolTable;
+};
+
+bool
+DumpFile(const char* filename, FILE *fout)
+{
+ HANDLE hFile;
+ HANDLE hFileMapping;
+ LPVOID lpFileBase;
+ PIMAGE_DOS_HEADER dosHeader;
+
+ hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(),
+ GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+
+ if (hFile == INVALID_HANDLE_VALUE) {
+ fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename);
+ return false;
+ }
+
+ hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (hFileMapping == 0) {
+ CloseHandle(hFile);
+ fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n");
+ return false;
+ }
+
+ lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
+ if (lpFileBase == 0) {
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n");
+ return false;
+ }
+
+ dosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
+ if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) {
+ fprintf(stderr, "File is an executable. I don't dump those.\n");
+ return false;
+ }
+ /* Does it look like a i386 COFF OBJ file??? */
+ else if (
+ ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) ||
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64))
+ && (dosHeader->e_sp == 0)
+ ) {
+ /*
+ * The two tests above aren't what they look like. They're
+ * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C)
+ * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0;
+ */
+ DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL>
+ symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout);
+ symbolDumper.DumpObjFile();
+ } else {
+ // check for /bigobj format
+ cmANON_OBJECT_HEADER_BIGOBJ* h =
+ (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase;
+ if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) {
+ DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX>
+ symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout);
+ symbolDumper.DumpObjFile();
+ } else {
+ printf("unrecognized file format in '%s'\n", filename);
+ return false;
+ }
+ }
+ UnmapViewOfFile(lpFileBase);
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ return true;
+}
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 72818f5..44d0d4e 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -84,7 +84,8 @@ cmArchiveWrite::cmArchiveWrite(
Stream(os),
Archive(archive_write_new()),
Disk(archive_read_disk_new()),
- Verbose(false)
+ Verbose(false),
+ Format(format)
{
switch (c)
{
@@ -282,6 +283,14 @@ bool cmArchiveWrite::AddFile(const char* file,
archive_entry_acl_clear(e);
archive_entry_xattr_clear(e);
archive_entry_set_fflags(e, 0, 0);
+
+ if (this->Format == "pax" || this->Format == "paxr")
+ {
+ // Sparse files are a GNU tar extension.
+ // Do not use them in standard tar files.
+ archive_entry_sparse_clear(e);
+ }
+
if(archive_write_header(this->Archive, e) != ARCHIVE_OK)
{
this->Error = "archive_write_header: ";
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index 794cb28..e6f515d 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -84,6 +84,7 @@ private:
struct archive* Archive;
struct archive* Disk;
bool Verbose;
+ std::string Format;
std::string Error;
std::string MTime;
};
diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx
index cf24c13..368a0e6 100644
--- a/Source/cmCPackPropertiesGenerator.cxx
+++ b/Source/cmCPackPropertiesGenerator.cxx
@@ -1,6 +1,6 @@
#include "cmCPackPropertiesGenerator.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
cmMakefile* mf,
@@ -29,15 +29,15 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
cmInstalledFile::Property const& property = i->second;
os << indent << "set_property(INSTALL " <<
- cmLocalGenerator::EscapeForCMake(expandedFileName) << " PROPERTY " <<
- cmLocalGenerator::EscapeForCMake(name);
+ cmOutputConverter::EscapeForCMake(expandedFileName) << " PROPERTY " <<
+ cmOutputConverter::EscapeForCMake(name);
for(cmInstalledFile::ExpressionVectorType::const_iterator
j = property.ValueExpressions.begin();
j != property.ValueExpressions.end(); ++j)
{
std::string value = (*j)->Evaluate(this->Makefile, config);
- os << " " << cmLocalGenerator::EscapeForCMake(value);
+ os << " " << cmOutputConverter::EscapeForCMake(value);
}
os << ")\n";
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index c55ea35..591a2cd 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -426,8 +426,7 @@ int CCONV cmExecuteCommand(void *arg, const char *name,
{
// Assume all arguments are quoted.
lff.Arguments.push_back(
- cmListFileArgument(args[i], cmListFileArgument::Quoted,
- "[CMake-Plugin]", 0));
+ cmListFileArgument(args[i], cmListFileArgument::Quoted, 0));
}
cmExecutionStatus status;
return mf->ExecuteCommand(lff,status);
@@ -526,11 +525,9 @@ void * CCONV cmCreateSourceFile(void)
return (void*)new cmCPluginAPISourceFile;
}
-void * CCONV cmCreateNewSourceFile(void *arg)
+void * CCONV cmCreateNewSourceFile(void *)
{
- cmMakefile *mf = static_cast<cmMakefile *>(arg);
cmCPluginAPISourceFile *sf = new cmCPluginAPISourceFile;
- sf->Properties.SetCMakeInstance(mf->GetCMakeInstance());
return (void*)sf;
}
@@ -630,11 +627,7 @@ const char * CCONV cmSourceFileGetProperty(void *arg,const char *prop)
{
return sf->FullPath.c_str();
}
- bool chain = false;
- // Ignore chain because old code will not expect it and it is a
- // pain to implement here anyway.
- return sf->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE,
- chain);
+ return sf->Properties.GetPropertyValue(prop);
}
}
@@ -662,7 +655,7 @@ void CCONV cmSourceFileSetProperty(void *arg,const char *prop,
else if(prop)
{
if(!value) { value = "NOTFOUND"; }
- sf->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
+ sf->Properties.SetProperty(prop, value);
}
}
@@ -801,8 +794,7 @@ void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir,
// Implement the old SetName method code here.
if(headerFileOnly)
{
- sf->Properties.SetProperty("HEADER_FILE_ONLY", "1",
- cmProperty::SOURCE_FILE);
+ sf->Properties.SetProperty("HEADER_FILE_ONLY", "1");
}
sf->SourceName = name;
std::string fname = sf->SourceName;
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index e3b7a2b..5676dda 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -294,6 +294,7 @@ cmCTest::cmCTest()
this->LabelSummary = true;
this->ParallelLevel = 1;
this->ParallelLevelSetInCli = false;
+ this->TestLoad = 0;
this->SubmitIndex = 0;
this->Failover = false;
this->BatchJobs = false;
@@ -393,6 +394,11 @@ void cmCTest::SetParallelLevel(int level)
this->ParallelLevel = level < 1 ? 1 : level;
}
+void cmCTest::SetTestLoad(unsigned long load)
+{
+ this->TestLoad = load;
+}
+
//----------------------------------------------------------------------------
bool cmCTest::ShouldCompressTestOutput()
{
@@ -820,6 +826,20 @@ bool cmCTest::UpdateCTestConfiguration()
cmSystemTools::ChangeDirectory(this->BinaryDir);
}
this->TimeOut = atoi(this->GetCTestConfiguration("TimeOut").c_str());
+ std::string const& testLoad = this->GetCTestConfiguration("TestLoad");
+ if (!testLoad.empty())
+ {
+ unsigned long load;
+ if (cmSystemTools::StringToULong(testLoad.c_str(), &load))
+ {
+ this->SetTestLoad(load);
+ }
+ else
+ {
+ cmCTestLog(this, WARNING, "Invalid value for 'Test Load' : "
+ << testLoad << std::endl);
+ }
+ }
if ( this->ProduceXML )
{
this->CompressXMLFiles = cmSystemTools::IsOn(
@@ -1200,7 +1220,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
char* data;
int length;
- cmCTestLog(this, HANDLER_OUTPUT,
+ cmCTestLog(this, HANDLER_PROGRESS_OUTPUT,
" Each . represents " << tick_len << " bytes of output" << std::endl
<< " " << std::flush);
while(cmsysProcess_WaitForData(cp, &data, &length, 0))
@@ -1216,10 +1236,10 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
while ( output.size() > (tick * tick_len) )
{
tick ++;
- cmCTestLog(this, HANDLER_OUTPUT, "." << std::flush);
+ cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, "." << std::flush);
if ( tick % tick_line_len == 0 && tick > 0 )
{
- cmCTestLog(this, HANDLER_OUTPUT,
+ cmCTestLog(this, HANDLER_PROGRESS_OUTPUT,
" Size: "
<< int((double(output.size()) / 1024.0) + 1)
<< "K" << std::endl
@@ -1232,7 +1252,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
ofs << cmCTestLogWrite(data, length);
}
}
- cmCTestLog(this, OUTPUT, " Size of output: "
+ cmCTestLog(this, HANDLER_PROGRESS_OUTPUT, " Size of output: "
<< int(double(output.size()) / 1024.0) << "K" << std::endl);
cmsysProcess_WaitForExit(cp, 0);
@@ -2051,6 +2071,21 @@ bool cmCTest::HandleCommandLineArguments(size_t &i,
}
}
+ if(this->CheckArgument(arg, "--test-load") && i < args.size() - 1)
+ {
+ i++;
+ unsigned long load;
+ if (cmSystemTools::StringToULong(args[i].c_str(), &load))
+ {
+ this->SetTestLoad(load);
+ }
+ else
+ {
+ cmCTestLog(this, WARNING,
+ "Invalid value for 'Test Load' : " << args[i] << std::endl);
+ }
+ }
+
if(this->CheckArgument(arg, "--no-compress-output"))
{
this->CompressTestOutput = false;
@@ -3066,6 +3101,7 @@ static const char* cmCTestStringLogType[] =
"DEBUG",
"OUTPUT",
"HANDLER_OUTPUT",
+ "HANDLER_PROGRESS_OUTPUT",
"HANDLER_VERBOSE_OUTPUT",
"WARNING",
"ERROR_MESSAGE",
@@ -3104,6 +3140,11 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg,
{
return;
}
+ if ( logType == cmCTest::HANDLER_PROGRESS_OUTPUT &&
+ ( this->Debug || this->ExtraVerbose ) )
+ {
+ return;
+ }
if ( this->OutputLogFile )
{
bool display = true;
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index db3ea10..73c2807 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -161,6 +161,9 @@ public:
int GetParallelLevel() { return this->ParallelLevel; }
void SetParallelLevel(int);
+ unsigned long GetTestLoad() { return this->TestLoad; }
+ void SetTestLoad(unsigned long);
+
/**
* Check if CTest file exists
*/
@@ -379,6 +382,7 @@ public:
DEBUG = 0,
OUTPUT,
HANDLER_OUTPUT,
+ HANDLER_PROGRESS_OUTPUT,
HANDLER_VERBOSE_OUTPUT,
WARNING,
ERROR_MESSAGE,
@@ -499,6 +503,8 @@ private:
int ParallelLevel;
bool ParallelLevelSetInCli;
+ unsigned long TestLoad;
+
int CompatibilityMode;
// information for the --build-and-test options
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 108208e..54209c5 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -161,7 +161,6 @@ bool cmCacheManager::LoadCache(const std::string& path,
// Format is key:type=value
std::string helpString;
CacheEntry e;
- e.Properties.SetCMakeInstance(this->CMakeInstance);
cmSystemTools::GetLineFromStream(fin, buffer);
realbuffer = buffer.c_str();
while(*realbuffer != '0' &&
@@ -323,7 +322,6 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
{
// Create an entry and store the property.
CacheEntry& ne = this->Cache[key];
- ne.Properties.SetCMakeInstance(this->CMakeInstance);
ne.Type = cmState::UNINITIALIZED;
ne.SetProperty(*p, e.Value.c_str());
}
@@ -645,7 +643,6 @@ void cmCacheManager::AddCacheEntry(const std::string& key,
cmState::CacheEntryType type)
{
CacheEntry& e = this->Cache[key];
- e.Properties.SetCMakeInstance(this->CMakeInstance);
if ( value )
{
e.Value = value;
@@ -744,9 +741,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
{
return this->Value.c_str();
}
- bool c = false;
- return
- this->Properties.GetPropertyValue(prop, cmProperty::CACHE, c);
+ return this->Properties.GetPropertyValue(prop);
}
//----------------------------------------------------------------------------
@@ -763,7 +758,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
}
else
{
- this->Properties.SetProperty(prop, value, cmProperty::CACHE);
+ this->Properties.SetProperty(prop, value);
}
}
@@ -789,7 +784,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
}
else
{
- this->Properties.AppendProperty(prop, value, cmProperty::CACHE, asString);
+ this->Properties.AppendProperty(prop, value, asString);
}
}
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index bd098a5..14e9e56 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -14,7 +14,7 @@
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmState.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmCommandArgumentLexer.h"
@@ -141,8 +141,9 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
{
std::ostringstream msg;
cmListFileContext lfc;
- lfc.FilePath = this->Makefile->GetLocalGenerator()
- ->Convert(this->FileName, cmLocalGenerator::HOME);
+ cmOutputConverter converter(this->Makefile->GetStateSnapshot());
+ lfc.FilePath = converter.Convert(this->FileName,
+ cmOutputConverter::HOME);
lfc.Line = this->FileLine;
msg << "uninitialized variable \'" << var << "\'";
diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h
index d375ae6..387afc6 100644
--- a/Source/cmCommandArgumentParserHelper.h
+++ b/Source/cmCommandArgumentParserHelper.h
@@ -80,8 +80,6 @@ private:
std::string::size_type InputBufferPos;
std::string InputBuffer;
std::vector<char> OutputBuffer;
- int CurrentLine;
- int Verbose;
void Print(const char* place, const char* str);
void SafePrintMissing(const char* str, int line, int cnt);
@@ -94,12 +92,14 @@ private:
std::vector<char*> Variables;
const cmMakefile* Makefile;
std::string Result;
+ std::string ErrorString;
const char* FileName;
+ long FileLine;
+ int CurrentLine;
+ int Verbose;
bool WarnUninitialized;
bool CheckSystemVars;
- long FileLine;
bool EscapeQuotes;
- std::string ErrorString;
bool NoEscapeMode;
bool ReplaceAtSyntax;
bool RemoveEmpty;
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
new file mode 100644
index 0000000..ce351ee
--- /dev/null
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -0,0 +1,360 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 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 "cmCommonTargetGenerator.h"
+
+#include "cmComputeLinkInformation.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalCommonGenerator.h"
+#include "cmLocalCommonGenerator.h"
+#include "cmMakefile.h"
+#include "cmSourceFile.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
+
+cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
+ : GeneratorTarget(gt)
+ , Target(gt->Target)
+ , Makefile(gt->Makefile)
+ , LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
+ , GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
+ gt->LocalGenerator->GetGlobalGenerator()))
+ , ConfigName(LocalGenerator->GetConfigName())
+ , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
+ , FortranModuleDirectoryComputed(false)
+{
+}
+
+cmCommonTargetGenerator::~cmCommonTargetGenerator()
+{
+}
+
+std::string const& cmCommonTargetGenerator::GetConfigName() const
+{
+ return this->ConfigName;
+}
+
+std::string cmCommonTargetGenerator::Convert(
+ std::string const& source,
+ cmLocalGenerator::RelativeRoot relative,
+ cmLocalGenerator::OutputFormat output)
+{
+ return this->LocalGenerator->Convert(source, relative, output);
+}
+
+//----------------------------------------------------------------------------
+const char* cmCommonTargetGenerator::GetFeature(const std::string& feature)
+{
+ return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
+}
+
+//----------------------------------------------------------------------------
+bool cmCommonTargetGenerator::GetFeatureAsBool(const std::string& feature)
+{
+ return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName);
+}
+
+//----------------------------------------------------------------------------
+void cmCommonTargetGenerator::AddFeatureFlags(
+ std::string& flags, const std::string& lang
+ )
+{
+ // Add language-specific flags.
+ this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
+
+ if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION"))
+ {
+ this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
+{
+ if(this->ModuleDefinitionFile.empty())
+ {
+ return;
+ }
+
+ // TODO: Create a per-language flag variable.
+ const char* defFileFlag =
+ this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG");
+ if(!defFileFlag)
+ {
+ return;
+ }
+
+ // Append the flag and value. Use ConvertToLinkReference to help
+ // vs6's "cl -link" pass it to the linker.
+ std::string flag = defFileFlag;
+ flag += (this->LocalGenerator->ConvertToLinkReference(
+ this->ModuleDefinitionFile));
+ this->LocalGenerator->AppendFlags(flags, flag);
+}
+
+//----------------------------------------------------------------------------
+const char* cmCommonTargetGenerator::GetFortranModuleDirectory()
+{
+ // Compute the module directory.
+ if(!this->FortranModuleDirectoryComputed)
+ {
+ const char* target_mod_dir =
+ this->Target->GetProperty("Fortran_MODULE_DIRECTORY");
+ const char* moddir_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
+ if(target_mod_dir && moddir_flag)
+ {
+ // Compute the full path to the module directory.
+ if(cmSystemTools::FileIsFullPath(target_mod_dir))
+ {
+ // Already a full path.
+ this->FortranModuleDirectory = target_mod_dir;
+ }
+ else
+ {
+ // Interpret relative to the current output directory.
+ this->FortranModuleDirectory =
+ this->Makefile->GetCurrentBinaryDirectory();
+ this->FortranModuleDirectory += "/";
+ this->FortranModuleDirectory += target_mod_dir;
+ }
+
+ // Make sure the module output directory exists.
+ cmSystemTools::MakeDirectory(this->FortranModuleDirectory.c_str());
+ }
+ this->FortranModuleDirectoryComputed = true;
+ }
+
+ // Return the computed directory.
+ if(this->FortranModuleDirectory.empty())
+ {
+ return 0;
+ }
+ else
+ {
+ return this->FortranModuleDirectory.c_str();
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
+{
+ // Enable module output if necessary.
+ if(const char* modout_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG"))
+ {
+ this->LocalGenerator->AppendFlags(flags, modout_flag);
+ }
+
+ // Add a module output directory flag if necessary.
+ const char* mod_dir = this->GetFortranModuleDirectory();
+ if(!mod_dir)
+ {
+ mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
+ }
+ if(mod_dir)
+ {
+ const char* moddir_flag =
+ this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
+ std::string modflag = moddir_flag;
+ modflag += this->Convert(mod_dir,
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ this->LocalGenerator->AppendFlags(flags, modflag);
+ }
+
+ // If there is a separate module path flag then duplicate the
+ // include path with it. This compiler does not search the include
+ // path for modules.
+ if(const char* modpath_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
+ {
+ std::vector<std::string> includes;
+ const std::string& config =
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ this->LocalGenerator->GetIncludeDirectories(includes,
+ this->GeneratorTarget,
+ "C", config);
+ for(std::vector<std::string>::const_iterator idi = includes.begin();
+ idi != includes.end(); ++idi)
+ {
+ std::string flg = modpath_flag;
+ flg += this->Convert(*idi,
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL);
+ this->LocalGenerator->AppendFlags(flags, flg);
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+cmCommonTargetGenerator
+::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source)
+{
+ const char* srcfmt = source.GetProperty("Fortran_FORMAT");
+ cmLocalGenerator::FortranFormat format =
+ this->LocalGenerator->GetFortranFormat(srcfmt);
+ if(format == cmLocalGenerator::FortranFormatNone)
+ {
+ const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT");
+ format = this->LocalGenerator->GetFortranFormat(tgtfmt);
+ }
+ const char* var = 0;
+ switch (format)
+ {
+ case cmLocalGenerator::FortranFormatFixed:
+ var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; break;
+ case cmLocalGenerator::FortranFormatFree:
+ var = "CMAKE_Fortran_FORMAT_FREE_FLAG"; break;
+ default: break;
+ }
+ if(var)
+ {
+ this->LocalGenerator->AppendFlags(
+ flags, this->Makefile->GetDefinition(var));
+ }
+}
+
+//----------------------------------------------------------------------------
+std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
+{
+ if(!this->Makefile->IsOn("APPLE"))
+ {
+ return std::string();
+ }
+
+ std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag =
+ this->Makefile->GetDefinition(fwSearchFlagVar);
+ if(!(fwSearchFlag && *fwSearchFlag))
+ {
+ return std::string();
+ }
+
+ std::set<std::string> emitted;
+#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
+ emitted.insert("/System/Library/Frameworks");
+#endif
+ std::vector<std::string> includes;
+
+ const std::string& config =
+ this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ this->LocalGenerator->GetIncludeDirectories(includes,
+ this->GeneratorTarget,
+ "C", config);
+ // check all include directories for frameworks as this
+ // will already have added a -F for the framework
+ for(std::vector<std::string>::iterator i = includes.begin();
+ i != includes.end(); ++i)
+ {
+ if(this->Target->NameResolvesToFramework(*i))
+ {
+ std::string frameworkDir = *i;
+ frameworkDir += "/../";
+ frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
+ emitted.insert(frameworkDir);
+ }
+ }
+
+ std::string flags;
+ const char* cfg = this->LocalGenerator->GetConfigName().c_str();
+ if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
+ {
+ std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
+ for(std::vector<std::string>::const_iterator i = frameworks.begin();
+ i != frameworks.end(); ++i)
+ {
+ if(emitted.insert(*i).second)
+ {
+ flags += fwSearchFlag;
+ flags += this->LocalGenerator
+ ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL);
+ flags += " ";
+ }
+ }
+ }
+ return flags;
+}
+
+//----------------------------------------------------------------------------
+std::string cmCommonTargetGenerator::GetFlags(const std::string &l)
+{
+ ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
+ if (i == this->FlagsByLanguage.end())
+ {
+ std::string flags;
+ const char *lang = l.c_str();
+
+ // Add language feature flags.
+ this->AddFeatureFlags(flags, lang);
+
+ this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
+ lang, this->ConfigName);
+
+ // Fortran-specific flags computed for this target.
+ if(l == "Fortran")
+ {
+ this->AddFortranFlags(flags);
+ }
+
+ this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
+ lang, this->ConfigName);
+
+ this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target,
+ lang);
+
+ // Add include directory flags.
+ this->AddIncludeFlags(flags, lang);
+
+ // Append old-style preprocessor definition flags.
+ this->LocalGenerator->
+ AppendFlags(flags, this->Makefile->GetDefineFlags());
+
+ // Add framework directory flags.
+ this->LocalGenerator->
+ AppendFlags(flags,this->GetFrameworkFlags(l));
+
+ // Add target-specific flags.
+ this->LocalGenerator->AddCompileOptions(flags, this->Target,
+ lang, this->ConfigName);
+
+ ByLanguageMap::value_type entry(l, flags);
+ i = this->FlagsByLanguage.insert(entry).first;
+ }
+ return i->second;
+}
+
+std::string cmCommonTargetGenerator::GetDefines(const std::string &l)
+{
+ ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
+ if (i == this->DefinesByLanguage.end())
+ {
+ std::set<std::string> defines;
+ const char *lang = l.c_str();
+ // Add the export symbol definition for shared library objects.
+ if(const char* exportMacro = this->Target->GetExportMacro())
+ {
+ this->LocalGenerator->AppendDefines(defines, exportMacro);
+ }
+
+ // Add preprocessor definitions for this target and configuration.
+ this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
+ this->LocalGenerator->GetConfigName(), l);
+
+ std::string definesString;
+ this->LocalGenerator->JoinDefines(defines, definesString, lang);
+
+ ByLanguageMap::value_type entry(l, definesString);
+ i = this->DefinesByLanguage.insert(entry).first;
+ }
+ return i->second;
+}
diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h
new file mode 100644
index 0000000..e184dba
--- /dev/null
+++ b/Source/cmCommonTargetGenerator.h
@@ -0,0 +1,88 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCommonTargetGenerator_h
+#define cmCommonTargetGenerator_h
+
+#include "cmStandardIncludes.h"
+
+#include "cmLocalGenerator.h"
+
+class cmGeneratorTarget;
+class cmGlobalCommonGenerator;
+class cmLocalCommonGenerator;
+class cmMakefile;
+class cmSourceFile;
+class cmTarget;
+
+/** \class cmCommonTargetGenerator
+ * \brief Common infrastructure for Makefile and Ninja per-target generators
+ */
+class cmCommonTargetGenerator
+{
+public:
+ cmCommonTargetGenerator(cmGeneratorTarget* gt);
+ virtual ~cmCommonTargetGenerator();
+
+ std::string const& GetConfigName() const;
+
+protected:
+
+ // Add language feature flags.
+ void AddFeatureFlags(std::string& flags, const std::string& lang);
+
+ // Feature query methods.
+ const char* GetFeature(const std::string& feature);
+ bool GetFeatureAsBool(const std::string& feature);
+
+ // Helper to add flag for windows .def file.
+ void AddModuleDefinitionFlag(std::string& flags);
+
+ cmGeneratorTarget* GeneratorTarget;
+ cmTarget* Target;
+ cmMakefile* Makefile;
+ cmLocalCommonGenerator* LocalGenerator;
+ cmGlobalCommonGenerator* GlobalGenerator;
+ std::string ConfigName;
+
+ // The windows module definition source file (.def), if any.
+ std::string ModuleDefinitionFile;
+
+ // Target-wide Fortran module output directory.
+ bool FortranModuleDirectoryComputed;
+ std::string FortranModuleDirectory;
+ const char* GetFortranModuleDirectory();
+
+ // Compute target-specific Fortran language flags.
+ void AddFortranFlags(std::string& flags);
+
+ std::string Convert(std::string const& source,
+ cmLocalGenerator::RelativeRoot relative,
+ cmLocalGenerator::OutputFormat output =
+ cmLocalGenerator::UNCHANGED);
+
+ void AppendFortranFormatFlags(std::string& flags,
+ cmSourceFile const& source);
+
+ // Return the a string with -F flags on apple
+ std::string GetFrameworkFlags(std::string const& l);
+
+ virtual void AddIncludeFlags(std::string& flags,
+ std::string const& lang) = 0;
+
+ typedef std::map<std::string, std::string> ByLanguageMap;
+ std::string GetFlags(const std::string &l);
+ ByLanguageMap FlagsByLanguage;
+ std::string GetDefines(const std::string &l);
+ ByLanguageMap DefinesByLanguage;
+};
+
+#endif
diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h
index a2ce946..4dbac4a 100644
--- a/Source/cmComputeComponentGraph.h
+++ b/Source/cmComputeComponentGraph.h
@@ -67,17 +67,17 @@ private:
int Root;
int VisitIndex;
};
- int TarjanWalkId;
std::vector<int> TarjanVisited;
std::vector<int> TarjanComponents;
std::vector<TarjanEntry> TarjanEntries;
+ std::vector<NodeList> Components;
std::stack<int> TarjanStack;
+ int TarjanWalkId;
int TarjanIndex;
void Tarjan();
void TarjanVisit(int i);
// Connected components.
- std::vector<NodeList> Components;
};
#endif
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 09b9d70..51a08c5 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -61,14 +61,7 @@ private:
cmMakefile* Makefile;
cmGlobalGenerator const* GlobalGenerator;
cmake* CMakeInstance;
- bool DebugMode;
-
- // Configuration information.
- bool HasConfig;
std::string Config;
- cmTarget::LinkLibraryType LinkType;
-
- // Output information.
EntryVector FinalLinkEntries;
typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType;
@@ -131,7 +124,7 @@ private:
void OrderLinkEntires();
std::vector<char> ComponentVisited;
std::vector<int> ComponentOrder;
- int ComponentOrderId;
+
struct PendingComponent
{
// The real component id. Needed because the map is indexed by
@@ -158,11 +151,14 @@ private:
// Record of the original link line.
std::vector<int> OriginalEntries;
+ std::set<cmTarget const*> OldWrongConfigItems;
+ void CheckWrongConfigItem(cmLinkItem const& item);
- // Compatibility help.
+ int ComponentOrderId;
+ cmTarget::LinkLibraryType LinkType;
+ bool HasConfig;
+ bool DebugMode;
bool OldLinkDirMode;
- void CheckWrongConfigItem(cmLinkItem const& item);
- std::set<cmTarget const*> OldWrongConfigItems;
};
#endif
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e6cbe60..1f3046a 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -16,7 +16,7 @@
#include "cmGlobalGenerator.h"
#include "cmState.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmMakefile.h"
#include "cmTarget.h"
#include "cmake.h"
@@ -246,7 +246,6 @@ cmComputeLinkInformation
// Store context information.
this->Target = target;
this->Makefile = this->Target->GetMakefile();
- this->LocalGenerator = this->Makefile->GetLocalGenerator();
this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
@@ -1395,7 +1394,8 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
// Add the item using the -framework option.
this->Items.push_back(Item("-framework", false));
- fw = this->LocalGenerator->EscapeForShell(fw);
+ cmOutputConverter converter(this->Makefile->GetStateSnapshot());
+ fw = converter.EscapeForShell(fw);
this->Items.push_back(Item(fw, false));
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 8847141..3afbb92 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -18,7 +18,6 @@
class cmake;
class cmGlobalGenerator;
-class cmLocalGenerator;
class cmMakefile;
class cmTarget;
class cmOrderDirectories;
@@ -75,14 +74,12 @@ private:
// Context information.
cmTarget const* Target;
cmMakefile* Makefile;
- cmLocalGenerator* LocalGenerator;
cmGlobalGenerator* GlobalGenerator;
cmake* CMakeInstance;
// Configuration information.
std::string Config;
std::string LinkLanguage;
- bool LinkDependsNoShared;
// Modes for dealing with dependent shared libraries.
enum SharedDepMode
@@ -93,8 +90,6 @@ private:
SharedDepModeLink // List file on link line
};
- // System info.
- bool UseImportLibrary;
const char* LoaderFlag;
std::string LibLinkFlag;
std::string LibLinkFileFlag;
@@ -102,22 +97,18 @@ private:
std::string RuntimeFlag;
std::string RuntimeSep;
std::string RuntimeAlways;
- bool RuntimeUseChrpath;
- bool NoSONameUsesPath;
- bool LinkWithRuntimePath;
std::string RPathLinkFlag;
SharedDepMode SharedDependencyMode;
+ enum LinkType { LinkUnknown, LinkStatic, LinkShared };
+ void SetCurrentLinkType(LinkType lt);
+
// Link type adjustment.
void ComputeLinkTypeInfo();
- enum LinkType { LinkUnknown, LinkStatic, LinkShared };
LinkType StartLinkType;
LinkType CurrentLinkType;
std::string StaticLinkTypeFlag;
std::string SharedLinkTypeFlag;
- bool LinkTypeEnabled;
- void SetCurrentLinkType(LinkType lt);
- bool ArchivesMayBeShared;
// Link item parsing.
void ComputeItemParserInfo();
@@ -129,7 +120,6 @@ private:
cmsys::RegularExpression ExtractSharedLibraryName;
cmsys::RegularExpression ExtractAnyLibraryName;
std::string SharedRegexString;
- bool OpenBSD;
void AddLinkPrefix(const char* p);
void AddLinkExtension(const char* e, LinkType type);
std::string CreateExtensionRegex(std::vector<std::string> const& exts,
@@ -173,20 +163,27 @@ private:
std::set<std::string> OldLinkDirMask;
std::vector<std::string> OldLinkDirItems;
std::vector<std::string> OldUserFlagItems;
- bool OldLinkDirMode;
-
- // CMP0060 warnings.
- bool CMP0060Warn;
std::set<std::string> CMP0060WarnItems;
-
+ // Dependent library path computation.
+ cmOrderDirectories* OrderDependentRPath;
// Runtime path computation.
cmOrderDirectories* OrderRuntimeSearchPath;
+
+ bool OldLinkDirMode;
+ bool OpenBSD;
+ bool LinkDependsNoShared;
+ bool UseImportLibrary;
+ bool RuntimeUseChrpath;
+ bool NoSONameUsesPath;
+ bool LinkWithRuntimePath;
+ bool LinkTypeEnabled;
+ bool ArchivesMayBeShared;
+ bool CMP0060Warn;
+
void AddLibraryRuntimeInfo(std::string const& fullPath,
cmTarget const* target);
void AddLibraryRuntimeInfo(std::string const& fullPath);
- // Dependent library path computation.
- cmOrderDirectories* OrderDependentRPath;
};
#endif
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 87b47b4..c4a03a0 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -147,12 +147,12 @@ bool cmComputeTargetDepends::Compute()
//----------------------------------------------------------------------------
void
-cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
+cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
cmTargetDependSet& deps)
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget const*, int>::const_iterator tii
+ std::map<cmGeneratorTarget const*, int>::const_iterator tii
= this->TargetIndex.find(t);
assert(tii != this->TargetIndex.end());
int i = tii->second;
@@ -161,7 +161,7 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget const* t,
EdgeList const& nl = this->FinalGraph[i];
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- cmTarget const* dep = this->Targets[*ni];
+ cmGeneratorTarget const* dep = this->Targets[*ni];
cmTargetDependSet::iterator di = deps.insert(dep).first;
di->SetType(ni->IsStrong());
}
@@ -180,9 +180,11 @@ void cmComputeTargetDepends::CollectTargets()
ti != targets.end(); ++ti)
{
cmTarget const* target = &ti->second;
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(target);
int index = static_cast<int>(this->Targets.size());
- this->TargetIndex[target] = index;
- this->Targets.push_back(target);
+ this->TargetIndex[gt] = index;
+ this->Targets.push_back(gt);
}
}
}
@@ -204,7 +206,7 @@ void cmComputeTargetDepends::CollectDepends()
void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
{
// Get the depender.
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
{
return;
@@ -216,10 +218,9 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// deal with config-specific dependencies.
{
std::set<std::string> emitted;
- cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(depender);
std::vector<std::string> configs;
- depender->GetMakefile()->GetConfigurations(configs);
+ depender->Makefile->GetConfigurations(configs);
if (configs.empty())
{
configs.push_back("");
@@ -228,7 +229,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
it != configs.end(); ++it)
{
std::vector<cmSourceFile const*> objectFiles;
- gt->GetExternalObjects(objectFiles, *it);
+ depender->GetExternalObjects(objectFiles, *it);
for(std::vector<cmSourceFile const*>::const_iterator
oi = objectFiles.begin(); oi != objectFiles.end(); ++oi)
{
@@ -244,15 +245,15 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
->IssueMessage(cmake::FATAL_ERROR,
"Only executables and non-OBJECT libraries may "
"reference target objects.",
- depender->GetBacktrace());
+ depender->Target->GetBacktrace());
return;
}
- const_cast<cmTarget*>(depender)->AddUtility(objLib);
+ const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(objLib);
}
}
cmTarget::LinkImplementation const* impl =
- depender->GetLinkImplementation(*it);
+ depender->Target->GetLinkImplementation(*it);
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -272,7 +273,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
// Loop over all utility dependencies.
{
- std::set<cmLinkItem> const& tutils = depender->GetUtilityItems();
+ std::set<cmLinkItem> const& tutils = depender->Target->GetUtilityItems();
std::set<std::string> emitted;
// A target should not depend on itself.
emitted.insert(depender->GetName());
@@ -290,13 +291,14 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
- cmTarget const* dependee,
- const std::string& config,
- std::set<std::string> &emitted)
+ const cmGeneratorTarget* dependee,
+ const std::string& config,
+ std::set<std::string> &emitted)
{
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
if(cmTarget::LinkInterface const* iface =
- dependee->GetLinkInterface(config, depender))
+ dependee->Target->GetLinkInterface(config,
+ depender->Target))
{
for(std::vector<cmLinkItem>::const_iterator
lib = iface->Libraries.begin();
@@ -317,7 +319,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
cmLinkItem const& dependee_name,
std::set<std::string> &emitted)
{
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
cmTarget const* dependee = dependee_name.Target;
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
@@ -331,16 +333,17 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(dependee)
{
- this->AddInterfaceDepends(depender_index, dependee, "", emitted);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(dependee);
+ this->AddInterfaceDepends(depender_index, gt, "", emitted);
std::vector<std::string> configs;
- depender->GetMakefile()->GetConfigurations(configs);
+ depender->Makefile->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();
it != configs.end(); ++it)
{
// A target should not depend on itself.
emitted.insert(depender->GetName());
- this->AddInterfaceDepends(depender_index, dependee,
- *it, emitted);
+ this->AddInterfaceDepends(depender_index, gt, *it, emitted);
}
}
}
@@ -351,7 +354,7 @@ void cmComputeTargetDepends::AddTargetDepend(
bool linking)
{
// Get the depender.
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
// Check the target's makefile first.
cmTarget const* dependee = dependee_name.Target;
@@ -362,7 +365,7 @@ void cmComputeTargetDepends::AddTargetDepend(
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
std::ostringstream e;
- switch(depender->GetPolicyStatusCMP0046())
+ switch(depender->Target->GetPolicyStatusCMP0046())
{
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";
@@ -383,7 +386,7 @@ void cmComputeTargetDepends::AddTargetDepend(
<< "\" of target \"" << depender->GetName() << "\" does not exist.";
cmListFileBacktrace const* backtrace =
- depender->GetUtilityBacktrace(dependee_name);
+ depender->Target->GetUtilityBacktrace(dependee_name);
if(backtrace)
{
cm->IssueMessage(messageType, e.str(), *backtrace);
@@ -408,27 +411,31 @@ void cmComputeTargetDepends::AddTargetDepend(
if(dependee)
{
- this->AddTargetDepend(depender_index, dependee, linking);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(dependee);
+ this->AddTargetDepend(depender_index, gt, linking);
}
}
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddTargetDepend(int depender_index,
- cmTarget const* dependee,
+ const cmGeneratorTarget* dependee,
bool linking)
{
- if(dependee->IsImported() ||
+ if(dependee->Target->IsImported() ||
dependee->GetType() == cmTarget::INTERFACE_LIBRARY)
{
// Skip IMPORTED and INTERFACE targets but follow their utility
// dependencies.
- std::set<cmLinkItem> const& utils = dependee->GetUtilityItems();
+ std::set<cmLinkItem> const& utils = dependee->Target->GetUtilityItems();
for(std::set<cmLinkItem>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
if(cmTarget const* transitive_dependee = i->Target)
{
- this->AddTargetDepend(depender_index, transitive_dependee, false);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(transitive_dependee);
+ this->AddTargetDepend(depender_index, gt, false);
}
}
}
@@ -436,7 +443,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
{
// Lookup the index for this target. All targets should be known by
// this point.
- std::map<cmTarget const*, int>::const_iterator tii =
+ std::map<cmGeneratorTarget const*, int>::const_iterator tii =
this->TargetIndex.find(dependee);
assert(tii != this->TargetIndex.end());
int dependee_index = tii->second;
@@ -457,13 +464,13 @@ cmComputeTargetDepends::DisplayGraph(Graph const& graph,
for(int depender_index = 0; depender_index < n; ++depender_index)
{
EdgeList const& nl = graph[depender_index];
- cmTarget const* depender = this->Targets[depender_index];
+ cmGeneratorTarget const* depender = this->Targets[depender_index];
fprintf(stderr, "target %d is [%s]\n",
depender_index, depender->GetName().c_str());
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
int dependee_index = *ni;
- cmTarget const* dependee = this->Targets[dependee_index];
+ cmGeneratorTarget const* dependee = this->Targets[dependee_index];
fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index,
dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak");
}
@@ -550,11 +557,11 @@ cmComputeTargetDepends
{
// Get the depender.
int i = *ci;
- cmTarget const* depender = this->Targets[i];
+ cmGeneratorTarget const* depender = this->Targets[i];
// Describe the depender.
e << " \"" << depender->GetName() << "\" of type "
- << cmTarget::GetTargetTypeName(depender->GetType()) << "\n";
+ << cmTarget::GetTargetTypeName(depender->Target->GetType()) << "\n";
// List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i];
@@ -563,7 +570,7 @@ cmComputeTargetDepends
int j = *ni;
if(cmap[j] == c)
{
- cmTarget const* dependee = this->Targets[j];
+ cmGeneratorTarget 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 902f342..6100d97 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -21,7 +21,7 @@
class cmComputeComponentGraph;
class cmGlobalGenerator;
class cmLinkItem;
-class cmTarget;
+class cmGeneratorTarget;
class cmTargetDependSet;
/** \class cmComputeTargetDepends
@@ -39,9 +39,10 @@ public:
bool Compute();
- std::vector<cmTarget const*> const&
+ std::vector<cmGeneratorTarget const*> const&
GetTargets() const { return this->Targets; }
- void GetTargetDirectDepends(cmTarget const* t, cmTargetDependSet& deps);
+ void GetTargetDirectDepends(cmGeneratorTarget const* t,
+ cmTargetDependSet& deps);
private:
void CollectTargets();
void CollectDepends();
@@ -49,13 +50,14 @@ private:
void AddTargetDepend(int depender_index,
cmLinkItem const& dependee_name,
bool linking);
- void AddTargetDepend(int depender_index, cmTarget const* dependee,
+ void AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee,
bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
void AddInterfaceDepends(int depender_index,
cmLinkItem const& dependee_name,
std::set<std::string> &emitted);
- void AddInterfaceDepends(int depender_index, cmTarget const* dependee,
+ void AddInterfaceDepends(int depender_index,
+ cmGeneratorTarget const* dependee,
const std::string& config,
std::set<std::string> &emitted);
cmGlobalGenerator* GlobalGenerator;
@@ -63,8 +65,8 @@ private:
bool NoCycles;
// Collect all targets.
- std::vector<cmTarget const*> Targets;
- std::map<cmTarget const*, int> TargetIndex;
+ std::vector<cmGeneratorTarget const*> Targets;
+ std::map<cmGeneratorTarget 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 dd276a8..e1e1a5c 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -11,7 +11,7 @@
============================================================================*/
#include "cmCoreTryCompile.h"
#include "cmake.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmGlobalGenerator.h"
#include "cmAlgorithms.h"
#include "cmExportTryCompileFileGenerator.h"
@@ -322,7 +322,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string langFlags = "CMAKE_" + *li + "_FLAGS";
const char* flags = this->Makefile->GetDefinition(langFlags);
fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(),
- cmLocalGenerator::EscapeForCMake(flags?flags:"").c_str());
+ cmOutputConverter::EscapeForCMake(flags?flags:"").c_str());
fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
}
@@ -355,7 +355,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
const char* exeLinkFlags =
this->Makefile->GetDefinition("CMAKE_EXE_LINKER_FLAGS");
fprintf(fout, "set(CMAKE_EXE_LINKER_FLAGS %s)\n",
- cmLocalGenerator::EscapeForCMake(
+ cmOutputConverter::EscapeForCMake(
exeLinkFlags ? exeLinkFlags : "").c_str());
} break;
}
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 015825d..7c37e3b 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -17,7 +17,7 @@
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
- : Backtrace(NULL)
+ : Backtrace()
{
this->HaveComment = false;
this->EscapeOldStyle = true;
@@ -26,46 +26,6 @@ cmCustomCommand::cmCustomCommand()
}
//----------------------------------------------------------------------------
-cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
- Outputs(r.Outputs),
- Byproducts(r.Byproducts),
- Depends(r.Depends),
- CommandLines(r.CommandLines),
- HaveComment(r.HaveComment),
- Comment(r.Comment),
- WorkingDirectory(r.WorkingDirectory),
- EscapeAllowMakeVars(r.EscapeAllowMakeVars),
- EscapeOldStyle(r.EscapeOldStyle),
- Backtrace(r.Backtrace),
- UsesTerminal(r.UsesTerminal)
-{
-}
-
-//----------------------------------------------------------------------------
-cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
-{
- if(this == &r)
- {
- return *this;
- }
-
- this->Outputs = r.Outputs;
- this->Byproducts= r.Byproducts;
- this->Depends = r.Depends;
- this->CommandLines = r.CommandLines;
- this->HaveComment = r.HaveComment;
- this->Comment = r.Comment;
- this->WorkingDirectory = r.WorkingDirectory;
- this->EscapeAllowMakeVars = r.EscapeAllowMakeVars;
- this->EscapeOldStyle = r.EscapeOldStyle;
- this->ImplicitDepends = r.ImplicitDepends;
- this->Backtrace = r.Backtrace;
- this->UsesTerminal = r.UsesTerminal;
-
- return *this;
-}
-
-//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
const std::vector<std::string>& outputs,
const std::vector<std::string>& byproducts,
@@ -77,15 +37,13 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
Byproducts(byproducts),
Depends(depends),
CommandLines(commandLines),
- HaveComment(comment?true:false),
+ Backtrace(),
Comment(comment?comment:""),
WorkingDirectory(workingDirectory?workingDirectory:""),
+ HaveComment(comment?true:false),
EscapeAllowMakeVars(false),
- EscapeOldStyle(true),
- Backtrace(NULL)
+ EscapeOldStyle(true)
{
- this->EscapeOldStyle = true;
- this->EscapeAllowMakeVars = false;
if(mf)
{
this->Backtrace = mf->GetBacktrace();
@@ -93,11 +51,6 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
}
//----------------------------------------------------------------------------
-cmCustomCommand::~cmCustomCommand()
-{
-}
-
-//----------------------------------------------------------------------------
const std::vector<std::string>& cmCustomCommand::GetOutputs() const
{
return this->Outputs;
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index 0bfaef2..f9b38c3 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -26,8 +26,6 @@ class cmCustomCommand
public:
/** Default and copy constructors for STL containers. */
cmCustomCommand();
- cmCustomCommand(const cmCustomCommand& r);
- cmCustomCommand& operator=(cmCustomCommand const& r);
/** Main constructor specifies all information for the command. */
cmCustomCommand(cmMakefile const* mf,
@@ -38,8 +36,6 @@ public:
const char* comment,
const char* workingDirectory);
- ~cmCustomCommand();
-
/** Get the output file produced by the command. */
const std::vector<std::string>& GetOutputs() const;
@@ -93,13 +89,13 @@ private:
std::vector<std::string> Byproducts;
std::vector<std::string> Depends;
cmCustomCommandLines CommandLines;
- bool HaveComment;
+ cmListFileBacktrace Backtrace;
+ ImplicitDependsList ImplicitDepends;
std::string Comment;
std::string WorkingDirectory;
+ bool HaveComment;
bool EscapeAllowMakeVars;
bool EscapeOldStyle;
- cmListFileBacktrace Backtrace;
- ImplicitDependsList ImplicitDepends;
bool UsesTerminal;
};
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index d23f815..11308c6 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -13,13 +13,13 @@
#include "cmMakefile.h"
#include "cmCustomCommand.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmGeneratorExpression.h"
//----------------------------------------------------------------------------
cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
- CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
+ CC(cc), Config(config), Makefile(mf),
OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false)
{
@@ -96,7 +96,8 @@ cmCustomCommandGenerator
}
else
{
- cmd += this->LG->EscapeForShell(arg, this->MakeVars);
+ cmOutputConverter converter(this->Makefile->GetStateSnapshot());
+ cmd += converter.EscapeForShell(arg, this->MakeVars);
}
}
}
diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h
index b4ae014..7ad95d1 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -16,7 +16,6 @@
class cmCustomCommand;
class cmMakefile;
-class cmLocalGenerator;
class cmGeneratorExpression;
class cmCustomCommandGenerator
@@ -24,7 +23,6 @@ class cmCustomCommandGenerator
cmCustomCommand const& CC;
std::string Config;
cmMakefile* Makefile;
- cmLocalGenerator* LG;
bool OldStyle;
bool MakeVars;
cmGeneratorExpression* GE;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index f12116e..1b2586c 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -143,7 +143,7 @@ cmDependsFortran
std::vector<std::string> definitions;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
if(const char* c_defines =
- mf->GetDefinition("CMAKE_TARGET_DEFINITIONS"))
+ mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran"))
{
cmSystemTools::ExpandListArgument(c_defines, definitions);
}
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index 8854c36..b6c5fde 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -13,7 +13,6 @@
#define _cmDocumentation_h
#include "cmStandardIncludes.h"
-#include "cmProperty.h"
#include "cmDocumentationFormatter.h"
#include "cmDocumentationSection.h"
#include "cmake.h"
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index e021d0b..41785c2 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -156,7 +156,7 @@ bool cmExecProgramCommand::RunCommand(const char* command,
verbose = false;
}
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
// if the command does not start with a quote, then
// try to find the program, and if the program can not be
// found use system to run the command as it must be a built in
@@ -219,7 +219,7 @@ bool cmExecProgramCommand::RunCommand(const char* command,
return false;
}
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
if(dir)
{
cmsysProcess_SetWorkingDirectory(cp, dir);
@@ -305,7 +305,7 @@ bool cmExecProgramCommand::RunCommand(const char* command,
}
if(!msg.empty())
{
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
// Old Windows process execution printed this info.
msg += "\n\nfor command: ";
msg += command;
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index bf18deb..568ce89 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -18,7 +18,7 @@
//----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
- : Backtrace(NULL)
+ : Backtrace()
{
this->Makefile = 0;
this->ExportSet = 0;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index a51fb2a..094ad4f 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -23,12 +23,28 @@
#include "cmVersion.h"
#include "cmComputeLinkInformation.h"
#include "cmAlgorithms.h"
+#include "cmOutputConverter.h"
#include <cmsys/auto_ptr.hxx>
#include <cmsys/FStream.hxx>
#include <assert.h>
//----------------------------------------------------------------------------
+static std::string cmExportFileGeneratorEscape(std::string const& str)
+{
+ // Escape a property value for writing into a .cmake file.
+ std::string result = cmOutputConverter::EscapeForCMake(str);
+ // Un-escape variable references generated by our own export code.
+ cmSystemTools::ReplaceString(result,
+ "\\${_IMPORT_PREFIX}",
+ "${_IMPORT_PREFIX}");
+ cmSystemTools::ReplaceString(result,
+ "\\${CMAKE_IMPORT_LIBRARY_SUFFIX}",
+ "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
+ return result;
+}
+
+//----------------------------------------------------------------------------
cmExportFileGenerator::cmExportFileGenerator()
{
this->AppendMode = false;
@@ -608,7 +624,8 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target,
for(ImportPropertyMap::const_iterator pi = properties.begin();
pi != properties.end(); ++pi)
{
- os << " " << pi->first << " \"" << pi->second << "\"\n";
+ os << " " << pi->first << " "
+ << cmExportFileGeneratorEscape(pi->second) << "\n";
}
os << ")\n\n";
}
@@ -1112,7 +1129,8 @@ cmExportFileGenerator
for(ImportPropertyMap::const_iterator pi = properties.begin();
pi != properties.end(); ++pi)
{
- os << " " << pi->first << " \"" << pi->second << "\"\n";
+ os << " " << pi->first << " "
+ << cmExportFileGeneratorEscape(pi->second) << "\n";
}
os << " )\n"
<< "\n";
@@ -1223,7 +1241,7 @@ cmExportFileGenerator
ImportPropertyMap::const_iterator pi = properties.find(*li);
if (pi != properties.end())
{
- os << "\"" << pi->second << "\" ";
+ os << cmExportFileGeneratorEscape(pi->second) << " ";
}
}
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index eb8d193..dfb991b 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -99,8 +99,6 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
|| i->first.find("IMPORTED_LINK_DEPENDENT_LIBRARIES") == 0
|| i->first.find("INTERFACE_LINK_LIBRARIES") == 0)
{
- const std::string libs = i->second.GetValue();
-
std::string evalResult = this->FindTargets(i->first,
target, emitted);
@@ -118,6 +116,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
}
}
}
+
std::string
cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target,
const std::string& config)
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index e374387..a31e832 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -313,7 +313,7 @@ void cmExtraCodeBlocksGenerator
" "<<virtualFolders<<"\n"
" <Build>\n";
- this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str());
+ this->AppendTarget(fout, "all", 0, make.c_str(), lgs[0], compiler.c_str());
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
@@ -335,7 +335,7 @@ void cmExtraCodeBlocksGenerator
makefile->GetHomeOutputDirectory())==0)
{
this->AppendTarget(fout, ti->first, 0,
- make.c_str(), makefile, compiler.c_str());
+ make.c_str(), *lg, compiler.c_str());
}
}
break;
@@ -351,7 +351,7 @@ void cmExtraCodeBlocksGenerator
}
this->AppendTarget(fout, ti->first, 0,
- make.c_str(), makefile, compiler.c_str());
+ make.c_str(), *lg, compiler.c_str());
break;
case cmTarget::EXECUTABLE:
case cmTarget::STATIC_LIBRARY:
@@ -360,11 +360,11 @@ void cmExtraCodeBlocksGenerator
case cmTarget::OBJECT_LIBRARY:
{
this->AppendTarget(fout, ti->first, &ti->second,
- make.c_str(), makefile, compiler.c_str());
+ make.c_str(), *lg, compiler.c_str());
std::string fastTarget = ti->first;
fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, &ti->second,
- make.c_str(), makefile, compiler.c_str());
+ make.c_str(), *lg, compiler.c_str());
}
break;
default:
@@ -519,14 +519,16 @@ void cmExtraCodeBlocksGenerator
// Write a dummy file for OBJECT libraries, so C::B can reference some file
std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
- cmMakefile* mf, cmTarget* target) const
+ cmLocalGenerator* lg,
+ cmTarget* target) const
{
+ cmMakefile *mf = lg->GetMakefile();
// this file doesn't seem to be used by C::B in custom makefile mode,
// but we generate a unique file for each OBJECT library so in case
// C::B uses it in some way, the targets don't interfere with each other.
std::string filename = mf->GetCurrentBinaryDirectory();
filename += "/";
- filename += mf->GetLocalGenerator()->GetTargetDirectory(*target);
+ filename += lg->GetTargetDirectory(*target);
filename += "/";
filename += target->GetName();
filename += ".objlib";
@@ -547,9 +549,10 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& targetName,
cmTarget* target,
const char* make,
- const cmMakefile* makefile,
+ const cmLocalGenerator* lg,
const char* compiler)
{
+ cmMakefile const* makefile = lg->GetMakefile();
std::string makefileName = makefile->GetCurrentBinaryDirectory();
makefileName += "/Makefile";
@@ -583,7 +586,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::string location;
if ( target->GetType()==cmTarget::OBJECT_LIBRARY)
{
- location = this->CreateDummyTargetFile(const_cast<cmMakefile*>(makefile),
+ location = this->CreateDummyTargetFile(const_cast<cmLocalGenerator*>(lg),
target);
}
else
@@ -618,8 +621,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::set<std::string> uniqIncludeDirs;
std::vector<std::string> includes;
- target->GetMakefile()->GetLocalGenerator()->
- GetIncludeDirectories(includes, gtgt, "C", buildType);
+ lg->GetIncludeDirectories(includes, gtgt, "C", buildType);
uniqIncludeDirs.insert(includes.begin(), includes.end());
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index 97da1b8..e5ede9a 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -48,7 +48,8 @@ private:
void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
const std::string& filename);
- std::string CreateDummyTargetFile(cmMakefile* mf, cmTarget* target) const;
+ std::string CreateDummyTargetFile(cmLocalGenerator* lg,
+ cmTarget* target) const;
std::string GetCBCompilerId(const cmMakefile* mf);
int GetCBTargetType(cmTarget* target);
@@ -58,7 +59,7 @@ private:
const std::string& targetName,
cmTarget* target,
const char* make,
- const cmMakefile* makefile,
+ const cmLocalGenerator* lg,
const char* compiler);
};
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index a81e53c..44bf586 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -598,7 +598,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
linkName4 += "/";
linkName4 += cmSystemTools::GetFilenameName(fullPath);
this->AppendLinkedResource(fout, linkName4,
- fullPath, LinkToFile);
+ this->GetEclipsePath(fullPath),
+ LinkToFile);
}
}
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4698468..f740020 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -66,7 +66,7 @@ static mode_t mode_setuid = S_ISUID;
static mode_t mode_setgid = S_ISGID;
#endif
-#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8)
+#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8)
// libcurl doesn't support file:// urls for unicode filenames on Windows.
// Convert string from UTF-8 to ACP if this is a file:// URL.
static std::string fix_file_url_windows(const std::string& url)
@@ -906,13 +906,13 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
{
switch(status)
{
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
g.RecurseThroughSymlinksOff();
break;
case cmPolicies::OLD:
case cmPolicies::WARN:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
g.RecurseThroughSymlinksOn();
break;
}
@@ -1044,6 +1044,8 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
{
switch (status)
{
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
// Correct behavior, yay!
break;
@@ -1059,12 +1061,6 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
cmPolicies::GetPolicyWarning(cmPolicies::CMP0009));
}
break;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->SetError("policy CMP0009 error");
- this->Makefile->IssueMessage(cmake::FATAL_ERROR,
- cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0009));
- return false;
}
}
@@ -3160,7 +3156,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
return false;
}
-#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8)
+#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8)
url = fix_file_url_windows(url);
#endif
@@ -3415,7 +3411,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
unsigned long file_size = cmsys::SystemTools::FileLength(filename);
-#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8)
+#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8)
url = fix_file_url_windows(url);
#endif
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 0dcda4d..e983bfb 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -13,6 +13,17 @@
#include <cmsys/auto_ptr.hxx>
+cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf):
+ Makefile(mf), Depth(0)
+{
+ this->Makefile->PushLoopBlock();
+}
+
+cmForEachFunctionBlocker::~cmForEachFunctionBlocker()
+{
+ this->Makefile->PopLoopBlock();
+}
+
bool cmForEachFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
cmExecutionStatus &inStatus)
@@ -27,8 +38,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
// if this is the endofreach for this statement
if (!this->Depth)
{
- cmMakefile::LoopBlockPop loopBlockPop(&mf);
-
// Remove the function blocker for this scope or bail.
cmsys::auto_ptr<cmFunctionBlocker>
fb(mf.RemoveFunctionBlocker(this, lff));
@@ -128,7 +137,7 @@ bool cmForEachCommand
}
// create a function blocker
- cmForEachFunctionBlocker *f = new cmForEachFunctionBlocker();
+ cmForEachFunctionBlocker *f = new cmForEachFunctionBlocker(this->Makefile);
if ( args.size() > 1 )
{
if ( args[1] == "RANGE" )
@@ -204,15 +213,14 @@ bool cmForEachCommand
}
this->Makefile->AddFunctionBlocker(f);
- this->Makefile->PushLoopBlock();
-
return true;
}
//----------------------------------------------------------------------------
bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
{
- cmsys::auto_ptr<cmForEachFunctionBlocker> f(new cmForEachFunctionBlocker());
+ cmsys::auto_ptr<cmForEachFunctionBlocker>
+ f(new cmForEachFunctionBlocker(this->Makefile));
f->Args.push_back(args[0]);
enum Doing { DoingNone, DoingLists, DoingItems };
@@ -250,7 +258,5 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
this->Makefile->AddFunctionBlocker(f.release()); // TODO: pass auto_ptr
- this->Makefile->PushLoopBlock();
-
return true;
}
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 9b7c85a..36e8808 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -19,8 +19,8 @@
class cmForEachFunctionBlocker : public cmFunctionBlocker
{
public:
- cmForEachFunctionBlocker() {this->Depth = 0;}
- virtual ~cmForEachFunctionBlocker() {}
+ cmForEachFunctionBlocker(cmMakefile* mf);
+ ~cmForEachFunctionBlocker();
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefile &mf,
cmExecutionStatus &);
@@ -29,6 +29,7 @@ public:
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
private:
+ cmMakefile* Makefile;
int Depth;
};
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 001adb1..78853ce 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -43,6 +43,7 @@ public:
newC->Args = this->Args;
newC->Functions = this->Functions;
newC->Policies = this->Policies;
+ newC->FilePath = this->FilePath;
return newC;
}
@@ -71,9 +72,9 @@ public:
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
+ std::string FilePath;
};
-
bool cmFunctionHelperCommand::InvokeInitialPass
(const std::vector<cmListFileArgument>& args,
cmExecutionStatus & inStatus)
@@ -93,14 +94,9 @@ bool cmFunctionHelperCommand::InvokeInitialPass
return false;
}
- // we push a scope on the makefile
- cmMakefile::ScopePushPop varScope(this->Makefile);
- cmMakefile::LexicalPushPop lexScope(this->Makefile);
- static_cast<void>(varScope);
-
- // Push a weak policy scope which restores the policies recorded at
- // function creation.
- cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies);
+ cmMakefile::FunctionPushPop functionScope(this->Makefile,
+ this->FilePath,
+ this->Policies);
// set the value of argc
std::ostringstream strStream;
@@ -145,8 +141,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
{
// The error message should have already included the call stack
// so we do not need to report an error here.
- lexScope.Quiet();
- polScope.Quiet();
+ functionScope.Quiet();
inStatus.SetNestedError(true);
return false;
}
@@ -179,19 +174,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
cmFunctionHelperCommand *f = new cmFunctionHelperCommand();
f->Args = this->Args;
f->Functions = this->Functions;
+ f->FilePath = this->GetStartingContext().FilePath;
mf.RecordPolicies(f->Policies);
- // Set the FilePath on the arguments to match the function since it is
- // not stored and the original values may be freed
- for (unsigned int i = 0; i < f->Functions.size(); ++i)
- {
- for (unsigned int j = 0; j < f->Functions[i].Arguments.size(); ++j)
- {
- f->Functions[i].Arguments[j].FilePath =
- f->Functions[i].FilePath.c_str();
- }
- }
-
std::string newName = "_" + this->Args[0];
mf.GetState()->RenameCommand(this->Args[0], newName);
mf.GetState()->AddCommand(f);
@@ -220,7 +205,8 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endfunction"))
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments, expandedArguments,
+ this->GetStartingContext().FilePath.c_str());
// if the endfunction has arguments then make sure
// they match the ones in the opening function command
if ((expandedArguments.empty() ||
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index a1c405b..3655a87 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -34,7 +34,7 @@ cmGeneratorExpression::Parse(std::string const& input)
{
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
- this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL),
+ this->Backtrace ? *this->Backtrace : cmListFileBacktrace(),
input));
}
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index ff8790c..851aacd 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -35,7 +35,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
- Content(content), Backtrace(NULL), TransitivePropertiesOnly(false)
+ Content(content), Backtrace(), TransitivePropertiesOnly(false)
{
Initialize();
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e2b8c45..4494553 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -220,14 +220,20 @@ struct TagVisitor
};
//----------------------------------------------------------------------------
-cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t),
+cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
+ : Target(t),
SourceFileFlagsConstructed(false)
{
this->Makefile = this->Target->GetMakefile();
- this->LocalGenerator = this->Makefile->GetLocalGenerator();
+ this->LocalGenerator = lg;
this->GlobalGenerator = this->Makefile->GetGlobalGenerator();
}
+cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
+{
+ return this->LocalGenerator;
+}
+
//----------------------------------------------------------------------------
int cmGeneratorTarget::GetType() const
{
@@ -353,6 +359,34 @@ void cmGeneratorTarget::ComputeObjectMapping()
}
//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetFeature(const std::string& feature,
+ const std::string& config) const
+{
+ if(!config.empty())
+ {
+ std::string featureConfig = feature;
+ featureConfig += "_";
+ featureConfig += cmSystemTools::UpperCase(config);
+ if(const char* value = this->Target->GetProperty(featureConfig))
+ {
+ return value;
+ }
+ }
+ if(const char* value = this->Target->GetProperty(feature))
+ {
+ return value;
+ }
+ return this->LocalGenerator->GetFeature(feature, config);
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature,
+ const std::string& config) const
+{
+ return cmSystemTools::IsOn(this->GetFeature(feature, config));
+}
+
+//----------------------------------------------------------------------------
const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
{
this->ComputeObjectMapping();
@@ -677,7 +711,8 @@ cmTargetTraceDependencies
e << "Evaluation output file\n \"" << sf->GetFullPath()
<< "\"\ndepends on the sources of a target it is used in. This "
"is a dependency loop and is not allowed.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ this->GeneratorTarget
+ ->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
if(emitted.insert(sf).second && this->SourcesQueued.insert(sf).second)
@@ -983,7 +1018,7 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang,
case cmTarget::STATIC_LIBRARY:
{
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
- if(this->Target->GetFeatureAsBool(
+ if(this->GetFeatureAsBool(
"INTERPROCEDURAL_OPTIMIZATION", config))
{
std::string varIPO = var + "_IPO";
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index c79aa72..675ee9f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -24,7 +24,9 @@ class cmTarget;
class cmGeneratorTarget
{
public:
- cmGeneratorTarget(cmTarget*);
+ cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
+
+ cmLocalGenerator* GetLocalGenerator() const;
int GetType() const;
std::string GetName() const;
@@ -67,6 +69,11 @@ public:
void ComputeObjectMapping();
+ const char* GetFeature(const std::string& feature,
+ const std::string& config) const;
+ bool GetFeatureAsBool(const std::string& feature,
+ const std::string& config) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 76803c1..a460ca6 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -32,8 +32,7 @@ bool cmGetCMakePropertyCommand
if ( args[1] == "VARIABLES" )
{
- int cacheonly = 0;
- std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
+ std::vector<std::string> vars = this->Makefile->GetDefinitions();
if (!vars.empty())
{
output = cmJoin(vars, ";");
@@ -52,9 +51,11 @@ bool cmGetCMakePropertyCommand
}
else
{
- const char *prop =
- this->Makefile->GetState()
- ->GetGlobalProperty(args[1]);
+ const char *prop = 0;
+ if (!args[1].empty())
+ {
+ prop = this->Makefile->GetState()->GetGlobalProperty(args[1]);
+ }
if (prop)
{
output = prop;
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 4fe3318..c056d95 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -26,7 +26,6 @@ bool cmGetDirectoryPropertyCommand
std::vector<std::string>::const_iterator i = args.begin();
std::string variable = *i;
++i;
- std::string output = "";
// get the directory argument if there is one
cmMakefile *dir = this->Makefile;
@@ -79,18 +78,45 @@ bool cmGetDirectoryPropertyCommand
"providing the name of the variable to get.");
return false;
}
- output = dir->GetSafeDefinition(*i);
+ std::string output = dir->GetSafeDefinition(*i);
this->Makefile->AddDefinition(variable, output.c_str());
return true;
}
- const char *prop = dir->GetProperty(*i);
+ const char *prop = 0;
+ if (!i->empty())
+ {
+ if (*i == "DEFINITIONS")
+ {
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0059))
+ {
+ case cmPolicies::WARN:
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0059));
+ case cmPolicies::OLD:
+ this->StoreResult(variable,
+ this->Makefile->GetDefineFlagsCMP0059());
+ return true;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ break;
+ }
+ }
+ prop = dir->GetProperty(*i);
+ }
+ this->StoreResult(variable, prop);
+ return true;
+}
+
+void cmGetDirectoryPropertyCommand::StoreResult(std::string const& variable,
+ const char* prop)
+{
if (prop)
{
this->Makefile->AddDefinition(variable, prop);
- return true;
+ return;
}
this->Makefile->AddDefinition(variable, "");
- return true;
}
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 6c5750a..f418886 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -40,8 +40,9 @@ public:
virtual std::string GetName() const { return "get_directory_property";}
cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand);
-};
-
+private:
+ void StoreResult(const std::string& variable, const char* prop);
+};
#endif
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 250bd35..33d638b 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -142,8 +142,7 @@ bool cmGetPropertyCommand
{
// Lookup brief documentation.
std::string output;
- if(cmPropertyDefinition* def =
- this->Makefile->GetState()->
+ if(cmPropertyDefinition const* def = this->Makefile->GetState()->
GetPropertyDefinition(this->PropertyName, scope))
{
output = def->GetShortDescription();
@@ -158,8 +157,7 @@ bool cmGetPropertyCommand
{
// Lookup full documentation.
std::string output;
- if(cmPropertyDefinition* def =
- this->Makefile->GetState()->
+ if(cmPropertyDefinition const* def = this->Makefile->GetState()->
GetPropertyDefinition(this->PropertyName, scope))
{
output = def->GetFullDescription();
@@ -281,6 +279,22 @@ bool cmGetPropertyCommand::HandleDirectoryMode()
}
}
+ if (this->PropertyName == "DEFINITIONS")
+ {
+ switch(mf->GetPolicyStatus(cmPolicies::CMP0059))
+ {
+ case cmPolicies::WARN:
+ mf->IssueMessage(cmake::AUTHOR_WARNING,
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0059));
+ case cmPolicies::OLD:
+ return this->StoreResult(mf->GetDefineFlagsCMP0059());
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ break;
+ }
+ }
+
// Get the property.
return this->StoreResult(mf->GetProperty(this->PropertyName));
}
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 7667a85..46daa34 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -38,7 +38,11 @@ bool cmGetSourceFilePropertyCommand
this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
return true;
}
- const char *prop = sf->GetPropertyForUser(args[2]);
+ const char *prop = 0;
+ if (!args[2].empty())
+ {
+ prop = sf->GetPropertyForUser(args[2]);
+ }
if (prop)
{
this->Makefile->AddDefinition(var, prop);
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 315e851..ca40bd0 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -40,7 +40,11 @@ bool cmGetTargetPropertyCommand
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
{
cmTarget& target = *tgt;
- const char* prop_cstr = target.GetProperty(args[2], this->Makefile);
+ const char* prop_cstr = 0;
+ if (!args[2].empty())
+ {
+ prop_cstr = target.GetProperty(args[2], this->Makefile);
+ }
if(prop_cstr)
{
prop = prop_cstr;
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index b3df4c3..bf34589 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -29,7 +29,11 @@ bool cmGetTestPropertyCommand
cmTest *test = this->Makefile->GetTest(testName);
if (test)
{
- const char *prop = test->GetProperty(args[1]);
+ const char *prop = 0;
+ if (!args[1].empty())
+ {
+ prop = test->GetProperty(args[1]);
+ }
if (prop)
{
this->Makefile->AddDefinition(var, prop);
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 01e2011..2f9265a 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -21,23 +21,24 @@
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
-cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmTarget *target)
- : Target(target)
+cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
+ : Target(target->Target)
+ , GeneratorTarget(target)
, LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
- target->GetMakefile()->GetLocalGenerator()))
- , Makefile(target->GetMakefile())
- , TargetGroup(DetermineIfTargetGroup(target))
+ target->GetLocalGenerator()))
+ , Makefile(target->Target->GetMakefile())
+ , TargetGroup(DetermineIfTargetGroup(target->Target))
, DynamicDownload(false)
{
- this->RelBuildFilePath = this->GetRelBuildFilePath(target);
+ this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target);
this->RelOutputFileName =
this->RelBuildFilePath + this->Target->GetName() + ".a";
this->RelBuildFileName = this->RelBuildFilePath;
- this->RelBuildFileName += this->GetBuildFileName(target);
+ this->RelBuildFileName += this->GetBuildFileName(target->Target);
- std::string absPathToRoot = this->GetAbsPathToRoot(target);
+ std::string absPathToRoot = this->GetAbsPathToRoot(target->Target);
absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot);
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
@@ -354,11 +355,11 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
{
// library directories
cmTargetDependSet tds =
- this->GetGlobalGenerator()->GetTargetDirectDepends(*this->Target);
+ this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget);
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
++tdsI)
{
- const cmTarget *tg(*tdsI);
+ const cmTarget *tg = (*tdsI)->Target;
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
<< "\"" << std::endl;
}
@@ -373,7 +374,6 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
cmTarget *tg(GetGlobalGenerator()->FindTarget(libName));
if (NULL != tg)
{
- cmGhsMultiTargetGenerator gmtg(tg);
libName = tg->GetName() + ".a";
}
*this->GetFolderBuildStreams() << " -l\"" << libName << "\""
diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h
index 8e81db8..c29a31e 100644
--- a/Source/cmGhsMultiTargetGenerator.h
+++ b/Source/cmGhsMultiTargetGenerator.h
@@ -27,7 +27,7 @@ class cmCustomCommand;
class cmGhsMultiTargetGenerator
{
public:
- cmGhsMultiTargetGenerator(cmTarget *target);
+ cmGhsMultiTargetGenerator(cmGeneratorTarget* target);
virtual ~cmGhsMultiTargetGenerator();
@@ -100,6 +100,7 @@ private:
const std::string &language);
cmTarget *Target;
+ cmGeneratorTarget* GeneratorTarget;
cmLocalGhsMultiGenerator *LocalGenerator;
cmMakefile *Makefile;
std::string AbsBuildFilePath;
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
new file mode 100644
index 0000000..dc8e5a7
--- /dev/null
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -0,0 +1,21 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 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 "cmGlobalCommonGenerator.h"
+
+cmGlobalCommonGenerator::cmGlobalCommonGenerator(cmake* cm):
+ cmGlobalGenerator(cm)
+{
+}
+
+cmGlobalCommonGenerator::~cmGlobalCommonGenerator()
+{
+}
diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h
new file mode 100644
index 0000000..7bb0e55
--- /dev/null
+++ b/Source/cmGlobalCommonGenerator.h
@@ -0,0 +1,27 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmGlobalCommonGenerator_h
+#define cmGlobalCommonGenerator_h
+
+#include "cmGlobalGenerator.h"
+
+/** \class cmGlobalCommonGenerator
+ * \brief Common infrastructure for Makefile and Ninja global generators.
+ */
+class cmGlobalCommonGenerator : public cmGlobalGenerator
+{
+public:
+ cmGlobalCommonGenerator(cmake* cm);
+ ~cmGlobalCommonGenerator();
+};
+
+#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cd05c54..88ac0bc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -70,7 +70,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->TryCompileTimeout = 0;
this->ExtraGenerator = 0;
- this->CurrentLocalGenerator = 0;
+ this->CurrentMakefile = 0;
this->TryCompileOuterMakefile = 0;
}
@@ -87,18 +87,16 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
{
return true;
}
- else
- {
- std::ostringstream e;
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "does not support platform specification, but platform\n"
- " " << p << "\n"
- "was specified.";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
- return false;
- }
+
+ std::ostringstream e;
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not support platform specification, but platform\n"
+ " " << p << "\n"
+ "was specified.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
}
bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
@@ -108,18 +106,15 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
{
return true;
}
- else
- {
- std::ostringstream e;
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "does not support toolset specification, but toolset\n"
- " " << ts << "\n"
- "was specified.";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
- return false;
- }
+ std::ostringstream e;
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not support toolset specification, but toolset\n"
+ " " << ts << "\n"
+ "was specified.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
}
std::string cmGlobalGenerator::SelectMakeProgram(
@@ -569,6 +564,10 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmSystemTools::Error("Could not find cmake module file: ",
determineCompiler.c_str());
}
+ if (cmSystemTools::GetFatalErrorOccured())
+ {
+ return;
+ }
needTestLanguage[lang] = true;
// Some generators like visual studio should not use the env variables
// So the global generator can specify that in this variable
@@ -1106,7 +1105,8 @@ void cmGlobalGenerator::Configure()
this->CMakeInstance->GetHomeOutputDirectory());
// now do it
- lg->Configure();
+ lg->GetMakefile()->Configure();
+ lg->GetMakefile()->EnforceDirectoryLevelRules();
// update the cache entry for the number of local generators, this is used
// for progress
@@ -1223,6 +1223,7 @@ void cmGlobalGenerator::Generate()
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
+ this->LocalGenerators[i]->ComputeObjectMaxPath();
cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
@@ -1277,11 +1278,15 @@ void cmGlobalGenerator::Generate()
// it builds by default.
this->FillLocalGeneratorToTargetMap();
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
+ {
+ this->LocalGenerators[i]->ComputeHomeRelativeOutputPath();
+ }
+
// Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- this->LocalGenerators[i]->GetMakefile()->SetGeneratingBuildSystem();
- this->SetCurrentLocalGenerator(this->LocalGenerators[i]);
+ this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile());
this->LocalGenerators[i]->Generate();
if(!this->LocalGenerators[i]->GetMakefile()->IsOn(
"CMAKE_SKIP_INSTALL_RULES"))
@@ -1293,7 +1298,7 @@ void cmGlobalGenerator::Generate()
(static_cast<float>(i)+1.0f)/
static_cast<float>(this->LocalGenerators.size()));
}
- this->SetCurrentLocalGenerator(0);
+ this->SetCurrentMakefile(0);
if(!this->GenerateCPackPropertiesFile())
{
@@ -1350,9 +1355,9 @@ bool cmGlobalGenerator::ComputeTargetDepends()
{
return false;
}
- std::vector<cmTarget const*> const& targets = ctd.GetTargets();
- for(std::vector<cmTarget const*>::const_iterator ti = targets.begin();
- ti != targets.end(); ++ti)
+ std::vector<cmGeneratorTarget const*> const& targets = ctd.GetTargets();
+ for(std::vector<cmGeneratorTarget const*>::const_iterator ti
+ = targets.begin(); ti != targets.end(); ++ti)
{
ctd.GetTargetDirectDepends(*ti, this->TargetDependencies[*ti]);
}
@@ -1456,15 +1461,16 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf)
+void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg)
{
cmGeneratorTargetsType generatorTargets;
+ cmMakefile* mf = lg->GetMakefile();
cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
- cmGeneratorTarget* gt = new cmGeneratorTarget(t);
+ cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->ComputeTargetObjectDirectory(gt);
this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt;
@@ -1474,7 +1480,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf)
j = mf->GetOwnedImportedTargets().begin();
j != mf->GetOwnedImportedTargets().end(); ++j)
{
- cmGeneratorTarget* gt = new cmGeneratorTarget(*j);
+ cmGeneratorTarget* gt = new cmGeneratorTarget(*j, lg);
this->GeneratorTargets[*j] = gt;
generatorTargets[*j] = gt;
}
@@ -1487,7 +1493,7 @@ void cmGlobalGenerator::CreateGeneratorTargets()
// Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
- this->CreateGeneratorTargets(this->LocalGenerators[i]->GetMakefile());
+ this->CreateGeneratorTargets(this->LocalGenerators[i]);
}
}
@@ -1545,7 +1551,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmState* state = this->GetCMakeInstance()->GetState();
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
- this->LocalGenerators[i]->ConfigureFinalPass();
+ this->LocalGenerators[i]->GetMakefile()->ConfigureFinalPass();
cmTargets &targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets();
for (cmTargets::iterator l = targets.begin();
@@ -2038,19 +2044,19 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
clg = clg->GetParent())
{
// This local generator includes the target.
- std::set<cmTarget const*>& targetSet =
+ std::set<cmGeneratorTarget const*>& targetSet =
this->LocalGeneratorToTargetMap[clg];
- targetSet.insert(&target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+ targetSet.insert(gt);
// Add dependencies of the included target. An excluded
// target may still be included if it is a dependency of a
// non-excluded target.
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator ti = tgtdeps.begin();
ti != tgtdeps.end(); ++ti)
{
- cmTarget const* ttt = *ti;
- targetSet.insert(ttt);
+ targetSet.insert(*ti);
}
}
}
@@ -2443,7 +2449,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
{
// Package
cmTarget target;
- target.GetProperties().SetCMakeInstance(this->CMakeInstance);
target.SetType(cmTarget::GLOBAL_TARGET, name);
target.SetProperty("EXCLUDE_FROM_ALL","TRUE");
@@ -2513,9 +2518,9 @@ void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&,
//----------------------------------------------------------------------------
cmGlobalGenerator::TargetDependSet const&
-cmGlobalGenerator::GetTargetDirectDepends(cmTarget const& target)
+cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
{
- return this->TargetDependencies[&target];
+ return this->TargetDependencies[target];
}
void cmGlobalGenerator::AddTarget(cmTarget* t)
@@ -2615,9 +2620,10 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
continue;
}
// put the target in the set of original targets
- originalTargets.insert(target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ originalTargets.insert(gt);
// Get the set of targets that depend on target
- this->AddTargetDepends(target, projectTargets);
+ this->AddTargetDepends(gt, projectTargets);
}
}
}
@@ -2630,7 +2636,7 @@ bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
+void cmGlobalGenerator::AddTargetDepends(cmGeneratorTarget const* target,
TargetDependSet& projectTargets)
{
// add the target itself
@@ -2638,11 +2644,10 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
{
// This is the first time we have encountered the target.
// Recursively follow its dependencies.
- TargetDependSet const& ts = this->GetTargetDirectDepends(*target);
+ TargetDependSet const& ts = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator i = ts.begin(); i != ts.end(); ++i)
{
- cmTarget const* dtarget = *i;
- this->AddTargetDepends(dtarget, projectTargets);
+ this->AddTargetDepends(*i, projectTargets);
}
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 979e971..398335b 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -168,11 +168,13 @@ public:
const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
return this->LocalGenerators;}
- cmLocalGenerator* GetCurrentLocalGenerator()
- {return this->CurrentLocalGenerator;}
+ cmMakefile* GetCurrentMakefile() const
+ {
+ return this->CurrentMakefile;
+ }
- void SetCurrentLocalGenerator(cmLocalGenerator* lg)
- {this->CurrentLocalGenerator = lg;}
+ void SetCurrentMakefile(cmMakefile* mf)
+ {this->CurrentMakefile = mf;}
void AddLocalGenerator(cmLocalGenerator *lg);
@@ -290,7 +292,8 @@ public:
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
- TargetDependSet const& GetTargetDirectDepends(cmTarget const& target);
+ TargetDependSet const& GetTargetDirectDepends(
+ const cmGeneratorTarget* target);
/** Get per-target generator information. */
cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
@@ -310,8 +313,6 @@ public:
{
return this->BinaryDirectories.insert(dir).second;
}
- /** Supported systems creates a GUID for the given name */
- virtual void CreateGUID(const std::string&) {}
/** Return true if the generated build tree may contain multiple builds.
i.e. "Can I build Debug and Release in the same tree?" */
@@ -368,7 +369,7 @@ protected:
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
bool IsRootOnlyTarget(cmTarget* target) const;
- void AddTargetDepends(cmTarget const* target,
+ void AddTargetDepends(const cmGeneratorTarget* target,
TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf);
void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf);
@@ -398,23 +399,18 @@ protected:
std::vector<std::string> depends, const char* workingDir,
bool uses_terminal);
- bool NeedSymbolicMark;
- bool UseLinkScript;
- bool ForceUnixPaths;
- bool ToolSupportsColor;
std::string FindMakeProgramFile;
std::string ConfiguredFilesPath;
cmake *CMakeInstance;
std::vector<cmLocalGenerator *> LocalGenerators;
- cmLocalGenerator* CurrentLocalGenerator;
+ cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project
std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
- std::map<cmLocalGenerator*, std::set<cmTarget const*> >
+ std::map<cmLocalGenerator*, std::set<cmGeneratorTarget const*> >
LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
std::set<std::string> InstallComponents;
- bool InstallTargetEnabled;
// Sets of named target exports
cmExportSetMap ExportSets;
std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
@@ -448,7 +444,6 @@ private:
cmState::Snapshot snapshot);
cmMakefile* TryCompileOuterMakefile;
- float FirstTimeProgress;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
std::map<std::string, bool> IgnoreExtensions;
@@ -483,13 +478,13 @@ private:
std::vector<std::string> FilesReplacedDuringGenerate;
// Store computed inter-target dependencies.
- typedef std::map<cmTarget const*, TargetDependSet> TargetDependMap;
+ typedef std::map<cmGeneratorTarget const*, TargetDependSet> TargetDependMap;
TargetDependMap TargetDependencies;
// Per-target generator information.
cmGeneratorTargetsType GeneratorTargets;
friend class cmake;
- void CreateGeneratorTargets(cmMakefile* mf);
+ void CreateGeneratorTargets(cmLocalGenerator* lg);
void CreateGeneratorTargets();
void ClearGeneratorMembers();
@@ -521,6 +516,14 @@ private:
// Pool of file locks
cmFileLockPool FileLockPool;
#endif
+
+protected:
+ float FirstTimeProgress;
+ bool NeedSymbolicMark;
+ bool UseLinkScript;
+ bool ForceUnixPaths;
+ bool ToolSupportsColor;
+ bool InstallTargetEnabled;
};
#endif
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 103d75a..b88b8c8 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -505,7 +505,7 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
- : cmGlobalGenerator(cm)
+ : cmGlobalCommonGenerator(cm)
, BuildFileStream(0)
, RulesFileStream(0)
, CompileCommandsStream(0)
@@ -949,8 +949,8 @@ cmGlobalNinjaGenerator
std::set<std::string> const& utils = target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else {
- cmTargetDependSet const& targetDeps =
- this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(gt);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i)
{
@@ -958,7 +958,7 @@ cmGlobalNinjaGenerator
{
continue;
}
- this->AppendTargetOutputs(*i, outputs);
+ this->AppendTargetOutputs((*i)->Target, outputs);
}
}
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index ffd1cdc..2a749c1 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -13,7 +13,7 @@
#ifndef cmGlobalNinjaGenerator_h
# define cmGlobalNinjaGenerator_h
-# include "cmGlobalGenerator.h"
+# include "cmGlobalCommonGenerator.h"
# include "cmGlobalGeneratorFactory.h"
# include "cmNinjaTypes.h"
@@ -42,7 +42,7 @@ class cmGeneratorTarget;
* - We extensively use Ninja variable overloading system to minimize the
* number of generated rules.
*/
-class cmGlobalNinjaGenerator : public cmGlobalGenerator
+class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator
{
public:
/// The default name of Ninja's build file. Typically: build.ninja.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4fe52dd..c5fca91 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -21,7 +21,7 @@
#include "cmAlgorithms.h"
cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
- : cmGlobalGenerator(cm)
+ : cmGlobalCommonGenerator(cm)
{
// This type of makefile always requires unix style paths
this->ForceUnixPaths = true;
@@ -483,7 +483,7 @@ cmGlobalUnixMakefileGenerator3
if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
gtarget->Target
- ->NeedRelinkBeforeInstall(lg->ConfigurationName)))
+ ->NeedRelinkBeforeInstall(lg->GetConfigName())))
{
std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target);
tname += "/";
@@ -529,7 +529,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalUnixMakefileGenerator3* lg)
{
// Only subdirectories need these rules.
- if(lg->IsRootMakefile())
+ if(lg->GetMakefile()->IsRootMakefile())
{
return;
}
@@ -692,7 +692,7 @@ cmGlobalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
if(gtarget->Target
- ->NeedRelinkBeforeInstall(lg->ConfigurationName))
+ ->NeedRelinkBeforeInstall(lg->GetConfigName()))
{
makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target);
makeTargetName += "/preinstall";
@@ -804,7 +804,7 @@ cmGlobalUnixMakefileGenerator3
lg->AppendEcho(commands, "Built target " + name,
cmLocalUnixMakefileGenerator3::EchoNormal, &progress);
- this->AppendGlobalTargetDepends(depends,*gtarget->Target);
+ this->AppendGlobalTargetDepends(depends, gtarget);
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
localName, depends, commands, true);
@@ -830,9 +830,9 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
//
- std::set<cmTarget const*> emitted;
+ std::set<cmGeneratorTarget const*> emitted;
progCmd << " "
- << this->CountProgressMarksInTarget(gtarget->Target, emitted);
+ << this->CountProgressMarksInTarget(gtarget, emitted);
commands.push_back(progCmd.str());
}
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -865,7 +865,7 @@ cmGlobalUnixMakefileGenerator3
// Add rules to prepare the target for installation.
if(gtarget->Target
- ->NeedRelinkBeforeInstall(lg->ConfigurationName))
+ ->NeedRelinkBeforeInstall(lg->GetConfigName()))
{
localName = lg->GetRelativeTargetDirectory(*gtarget->Target);
localName += "/preinstall";
@@ -908,14 +908,14 @@ cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
size_t
cmGlobalUnixMakefileGenerator3
-::CountProgressMarksInTarget(cmTarget const* target,
- std::set<cmTarget const*>& emitted)
+::CountProgressMarksInTarget(cmGeneratorTarget const* target,
+ std::set<cmGeneratorTarget const*>& emitted)
{
size_t count = 0;
if(emitted.insert(target).second)
{
- count = this->ProgressMap[target].Marks.size();
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ count = this->ProgressMap[target->Target].Marks.size();
+ TargetDependSet const& depends = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
@@ -935,10 +935,10 @@ cmGlobalUnixMakefileGenerator3
::CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg)
{
size_t count = 0;
- std::set<cmTarget const*> emitted;
- std::set<cmTarget const*> const& targets
+ std::set<cmGeneratorTarget const*> emitted;
+ std::set<cmGeneratorTarget const*> const& targets
= this->LocalGeneratorToTargetMap[lg];
- for(std::set<cmTarget const*>::const_iterator t = targets.begin();
+ for(std::set<cmGeneratorTarget const*>::const_iterator t = targets.begin();
t != targets.end(); ++t)
{
count += this->CountProgressMarksInTarget(*t, emitted);
@@ -987,22 +987,21 @@ cmGlobalUnixMakefileGenerator3::TargetProgress
void
cmGlobalUnixMakefileGenerator3
::AppendGlobalTargetDepends(std::vector<std::string>& depends,
- cmTarget& target)
+ cmGeneratorTarget* target)
{
TargetDependSet const& depends_set = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator i = depends_set.begin();
i != depends_set.end(); ++i)
{
// Create the target-level dependency.
- cmTarget const* dep = *i;
+ cmGeneratorTarget const* dep = *i;
if (dep->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
cmLocalUnixMakefileGenerator3* lg3 =
- static_cast<cmLocalUnixMakefileGenerator3*>
- (dep->GetMakefile()->GetLocalGenerator());
- std::string tgtName = lg3->GetRelativeTargetDirectory(*dep);
+ static_cast<cmLocalUnixMakefileGenerator3*>(dep->GetLocalGenerator());
+ std::string tgtName = lg3->GetRelativeTargetDirectory(*(*dep).Target);
tgtName += "/all";
depends.push_back(tgtName);
}
@@ -1034,7 +1033,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// for the passed in makefile or if this is the top Makefile wripte out
// the targets
- if (lg2 == lg || lg->IsRootMakefile())
+ if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
{
// for each target Generate the rule files for each target.
cmTargets& targets = lg2->GetMakefile()->GetTargets();
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index a639ff0..fc53fa8 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -12,7 +12,7 @@
#ifndef cmGlobalUnixMakefileGenerator3_h
#define cmGlobalUnixMakefileGenerator3_h
-#include "cmGlobalGenerator.h"
+#include "cmGlobalCommonGenerator.h"
#include "cmGlobalGeneratorFactory.h"
class cmGeneratedFileStream;
@@ -51,7 +51,7 @@ class cmLocalUnixMakefileGenerator3;
*/
-class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
+class cmGlobalUnixMakefileGenerator3 : public cmGlobalCommonGenerator
{
public:
cmGlobalUnixMakefileGenerator3(cmake* cm);
@@ -153,7 +153,7 @@ protected:
cmLocalUnixMakefileGenerator3* lg);
void AppendGlobalTargetDepends(std::vector<std::string>& depends,
- cmTarget& target);
+ cmGeneratorTarget* target);
// does this generator need a requires step for any of its targets
bool NeedRequiresStep(cmTarget const&);
@@ -198,8 +198,8 @@ protected:
cmStrictTargetComparison> ProgressMapType;
ProgressMapType ProgressMap;
- size_t CountProgressMarksInTarget(cmTarget const* target,
- std::set<cmTarget const*>& emitted);
+ size_t CountProgressMarksInTarget(cmGeneratorTarget const* target,
+ std::set<cmGeneratorTarget const*>& emitted);
size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg);
cmGeneratedFileStream *CommandDatabase;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 632141a..65a15ee 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -224,7 +224,7 @@ void cmGlobalVisualStudio6Generator
tt = orderedProjectTargets.begin();
tt != orderedProjectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 4dd54d0..1674e98 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -15,6 +15,7 @@
#include "cmGeneratedFileStream.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
+#include "cmUuid.h"
#include "cmake.h"
#include <cmsys/Encoding.hxx>
@@ -401,7 +402,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -441,7 +442,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -513,8 +514,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
cumulativePath = cumulativePath + "/" + *iter;
}
-
- this->CreateGUID(cumulativePath.c_str());
}
if (!cumulativePath.empty())
@@ -535,7 +534,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
- cmTarget const* target = *tt;
+ cmTarget const* target = (*tt)->Target;
if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
@@ -899,7 +898,6 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
fname += ".vcproj";
cmGeneratedFileStream fout(fname.c_str());
fout.SetCopyIfDifferent(true);
- this->CreateGUID(pname.c_str());
std::string guid = this->GetGUID(pname.c_str());
fout <<
@@ -943,41 +941,29 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
return pname;
}
-std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name)
+//----------------------------------------------------------------------------
+std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
{
- std::string guidStoreName = name;
- guidStoreName += "_GUID_CMAKE";
- const char* storedGUID =
- this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str());
- if(storedGUID)
+ std::string const& guidStoreName = name + "_GUID_CMAKE";
+ if (const char* storedGUID =
+ this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()))
{
return std::string(storedGUID);
}
- cmSystemTools::Error("Unknown Target referenced : ",
- name.c_str());
- return "";
-}
+ // Compute a GUID that is deterministic but unique to the build tree.
+ std::string input = this->CMakeInstance->GetState()->GetBinaryDirectory();
+ input += "|";
+ input += name;
+ cmUuid uuidGenerator;
-void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
-{
- std::string guidStoreName = name;
- guidStoreName += "_GUID_CMAKE";
- if(this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()))
- {
- return;
- }
- std::string ret;
- UUID uid;
- unsigned short *uidstr;
- UuidCreate(&uid);
- UuidToStringW(&uid,&uidstr);
- ret = cmsys::Encoding::ToNarrow(reinterpret_cast<wchar_t*>(uidstr));
- RpcStringFreeW(&uidstr);
- ret = cmSystemTools::UpperCase(ret);
- this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(),
- ret.c_str(), "Stored GUID",
- cmState::INTERNAL);
+ std::vector<unsigned char> uuidNamespace;
+ uuidGenerator.StringToBinary(
+ "ee30c4be-5192-4fb0-b335-722a2dffe760", uuidNamespace);
+
+ std::string guid = uuidGenerator.FromMd5(uuidNamespace, input);
+
+ return cmSystemTools::UpperCase(guid);
}
//----------------------------------------------------------------------------
@@ -1039,12 +1025,13 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
{
return activeConfigs;
}
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
const char* propertyValue =
- target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
+ gt->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
if(cmSystemTools::IsOff(propertyValue))
{
activeConfigs.insert(*i);
@@ -1058,12 +1045,12 @@ cmGlobalVisualStudio7Generator
::IsDependedOn(OrderedTargetDependSet const& projectTargets,
cmTarget const* targetIn)
{
+ cmGeneratorTarget* gtIn = this->GetGeneratorTarget(targetIn);
for (OrderedTargetDependSet::const_iterator l = projectTargets.begin();
l != projectTargets.end(); ++l)
{
- cmTarget const& target = **l;
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
- if(tgtdeps.count(targetIn))
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(*l);
+ if(tgtdeps.count(gtIn))
{
return true;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index c98d269..931ac9c 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -80,9 +80,8 @@ public:
*/
virtual void OutputSLNFile();
- ///! Create a GUID or get an existing one.
- void CreateGUID(const std::string& name);
- std::string GetGUID(const std::string& name);
+ ///! Lookup a stored GUID or compute one deterministically.
+ std::string GetGUID(std::string const& name);
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const std::string& prefix,
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index a3ebc61..f3cf36e 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -185,7 +185,6 @@ void cmGlobalVisualStudio8Generator
void cmGlobalVisualStudio8Generator::Configure()
{
this->cmGlobalVisualStudio7Generator::Configure();
- this->CreateGUID(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
}
//----------------------------------------------------------------------------
@@ -310,14 +309,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmCustomCommandLine commandLine;
commandLine.push_back(cmSystemTools::GetCMakeCommand());
std::string argH = "-H";
- argH += lg->Convert(mf->GetHomeDirectory(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED, true);
+ argH += mf->GetHomeDirectory();
commandLine.push_back(argH);
std::string argB = "-B";
- argB += lg->Convert(mf->GetHomeOutputDirectory(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED, true);
+ argB += mf->GetHomeOutputDirectory();
commandLine.push_back(argB);
commandLine.push_back("--check-stamp-list");
commandLine.push_back(stampList.c_str());
@@ -446,7 +441,8 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
std::ostream& fout, const std::string&, const char*, cmTarget const& t)
{
- TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&t);
+ TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
OrderedTargetDependSet depends(unordered);
for(OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 585d19a..1d583eb 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -13,12 +13,14 @@
#include "cmGlobalVisualStudioGenerator.h"
#include "cmCallVisualStudioMacro.h"
+#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudioGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmTarget.h"
#include <cmsys/Encoding.hxx>
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
@@ -299,13 +301,14 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target,
{
if(linked.insert(target).second)
{
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
if(di->IsLink())
{
- this->FillLinkClosure(*di, linked);
+ this->FillLinkClosure((*di)->Target, linked);
}
}
}
@@ -338,13 +341,14 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends(
{
// Static library targets do not list their link dependencies so
// we must follow them transitively now.
- TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
if(di->IsLink())
{
- this->FollowLinkDepends(*di, linked);
+ this->FollowLinkDepends((*di)->Target, linked);
}
}
}
@@ -413,7 +417,8 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
target.GetType() != cmTarget::MODULE_LIBRARY &&
target.GetType() != cmTarget::EXECUTABLE);
- TargetDependSet const& depends = this->GetTargetDirectDepends(target);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+ TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
// Collect implicit link dependencies (target_link_libraries).
// Static libraries cannot depend on their link implementation
@@ -427,7 +432,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
cmTargetDepend dep = *di;
if(dep.IsLink())
{
- this->FollowLinkDepends(dep, linkDepends);
+ this->FollowLinkDepends(dep->Target, linkDepends);
}
}
}
@@ -440,7 +445,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
cmTargetDepend dep = *di;
if(dep.IsUtil())
{
- this->FollowLinkDepends(dep, utilDepends);
+ this->FollowLinkDepends(dep->Target, utilDepends);
}
}
@@ -843,7 +848,7 @@ cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target)
//----------------------------------------------------------------------------
bool
cmGlobalVisualStudioGenerator::TargetCompare
-::operator()(cmTarget const* l, cmTarget const* r) const
+::operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const
{
// Make sure ALL_BUILD is first so it is the default active project.
if(r->GetName() == "ALL_BUILD")
@@ -868,7 +873,13 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetSet const& targets)
{
- this->insert(targets.begin(), targets.end());
+ for (TargetSet::const_iterator it = targets.begin();
+ it != targets.end(); ++it)
+ {
+ cmGeneratorTarget* gt =
+ (*it)->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(*it);
+ this->insert(gt);
+ }
}
std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
@@ -887,3 +898,71 @@ std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
}
return tmp;
}
+
+void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
+ cmGeneratorTarget* gt, std::vector<cmCustomCommand>& commands,
+ std::string const& configName)
+{
+ std::vector<std::string> outputs;
+ std::string deffile = gt->ObjectDirectory;
+ deffile += "/exportall.def";
+ outputs.push_back(deffile);
+ std::vector<std::string> empty;
+ std::vector<cmSourceFile const*> objectSources;
+ gt->GetObjectSources(objectSources, configName);
+ std::map<cmSourceFile const*, std::string> mapping;
+ for(std::vector<cmSourceFile const*>::const_iterator it
+ = objectSources.begin(); it != objectSources.end(); ++it)
+ {
+ mapping[*it];
+ }
+ gt->LocalGenerator->
+ ComputeObjectFilenames(mapping, gt);
+ std::string obj_dir = gt->ObjectDirectory;
+ std::string cmakeCommand = cmSystemTools::GetCMakeCommand();
+ cmSystemTools::ConvertToWindowsExtendedPath(cmakeCommand);
+ cmCustomCommandLine cmdl;
+ cmdl.push_back(cmakeCommand);
+ cmdl.push_back("-E");
+ cmdl.push_back("__create_def");
+ cmdl.push_back(deffile);
+ std::string obj_dir_expanded = obj_dir;
+ cmSystemTools::ReplaceString(obj_dir_expanded,
+ this->GetCMakeCFGIntDir(),
+ configName.c_str());
+ std::string objs_file = obj_dir_expanded;
+ cmSystemTools::MakeDirectory(objs_file.c_str());
+ objs_file += "/objects.txt";
+ cmdl.push_back(objs_file);
+ cmGeneratedFileStream fout(objs_file.c_str());
+ if(!fout)
+ {
+ cmSystemTools::Error("could not open ", objs_file.c_str());
+ return;
+ }
+ for(std::vector<cmSourceFile const*>::const_iterator it
+ = objectSources.begin(); it != objectSources.end(); ++it)
+ {
+ // Find the object file name corresponding to this source file.
+ std::map<cmSourceFile const*, std::string>::const_iterator
+ map_it = mapping.find(*it);
+ // It must exist because we populated the mapping just above.
+ assert(!map_it->second.empty());
+ std::string objFile = obj_dir + map_it->second;
+ // replace $(ConfigurationName) in the object names
+ cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(),
+ configName.c_str());
+ if(cmHasLiteralSuffix(objFile, ".obj"))
+ {
+ fout << objFile << "\n";
+ }
+ }
+ cmCustomCommandLines commandLines;
+ commandLines.push_back(cmdl);
+ cmCustomCommand command(gt->Target->GetMakefile(),
+ outputs, empty, empty,
+ commandLines,
+ "Auto build dll exports",
+ ".");
+ commands.push_back(command);
+}
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 69b4564..8e2d6a4 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -91,7 +91,8 @@ public:
class TargetSet: public std::set<cmTarget const*> {};
struct TargetCompare
{
- bool operator()(cmTarget const* l, cmTarget const* r) const;
+ bool operator()(cmGeneratorTarget const* l,
+ cmGeneratorTarget const* r) const;
};
class OrderedTargetDependSet;
@@ -102,6 +103,10 @@ public:
const std::string& config) const;
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+
+ void AddSymbolExportCommand(
+ cmGeneratorTarget*, std::vector<cmCustomCommand>& commands,
+ std::string const& configName);
protected:
virtual void Generate();
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 7464e90..21075bb 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -843,6 +843,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext,
{
sourcecode += ".c.objc";
}
+ else if (ext == "swift")
+ {
+ sourcecode += ".swift";
+ }
else if(ext == "plist")
{
sourcecode += ".text.plist";
@@ -2895,10 +2899,11 @@ void cmGlobalXCodeGenerator
}
// Add dependencies on other CMake targets.
- TargetDependSet const& deps = this->GetTargetDirectDepends(*cmtarget);
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(cmtarget);
+ TargetDependSet const& deps = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i)
{
- if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i))
+ if(cmXCodeObject* dptarget = this->FindXCodeTarget((*i)->Target))
{
this->AddDependTarget(target, dptarget);
}
@@ -3804,33 +3809,13 @@ void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry)
//----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p)
{
- if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") )
- {
- return cmSystemTools::ConvertToOutputPath(p);
- }
- else
- {
- std::string ret =
- this->CurrentLocalGenerator->
- ConvertToRelativePath(this->CurrentOutputDirectoryComponents, p);
- return cmSystemTools::ConvertToOutputPath(ret.c_str());
- }
+ return cmSystemTools::ConvertToOutputPath(p);
}
//----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p)
{
- if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") )
- {
- return cmSystemTools::ConvertToOutputPath(p);
- }
- else
- {
- std::string ret =
- this->CurrentLocalGenerator->
- ConvertToRelativePath(this->ProjectOutputDirectoryComponents, p);
- return cmSystemTools::ConvertToOutputPath(ret.c_str());
- }
+ return cmSystemTools::ConvertToOutputPath(p);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 7f4c4c9..fa29b4f 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -48,6 +48,7 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
,GraphName("GG")
,GraphHeader("node [\n fontsize = \"12\"\n];")
,GraphNodePrefix("node")
+,LocalGenerators(localGenerators)
,GenerateForExecutables(true)
,GenerateForStaticLibs(true)
,GenerateForSharedLibs(true)
@@ -55,7 +56,6 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
,GenerateForExternals(true)
,GeneratePerTarget(true)
,GenerateDependers(true)
-,LocalGenerators(localGenerators)
,HaveTargetsAndLibs(false)
{
}
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index a7acd0e..64de684 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -69,14 +69,6 @@ protected:
std::string GraphHeader;
std::string GraphNodePrefix;
- bool GenerateForExecutables;
- bool GenerateForStaticLibs;
- bool GenerateForSharedLibs;
- bool GenerateForModuleLibs;
- bool GenerateForExternals;
- bool GeneratePerTarget;
- bool GenerateDependers;
-
std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex;
const std::vector<cmLocalGenerator*>& LocalGenerators;
@@ -85,6 +77,13 @@ protected:
// maps from the actual target names to node names in dot:
std::map<std::string, std::string> TargetNamesNodes;
+ bool GenerateForExecutables;
+ bool GenerateForStaticLibs;
+ bool GenerateForSharedLibs;
+ bool GenerateForModuleLibs;
+ bool GenerateForExternals;
+ bool GeneratePerTarget;
+ bool GenerateDependers;
bool HaveTargetsAndLibs;
};
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 3551f83..20448c1 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -27,7 +27,7 @@ static std::string cmIfCommandError(
i != args.end(); ++i)
{
err += " ";
- err += cmLocalGenerator::EscapeForCMake(i->GetValue());
+ err += cmOutputConverter::EscapeForCMake(i->GetValue());
}
err += "\n";
return err;
@@ -92,10 +92,6 @@ IsFunctionBlocked(const cmListFileFunction& lff,
}
else
{
- // Place this call on the call stack.
- cmMakefileCall stack_manager(&mf, this->Functions[c], status);
- static_cast<void>(stack_manager);
-
// if trace is enabled, print the evaluated "elseif" statement
if(mf.GetCMakeInstance()->GetTrace())
{
@@ -119,7 +115,8 @@ IsFunctionBlocked(const cmListFileFunction& lff,
{
std::string err = cmIfCommandError(expandedArguments);
err += errorString;
- mf.IssueMessage(messType, err);
+ cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]);
+ mf.GetCMakeInstance()->IssueMessage(messType, err, bt);
if (messType == cmake::FATAL_ERROR)
{
cmSystemTools::SetFatalErrorOccured();
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 28c27c2..ff2c6e5 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -28,9 +28,11 @@ cmInstallFilesGenerator
bool optional):
cmInstallGenerator(dest, configurations, component, message),
Makefile(mf),
- Files(files), Programs(programs),
+ Files(files),
FilePermissions(file_permissions),
- Rename(rename), Optional(optional)
+ Rename(rename),
+ Programs(programs),
+ Optional(optional)
{
// We need per-config actions if any files have generator expressions.
for(std::vector<std::string>::const_iterator i = files.begin();
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 0dbd712..bf482d6 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -43,9 +43,9 @@ protected:
cmMakefile* Makefile;
std::vector<std::string> Files;
- bool Programs;
std::string FilePermissions;
std::string Rename;
+ bool Programs;
bool Optional;
};
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 082a78c..5115788 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -29,7 +29,9 @@ cmInstallTargetGenerator
MessageLevel message,
bool optional):
cmInstallGenerator(dest, configurations, component, message), Target(&t),
- ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
+ FilePermissions(file_permissions),
+ ImportLibrary(implib),
+ Optional(optional)
{
this->ActionsPerConfig = true;
this->NamelinkMode = NamelinkModeNone;
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 075c8a4..db69220 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -14,7 +14,6 @@
#include "cmInstallGenerator.h"
#include "cmTarget.h"
-#include "cmGeneratorTarget.h"
/** \class cmInstallTargetGenerator
* \brief Generate target installation rules.
@@ -100,11 +99,10 @@ protected:
const std::string& toDestDirPath);
cmTarget* Target;
- bool ImportLibrary;
std::string FilePermissions;
- bool Optional;
NamelinkModeType NamelinkMode;
- cmGeneratorTarget* GeneratorTarget;
+ bool ImportLibrary;
+ bool Optional;
};
#endif
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
new file mode 100644
index 0000000..df00b30
--- /dev/null
+++ b/Source/cmLinkedTree.h
@@ -0,0 +1,182 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2015 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.
+============================================================================*/
+#ifndef cmLinkedTree_h
+#define cmLinkedTree_h
+
+#include "cmStandardIncludes.h"
+
+#include <assert.h>
+
+/**
+ @brief A adaptor for traversing a tree structure in a vector
+
+ This class is not intended to be wholly generic like a standard library
+ container adaptor. Mostly it exists to facilitate code sharing for the
+ needs of the cmState. For example, the Truncate() method is a specific
+ requirement of the cmState.
+
+ An empty cmLinkedTree provides a Root() method, and an Extend() method,
+ each of which return iterators. A Tree can be built up by extending
+ from the root, and then extending from any other iterator.
+
+ An iterator resulting from this tree construction can be
+ forward-only-iterated toward the root. Extending the tree never
+ invalidates existing iterators.
+ */
+template<typename T>
+class cmLinkedTree
+{
+ typedef typename std::vector<T>::size_type PositionType;
+ typedef T* PointerType;
+ typedef T& ReferenceType;
+public:
+ class iterator : public std::iterator<std::forward_iterator_tag, T>
+ {
+ friend class cmLinkedTree;
+ cmLinkedTree* Tree;
+
+ // The Position is always 'one past the end'.
+ PositionType Position;
+
+ iterator(cmLinkedTree* tree, PositionType pos)
+ : Tree(tree), Position(pos)
+ {
+
+ }
+
+ public:
+ iterator()
+ : Tree(0), Position(0)
+ {
+
+ }
+
+ void operator++()
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ assert(this->Position <= this->Tree->Data.size());
+ assert(this->Position > 0);
+ this->Position = this->Tree->UpPositions[this->Position - 1];
+ }
+
+ PointerType operator->() const
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ assert(this->Position <= this->Tree->Data.size());
+ assert(this->Position > 0);
+ return this->Tree->GetPointer(this->Position - 1);
+ }
+
+ PointerType operator->()
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ assert(this->Position <= this->Tree->Data.size());
+ assert(this->Position > 0);
+ return this->Tree->GetPointer(this->Position - 1);
+ }
+
+ ReferenceType operator*() const
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ assert(this->Position <= this->Tree->Data.size());
+ assert(this->Position > 0);
+ return this->Tree->GetReference(this->Position - 1);
+ }
+
+ ReferenceType operator*()
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ assert(this->Position <= this->Tree->Data.size());
+ assert(this->Position > 0);
+ return this->Tree->GetReference(this->Position - 1);
+ }
+
+ bool operator==(iterator other) const
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ assert(this->Tree == other.Tree);
+ return this->Position == other.Position;
+ }
+
+ bool operator!=(iterator other) const
+ {
+ assert(this->Tree);
+ assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+ return !(*this == other);
+ }
+
+ bool IsValid() const
+ {
+ if (!this->Tree)
+ {
+ return false;
+ }
+ return this->Position <= this->Tree->Data.size();
+ }
+ };
+
+ iterator Root() const
+ {
+ return iterator(const_cast<cmLinkedTree*>(this), 0);
+ }
+
+ iterator Extend(iterator it)
+ {
+ return Extend_impl(it, T());
+ }
+
+ iterator Extend(iterator it, T t)
+ {
+ return Extend_impl(it, t);
+ }
+
+ iterator Truncate()
+ {
+ assert(this->UpPositions.size() > 0);
+ this->UpPositions.erase(this->UpPositions.begin() + 1,
+ this->UpPositions.end());
+ assert(this->Data.size() > 0);
+ this->Data.erase(this->Data.begin() + 1, this->Data.end());
+ return iterator(this, 1);
+ }
+
+private:
+ T& GetReference(PositionType pos)
+ {
+ return this->Data[pos];
+ }
+
+ T* GetPointer(PositionType pos)
+ {
+ return &this->Data[pos];
+ }
+
+ iterator Extend_impl(iterator it, T t)
+ {
+ assert(this->UpPositions.size() == this->Data.size());
+ assert(it.Position <= this->UpPositions.size());
+ this->UpPositions.push_back(it.Position);
+ this->Data.push_back(t);
+ return iterator(this, this->UpPositions.size());
+ }
+
+ std::vector<T> Data;
+ std::vector<PositionType> UpPositions;
+};
+
+#endif
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 2756cd2..1097dc2 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -234,8 +234,7 @@ bool cmListFile::ParseFile(const char* filename,
{
cmListFileFunction project;
project.Name = "PROJECT";
- cmListFileArgument prj("Project", cmListFileArgument::Unquoted,
- filename, 0);
+ cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0);
project.Arguments.push_back(prj);
this->Functions.insert(this->Functions.begin(),project);
}
@@ -252,7 +251,6 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
{
// Inintialize a new function call.
this->Function = cmListFileFunction();
- this->Function.FilePath = this->FileName;
this->Function.Name = name;
this->Function.Line = line;
@@ -375,7 +373,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim)
{
- cmListFileArgument a(token->text, delim, this->FileName, token->line);
+ cmListFileArgument a(token->text, delim, token->line);
this->Function.Arguments.push_back(a);
if(this->Separation == SeparationOkay)
{
@@ -400,50 +398,50 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
}
}
-void cmListFileBacktrace::Append(cmListFileContext const& context)
-{
- this->push_back(context);
-}
-
-//----------------------------------------------------------------------------
-void cmListFileBacktrace::MakeRelative()
+void cmListFileBacktrace::PrintTitle(std::ostream& out)
{
- if (this->Relative)
+ if (!this->Snapshot.IsValid())
{
return;
}
- for (cmListFileBacktrace::iterator i = this->begin();
- i != this->end(); ++i)
- {
- i->FilePath = this->LocalGenerator->Convert(i->FilePath,
- cmLocalGenerator::HOME);
- }
- this->Relative = true;
+ cmOutputConverter converter(this->Snapshot);
+ cmListFileContext lfc =
+ cmListFileContext::FromCommandContext(
+ this->Context, this->Snapshot.GetExecutionListFile());
+ lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
+ out << (lfc.Line ? " at " : " in ") << lfc;
}
-void cmListFileBacktrace::PrintTitle(std::ostream& out)
+void cmListFileBacktrace::PrintCallStack(std::ostream& out)
{
- if (this->empty())
+ if (!this->Snapshot.IsValid())
{
return;
}
- out << (this->front().Line ? " at " : " in ") << this->front();
-}
-
-void cmListFileBacktrace::PrintCallStack(std::ostream& out)
-{
- if (size() <= 1)
+ cmState::Snapshot parent = this->Snapshot.GetCallStackParent();
+ if (!parent.IsValid() || parent.GetExecutionListFile().empty())
{
return;
}
- const_iterator i = this->begin() + 1;
+ cmOutputConverter converter(this->Snapshot);
+ std::string commandName = this->Snapshot.GetEntryPointCommand();
+ long commandLine = this->Snapshot.GetEntryPointLine();
+
out << "Call Stack (most recent call first):\n";
- while(i != this->end())
+ while(parent.IsValid())
{
- cmListFileContext const& lfc = *i;
+ cmListFileContext lfc;
+ lfc.Name = commandName;
+ lfc.Line = commandLine;
+
+ lfc.FilePath = converter.Convert(parent.GetExecutionListFile(),
+ cmOutputConverter::HOME);
out << " " << lfc << "\n";
- ++i;
+
+ commandName = parent.GetEntryPointCommand();
+ commandLine = parent.GetEntryPointLine();
+ parent = parent.GetCallStackParent();
}
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 4a1d181..aa8a34c 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -14,7 +14,7 @@
#include "cmStandardIncludes.h"
-class cmLocalGenerator;
+#include "cmState.h"
/** \class cmListFileCache
* \brief A class to cache list file contents.
@@ -25,6 +25,13 @@ class cmLocalGenerator;
class cmMakefile;
+struct cmCommandContext
+{
+ std::string Name;
+ long Line;
+ cmCommandContext(): Name(), Line(0) {}
+};
+
struct cmListFileArgument
{
enum Delimiter
@@ -33,12 +40,11 @@ struct cmListFileArgument
Quoted,
Bracket
};
- cmListFileArgument(): Value(), Delim(Unquoted), FilePath(0), Line(0) {}
- cmListFileArgument(const cmListFileArgument& r):
- Value(r.Value), Delim(r.Delim), FilePath(r.FilePath), Line(r.Line) {}
- cmListFileArgument(const std::string& v, Delimiter d, const char* file,
- long line): Value(v), Delim(d),
- FilePath(file), Line(line) {}
+ cmListFileArgument(): Value(), Delim(Unquoted), Line(0) {}
+ cmListFileArgument(const cmListFileArgument& r)
+ : Value(r.Value), Delim(r.Delim), Line(r.Line) {}
+ cmListFileArgument(const std::string& v, Delimiter d, long line)
+ : Value(v), Delim(d), Line(line) {}
bool operator == (const cmListFileArgument& r) const
{
return (this->Value == r.Value) && (this->Delim == r.Delim);
@@ -49,7 +55,6 @@ struct cmListFileArgument
}
std::string Value;
Delimiter Delim;
- const char* FilePath;
long Line;
};
@@ -59,6 +64,16 @@ struct cmListFileContext
std::string FilePath;
long Line;
cmListFileContext(): Name(), FilePath(), Line(0) {}
+
+ static cmListFileContext FromCommandContext(cmCommandContext const& lfcc,
+ std::string const& fileName)
+ {
+ cmListFileContext lfc;
+ lfc.FilePath = fileName;
+ lfc.Line = lfcc.Line;
+ lfc.Name = lfcc.Name;
+ return lfc;
+ }
};
std::ostream& operator<<(std::ostream&, cmListFileContext const&);
@@ -66,29 +81,25 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
-struct cmListFileFunction: public cmListFileContext
+struct cmListFileFunction: public cmCommandContext
{
std::vector<cmListFileArgument> Arguments;
};
-class cmListFileBacktrace: private std::vector<cmListFileContext>
+class cmListFileBacktrace
{
public:
- cmListFileBacktrace(cmLocalGenerator* localGen)
- : LocalGenerator(localGen)
- , Relative(localGen ? false : true)
+ cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot(),
+ cmCommandContext const& cc = cmCommandContext())
+ : Context(cc), Snapshot(snapshot)
{
}
- void Append(cmListFileContext const& context);
-
- void MakeRelative();
-
void PrintTitle(std::ostream& out);
void PrintCallStack(std::ostream& out);
private:
- cmLocalGenerator* LocalGenerator;
- bool Relative;
+ cmCommandContext Context;
+ cmState::Snapshot Snapshot;
};
struct cmListFile
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
new file mode 100644
index 0000000..4583446
--- /dev/null
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -0,0 +1,40 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 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 "cmLocalCommonGenerator.h"
+
+#include "cmMakefile.h"
+
+cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalGenerator(gg, parent, snapshot)
+{
+}
+
+cmLocalCommonGenerator::~cmLocalCommonGenerator()
+{
+}
+
+void cmLocalCommonGenerator::SetConfigName()
+{
+ // Store the configuration name that will be generated.
+ if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
+ {
+ // Use the build type given by the user.
+ this->ConfigName = config;
+ }
+ else
+ {
+ // No configuration type given.
+ this->ConfigName = "";
+ }
+}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
new file mode 100644
index 0000000..af94cda
--- /dev/null
+++ b/Source/cmLocalCommonGenerator.h
@@ -0,0 +1,39 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmLocalCommonGenerator_h
+#define cmLocalCommonGenerator_h
+
+#include "cmLocalGenerator.h"
+
+class cmCommonTargetGenerator;
+
+/** \class cmLocalCommonGenerator
+ * \brief Common infrastructure for Makefile and Ninja local generators.
+ */
+class cmLocalCommonGenerator: public cmLocalGenerator
+{
+public:
+ cmLocalCommonGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
+ ~cmLocalCommonGenerator();
+
+ std::string const& GetConfigName() { return this->ConfigName; }
+
+protected:
+ void SetConfigName();
+ std::string ConfigName;
+
+ friend class cmCommonTargetGenerator;
+};
+
+#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index eb6b871..e170253 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -32,8 +32,6 @@
# include <cmsys/MD5.h>
#endif
-#include <cmsys/System.h>
-
#include <ctype.h> // for isalpha
#include <assert.h>
@@ -46,7 +44,7 @@
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
- : StateSnapshot(snapshot)
+ : cmOutputConverter(snapshot), StateSnapshot(snapshot)
{
assert(snapshot.IsValid());
this->GlobalGenerator = gg;
@@ -58,9 +56,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
this->Makefile = new cmMakefile(this);
- this->LinkScriptShell = false;
- this->UseRelativePaths = false;
- this->Configured = false;
this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0;
this->BackwardsCompatibilityFinal = false;
@@ -71,79 +66,20 @@ cmLocalGenerator::~cmLocalGenerator()
delete this->Makefile;
}
-bool cmLocalGenerator::IsRootMakefile() const
+void cmLocalGenerator::IssueMessage(cmake::MessageType t,
+ std::string const& text) const
{
- return !this->StateSnapshot.GetParent().IsValid();
-}
+ cmListFileContext lfc;
+ lfc.FilePath = this->StateSnapshot.GetCurrentSourceDirectory();
+ lfc.FilePath += "/CMakeLists.txt";
-//----------------------------------------------------------------------------
-class cmLocalGeneratorCurrent
-{
- cmGlobalGenerator* GG;
- cmLocalGenerator* LG;
- cmState::Snapshot Snapshot;
-public:
- cmLocalGeneratorCurrent(cmLocalGenerator* lg)
+ if(!this->GlobalGenerator->GetCMakeInstance()->GetIsInTryCompile())
{
- this->GG = lg->GetGlobalGenerator();
- this->LG = this->GG->GetCurrentLocalGenerator();
- this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
- this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot());
- this->GG->SetCurrentLocalGenerator(lg);
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- this->GG->GetFileLockPool().PushFileScope();
-#endif
+ cmOutputConverter converter(this->StateSnapshot);
+ lfc.FilePath = converter.Convert(lfc.FilePath, cmLocalGenerator::HOME);
}
- ~cmLocalGeneratorCurrent()
- {
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- this->GG->GetFileLockPool().PopFileScope();
-#endif
- this->GG->SetCurrentLocalGenerator(this->LG);
- this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
- }
-};
-
-//----------------------------------------------------------------------------
-void cmLocalGenerator::Configure()
-{
- // Manage the global generator's current local generator.
- cmLocalGeneratorCurrent clg(this);
- static_cast<void>(clg);
-
- // make sure the CMakeFiles dir is there
- std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
- filesDir += cmake::GetCMakeFilesDirectory();
- cmSystemTools::MakeDirectory(filesDir.c_str());
-
- std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
- currentStart += "/CMakeLists.txt";
- assert(cmSystemTools::FileExists(currentStart.c_str(), true));
- this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
-
- // at the end of the ReadListFile handle any old style subdirs
- // first get all the subdirectories
- std::vector<cmLocalGenerator *> subdirs = this->GetChildren();
-
- // for each subdir recurse
- std::vector<cmLocalGenerator *>::iterator sdi = subdirs.begin();
- for (; sdi != subdirs.end(); ++sdi)
- {
- if (!(*sdi)->Configured)
- {
- this->Makefile->ConfigureSubDirectory(*sdi);
- }
- }
-
- this->Makefile->AddCMakeDependFilesFromUser();
-
- // Check whether relative paths should be used for optionally
- // relative paths.
- this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
-
- this->ComputeObjectMaxPath();
-
- this->Configured = true;
+ lfc.Line = 0;
+ this->GlobalGenerator->GetCMakeInstance()->IssueMessage(t, text, lfc);
}
//----------------------------------------------------------------------------
@@ -171,7 +107,7 @@ void cmLocalGenerator::ComputeObjectMaxPath()
w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax
<< ", which is less than the minimum of 128. "
<< "The value will be ignored.";
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
}
else
@@ -180,17 +116,12 @@ void cmLocalGenerator::ComputeObjectMaxPath()
w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen
<< "\", which fails to parse as a positive integer. "
<< "The value will be ignored.";
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ this->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
}
this->ObjectMaxPathViolations.clear();
}
-void cmLocalGenerator::ConfigureFinalPass()
-{
- this->Makefile->ConfigureFinalPass();
-}
-
void cmLocalGenerator::TraceDependencies()
{
std::vector<std::string> configs;
@@ -522,7 +453,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
objectDir = this->Convert(objectDir,START_OUTPUT,SHELL);
std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
std::string sourceFile =
- this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true);
+ this->ConvertToOutputFormat(source.GetFullPath(), SHELL);
std::string varString = "CMAKE_";
varString += lang;
varString += "_COMPILE_OBJECT";
@@ -1169,56 +1100,6 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target,
//----------------------------------------------------------------------------
std::string
-cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
- std::string const& result,
- OutputFormat format)
-{
- // If this is a windows shell, the result has a space, and the path
- // already exists, we can use a short-path to reference it without a
- // space.
- if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos &&
- cmSystemTools::FileExists(remote.c_str()))
- {
- std::string tmp;
- if(cmSystemTools::GetShortPath(remote, tmp))
- {
- return this->Convert(tmp, NONE, format, true);
- }
- }
-
- // Otherwise, leave it unchanged.
- return result;
-}
-
-//----------------------------------------------------------------------------
-std::string
-cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote,
- RelativeRoot local,
- OutputFormat format)
-{
- // Perform standard conversion.
- std::string result = this->Convert(remote, local, format, true);
-
- // Consider short-path.
- return this->ConvertToOutputForExistingCommon(remote, result, format);
-}
-
-//----------------------------------------------------------------------------
-std::string
-cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote,
- const std::string& local,
- OutputFormat format)
-{
- // Perform standard conversion.
- std::string result = this->Convert(remote, local, format, true);
-
- // Consider short-path.
- const char* remotePath = this->GetRelativeRootPath(remote);
- return this->ConvertToOutputForExistingCommon(remotePath, result, format);
-}
-
-//----------------------------------------------------------------------------
-std::string
cmLocalGenerator::ConvertToIncludeReference(std::string const& path,
OutputFormat format,
bool forceFullPaths)
@@ -1316,8 +1197,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
{
includeFlags << fwSearchFlag;
}
- includeFlags << this->Convert(frameworkDir, START_OUTPUT,
- shellFormat, true)
+ includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat)
<< " ";
}
continue;
@@ -1446,7 +1326,7 @@ void cmLocalGenerator::AddCompileOptions(
"higher \"" << it->first << "_STANDARD\" \"" << standard << "\". "
"This is not permitted. The COMPILE_FEATURES may not both depend on "
"and be depended on by the link implementation." << std::endl;
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
}
@@ -1459,7 +1339,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
const std::string& lang,
const std::string& config,
bool stripImplicitInclDirs
- )
+ ) const
{
// Need to decide whether to automatically include the source and
// binary directories at the beginning of the include path.
@@ -2170,7 +2050,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
"dialect \"" << lang << standardProp << "\" "
<< (ext ? "(with compiler extensions)" : "") << ", but CMake "
"does not know the compile flags to use to enable it.";
- this->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
}
else
{
@@ -2214,7 +2094,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
std::string e =
"CMAKE_" + lang + "_STANDARD_DEFAULT is set to invalid value '" +
std::string(defaultStd) + "'";
- this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, e);
+ this->IssueMessage(cmake::INTERNAL_ERROR, e);
return;
}
@@ -2430,7 +2310,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
<< flagsVar << " was removed.\n"
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0018);
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
// fall through to OLD behaviour
}
case cmPolicies::OLD:
@@ -2644,6 +2524,33 @@ void cmLocalGenerator::AppendFeatureOptions(
}
//----------------------------------------------------------------------------
+const char* cmLocalGenerator::GetFeature(const std::string& feature,
+ const std::string& config)
+{
+ // TODO: Define accumulation policy for features (prepend, append, replace).
+ // Currently we always replace.
+ if(!config.empty())
+ {
+ std::string featureConfig = feature;
+ featureConfig += "_";
+ featureConfig += cmSystemTools::UpperCase(config);
+ if(const char* value = this->Makefile->GetProperty(featureConfig))
+ {
+ return value;
+ }
+ }
+ if(const char* value = this->Makefile->GetProperty(feature))
+ {
+ return value;
+ }
+ if(cmLocalGenerator* parent = this->GetParent())
+ {
+ return parent->GetFeature(feature, config);
+ }
+ return 0;
+}
+
+//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
const char* default_comment)
@@ -2675,242 +2582,6 @@ cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
}
//----------------------------------------------------------------------------
-std::string
-cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(
- const std::string& remote)
-{
- return this->Convert(remote, START_OUTPUT, SHELL, true);
-}
-
-//----------------------------------------------------------------------------
-const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
-{
- switch (relroot)
- {
- case HOME: return this->GetState()->GetSourceDirectory();
- case START: return this->StateSnapshot.GetCurrentSourceDirectory();
- case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory();
- case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory();
- default: break;
- }
- return 0;
-}
-
-//----------------------------------------------------------------------------
-std::string cmLocalGenerator::Convert(const std::string& source,
- RelativeRoot relative,
- OutputFormat output,
- bool optional)
-{
- // Convert the path to a relative path.
- std::string result = source;
-
- if (!optional || this->UseRelativePaths)
- {
- switch (relative)
- {
- case HOME:
- //result = cmSystemTools::CollapseFullPath(result.c_str());
- result = this->ConvertToRelativePath(
- this->GetState()->GetSourceDirectoryComponents(), result);
- break;
- case START:
- //result = cmSystemTools::CollapseFullPath(result.c_str());
- result = this->ConvertToRelativePath(
- this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
- break;
- case HOME_OUTPUT:
- //result = cmSystemTools::CollapseFullPath(result.c_str());
- result = this->ConvertToRelativePath(
- this->GetState()->GetBinaryDirectoryComponents(), result);
- break;
- case START_OUTPUT:
- //result = cmSystemTools::CollapseFullPath(result.c_str());
- result = this->ConvertToRelativePath(
- this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
- break;
- case FULL:
- result = cmSystemTools::CollapseFullPath(result);
- break;
- case NONE:
- break;
- }
- }
- return this->ConvertToOutputFormat(result, output);
-}
-
-//----------------------------------------------------------------------------
-std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
- OutputFormat output)
-{
- std::string result = source;
- // Convert it to an output path.
- if (output == MAKERULE)
- {
- result = cmSystemTools::ConvertToOutputPath(result.c_str());
- }
- else if(output == SHELL || output == WATCOMQUOTE)
- {
- // For the MSYS shell convert drive letters to posix paths, so
- // that c:/some/path becomes /c/some/path. This is needed to
- // avoid problems with the shell path translation.
- if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell)
- {
- if(result.size() > 2 && result[1] == ':')
- {
- result[1] = result[0];
- result[0] = '/';
- }
- }
- if(this->GetState()->UseWindowsShell())
- {
- std::replace(result.begin(), result.end(), '/', '\\');
- }
- result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE);
- }
- else if(output == RESPONSE)
- {
- result = this->EscapeForShell(result, false, false, false);
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-std::string cmLocalGenerator::Convert(RelativeRoot remote,
- const std::string& local,
- OutputFormat output,
- bool optional)
-{
- const char* remotePath = this->GetRelativeRootPath(remote);
-
- // The relative root must have a path (i.e. not FULL or NONE)
- assert(remotePath != 0);
-
- if(!local.empty() && (!optional || this->UseRelativePaths))
- {
- std::vector<std::string> components;
- cmSystemTools::SplitPath(local, components);
- std::string result = this->ConvertToRelativePath(components, remotePath);
- return this->ConvertToOutputFormat(result, output);
- }
- else
- {
- return this->ConvertToOutputFormat(remotePath, output);
- }
-}
-
-//----------------------------------------------------------------------------
-static bool cmLocalGeneratorNotAbove(const char* a, const char* b)
-{
- return (cmSystemTools::ComparePath(a, b) ||
- cmSystemTools::IsSubDirectory(a, b));
-}
-
-//----------------------------------------------------------------------------
-std::string
-cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
- const std::string& in_remote,
- bool force)
-{
- // The path should never be quoted.
- assert(in_remote[0] != '\"');
-
- // The local path should never have a trailing slash.
- assert(!local.empty() && !(local[local.size()-1] == ""));
-
- // If the path is already relative then just return the path.
- if(!cmSystemTools::FileIsFullPath(in_remote.c_str()))
- {
- return in_remote;
- }
-
- if(!force)
- {
- // Skip conversion if the path and local are not both in the source
- // or both in the binary tree.
- std::string local_path = cmSystemTools::JoinPath(local);
- if(!((cmLocalGeneratorNotAbove(local_path.c_str(),
- this->StateSnapshot.GetRelativePathTopBinary()) &&
- cmLocalGeneratorNotAbove(in_remote.c_str(),
- this->StateSnapshot.GetRelativePathTopBinary())) ||
- (cmLocalGeneratorNotAbove(local_path.c_str(),
- this->StateSnapshot.GetRelativePathTopSource()) &&
- cmLocalGeneratorNotAbove(in_remote.c_str(),
- this->StateSnapshot.GetRelativePathTopSource()))))
- {
- return in_remote;
- }
- }
-
- // Identify the longest shared path component between the remote
- // path and the local path.
- std::vector<std::string> remote;
- cmSystemTools::SplitPath(in_remote, remote);
- unsigned int common=0;
- while(common < remote.size() &&
- common < local.size() &&
- cmSystemTools::ComparePath(remote[common],
- local[common]))
- {
- ++common;
- }
-
- // If no part of the path is in common then return the full path.
- if(common == 0)
- {
- return in_remote;
- }
-
- // If the entire path is in common then just return a ".".
- if(common == remote.size() &&
- common == local.size())
- {
- return ".";
- }
-
- // If the entire path is in common except for a trailing slash then
- // just return a "./".
- if(common+1 == remote.size() &&
- remote[common].empty() &&
- common == local.size())
- {
- return "./";
- }
-
- // Construct the relative path.
- std::string relative;
-
- // First add enough ../ to get up to the level of the shared portion
- // of the path. Leave off the trailing slash. Note that the last
- // component of local will never be empty because local should never
- // have a trailing slash.
- for(unsigned int i=common; i < local.size(); ++i)
- {
- relative += "..";
- if(i < local.size()-1)
- {
- relative += "/";
- }
- }
-
- // Now add the portion of the destination path that is not included
- // in the shared portion of the path. Add a slash the first time
- // only if there was already something in the path. If there was a
- // trailing slash in the input then the last iteration of the loop
- // will add a slash followed by an empty string which will preserve
- // the trailing slash in the output.
-
- if(!relative.empty() && !remote.empty())
- {
- relative += "/";
- }
- relative += cmJoin(cmRange(remote).advance(common), "/");
-
- // Finally return the path.
- return relative;
-}
-
-//----------------------------------------------------------------------------
class cmInstallTargetGeneratorLocal: public cmInstallTargetGenerator
{
public:
@@ -3151,7 +2822,7 @@ cmLocalGenerator
<< " " << ssin << "\n"
<< "cannot be safely placed under this directory. "
<< "The build may not work correctly.";
- this->Makefile->IssueMessage(cmake::WARNING, m.str());
+ this->IssueMessage(cmake::WARNING, m.str());
}
}
#else
@@ -3195,11 +2866,6 @@ bool cmLocalGenerator::IsNMake() const
return this->GetState()->UseNMake();
}
-void cmLocalGenerator::SetConfiguredCMP0014(bool configured)
-{
- this->Configured = configured;
-}
-
//----------------------------------------------------------------------------
std::string
cmLocalGenerator
@@ -3308,150 +2974,6 @@ cmLocalGenerator
}
//----------------------------------------------------------------------------
-static bool cmLocalGeneratorIsShellOperator(const std::string& str)
-{
- static std::set<std::string> shellOperators;
- if(shellOperators.empty())
- {
- shellOperators.insert("<");
- shellOperators.insert(">");
- shellOperators.insert("<<");
- shellOperators.insert(">>");
- shellOperators.insert("|");
- shellOperators.insert("||");
- shellOperators.insert("&&");
- shellOperators.insert("&>");
- shellOperators.insert("1>");
- shellOperators.insert("2>");
- shellOperators.insert("2>&1");
- shellOperators.insert("1>&2");
- }
- return shellOperators.count(str) > 0;
-}
-
-//----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForShell(const std::string& str,
- bool makeVars,
- bool forEcho,
- bool useWatcomQuote)
-{
- // Do not escape shell operators.
- if(cmLocalGeneratorIsShellOperator(str))
- {
- return str;
- }
-
- // Compute the flags for the target shell environment.
- int flags = 0;
- if(this->GetState()->UseWindowsVSIDE())
- {
- flags |= cmsysSystem_Shell_Flag_VSIDE;
- }
- else if(!this->LinkScriptShell)
- {
- flags |= cmsysSystem_Shell_Flag_Make;
- }
- if(makeVars)
- {
- flags |= cmsysSystem_Shell_Flag_AllowMakeVariables;
- }
- if(forEcho)
- {
- flags |= cmsysSystem_Shell_Flag_EchoWindows;
- }
- if(useWatcomQuote)
- {
- flags |= cmsysSystem_Shell_Flag_WatcomQuote;
- }
- if(this->GetState()->UseWatcomWMake())
- {
- flags |= cmsysSystem_Shell_Flag_WatcomWMake;
- }
- if(this->GetState()->UseMinGWMake())
- {
- flags |= cmsysSystem_Shell_Flag_MinGWMake;
- }
- if(this->GetState()->UseNMake())
- {
- flags |= cmsysSystem_Shell_Flag_NMake;
- }
-
- // Compute the buffer size needed.
- int size = (this->GetState()->UseWindowsShell() ?
- cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
- cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags));
-
- // Compute the shell argument itself.
- std::vector<char> arg(size);
- if(this->GetState()->UseWindowsShell())
- {
- cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
- }
- else
- {
- cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags);
- }
- return std::string(&arg[0]);
-}
-
-//----------------------------------------------------------------------------
-std::string cmLocalGenerator::EscapeForCMake(const std::string& str)
-{
- // Always double-quote the argument to take care of most escapes.
- std::string result = "\"";
- for(const char* c = str.c_str(); *c; ++c)
- {
- if(*c == '"')
- {
- // Escape the double quote to avoid ending the argument.
- result += "\\\"";
- }
- else if(*c == '$')
- {
- // Escape the dollar to avoid expanding variables.
- result += "\\$";
- }
- else if(*c == '\\')
- {
- // Escape the backslash to avoid other escapes.
- result += "\\\\";
- }
- else
- {
- // Other characters will be parsed correctly.
- result += *c;
- }
- }
- result += "\"";
- return result;
-}
-
-//----------------------------------------------------------------------------
-cmLocalGenerator::FortranFormat
-cmLocalGenerator::GetFortranFormat(const char* value)
-{
- FortranFormat format = FortranFormatNone;
- if(value && *value)
- {
- std::vector<std::string> fmt;
- cmSystemTools::ExpandListArgument(value, fmt);
- for(std::vector<std::string>::iterator fi = fmt.begin();
- fi != fmt.end(); ++fi)
- {
- if(*fi == "FIXED")
- {
- format = FortranFormatFixed;
- }
- if(*fi == "FREE")
- {
- format = FortranFormatFree;
- }
- }
- }
- return format;
-}
-
-//----------------------------------------------------------------------------
std::string
cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
{
@@ -3481,7 +3003,7 @@ cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility()
}
}
this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch);
- this->BackwardsCompatibilityFinal = this->Configured;
+ this->BackwardsCompatibilityFinal = this->Makefile->IsConfigured();
}
return this->BackwardsCompatibility;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 32b17f5..98f4d3a 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -14,6 +14,8 @@
#include "cmStandardIncludes.h"
#include "cmState.h"
+#include "cmake.h"
+#include "cmOutputConverter.h"
class cmMakefile;
class cmGlobalGenerator;
@@ -31,26 +33,19 @@ class cmCustomCommandGenerator;
* platforms. This class should never be constructed directly. A
* GlobalGenerator will create it and invoke the appropriate commands on it.
*/
-class cmLocalGenerator
+class cmLocalGenerator : public cmOutputConverter
{
public:
cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalGenerator();
- /// @return whether we are processing the top CMakeLists.txt file.
- bool IsRootMakefile() const;
-
/**
* Generate the makefile for this directory.
*/
virtual void Generate() {}
- /**
- * Process the CMakeLists files for this directory to fill in the
- * Makefile ivar
- */
- virtual void Configure();
+ virtual void ComputeHomeRelativeOutputPath() {}
/**
* Calls TraceVSDependencies() on all targets of this generator.
@@ -60,11 +55,6 @@ public:
virtual void AddHelperCommands() {}
/**
- * Perform any final calculations prior to generation
- */
- void ConfigureFinalPass();
-
- /**
* Generate the install rules files in this directory.
*/
void GenerateInstallRules();
@@ -96,44 +86,6 @@ public:
cmState* GetState() const;
cmState::Snapshot GetStateSnapshot() const;
- /**
- * Convert something to something else. This is a centralized conversion
- * routine used by the generators to handle relative paths and the like.
- * The flags determine what is actually done.
- *
- * relative: treat the argument as a directory and convert it to make it
- * relative or full or unchanged. If relative (HOME, START etc) then that
- * specifies what it should be relative to.
- *
- * output: make the result suitable for output to a...
- *
- * optional: should any relative path operation be controlled by the rel
- * path setting
- */
- enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
- enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE };
- std::string ConvertToOutputFormat(const std::string& source,
- OutputFormat output);
- std::string Convert(const std::string& remote, RelativeRoot local,
- OutputFormat output = UNCHANGED,
- bool optional = false);
- std::string Convert(RelativeRoot remote, const std::string& local,
- OutputFormat output = UNCHANGED,
- bool optional = false);
-
- /**
- * Get path for the specified relative root.
- */
- const char* GetRelativeRootPath(RelativeRoot relroot);
-
- /**
- * Convert the given path to an output path that is optionally
- * relative based on the cache option CMAKE_USE_RELATIVE_PATHS. The
- * remote path must use forward slashes and not already be escaped
- * or quoted.
- */
- std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote);
-
///! set/get the parent generator
cmLocalGenerator* GetParent() const {return this->Parent;}
@@ -194,6 +146,9 @@ public:
void AppendFeatureOptions(std::string& flags, const std::string& lang,
const char* feature);
+ const char* GetFeature(const std::string& feature,
+ const std::string& config);
+
/** \brief Get absolute path to dependency \a name
*
* Translate a dependency as given in CMake code to the name to
@@ -209,17 +164,6 @@ public:
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
- ///! for existing files convert to output path and short path if spaces
- std::string ConvertToOutputForExisting(const std::string& remote,
- RelativeRoot local = START_OUTPUT,
- OutputFormat format = SHELL);
-
- /** For existing path identified by RelativeRoot convert to output
- path and short path if spaces. */
- std::string ConvertToOutputForExisting(RelativeRoot remote,
- const std::string& local = "",
- OutputFormat format = SHELL);
-
virtual std::string ConvertToIncludeReference(std::string const& path,
OutputFormat format = SHELL,
bool forceFullPaths = false);
@@ -239,7 +183,7 @@ public:
cmGeneratorTarget* target,
const std::string& lang = "C",
const std::string& config = "",
- bool stripImplicitInclDirs = true);
+ bool stripImplicitInclDirs = true) const;
void AddCompileOptions(std::string& flags, cmTarget* target,
const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines,
@@ -291,40 +235,6 @@ public:
const char* FilterPrefix;
};
- /** Set whether to treat conversions to SHELL as a link script shell. */
- void SetLinkScriptShell(bool b) { this->LinkScriptShell = b; }
-
- /** Escape the given string to be used as a command line argument in
- the native build system shell. Optionally allow the build
- system to replace make variable references. Optionally adjust
- escapes for the special case of passing to the native echo
- command. */
- std::string EscapeForShell(const std::string& str, bool makeVars = false,
- bool forEcho = false,
- bool useWatcomQuote = false);
-
- /** Escape the given string as an argument in a CMake script. */
- static std::string EscapeForCMake(const std::string& str);
-
- enum FortranFormat
- {
- FortranFormatNone,
- FortranFormatFixed,
- FortranFormatFree
- };
- FortranFormat GetFortranFormat(const char* value);
-
- /**
- * Convert the given remote path to a relative path with respect to
- * the given local path. The local path must be given in component
- * form (see SystemTools::SplitPath) without a trailing slash. The
- * remote path must use forward slashes and not already be escaped
- * or quoted.
- */
- std::string ConvertToRelativePath(const std::vector<std::string>& local,
- const std::string& remote,
- bool force=false);
-
/**
* Get the relative path from the generator output directory to a
* per-target support directory.
@@ -392,8 +302,10 @@ public:
bool IsMinGWMake() const;
bool IsNMake() const;
- void SetConfiguredCMP0014(bool configured);
+ void IssueMessage(cmake::MessageType t, std::string const& text) const;
+
+ void ComputeObjectMaxPath();
protected:
///! put all the libraries for a target on into the given stream
void OutputLinkLibraries(std::string& linkLibraries,
@@ -439,7 +351,6 @@ protected:
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
- void ComputeObjectMaxPath();
virtual std::string ConvertToLinkReference(std::string const& lib,
OutputFormat format = SHELL);
@@ -459,9 +370,6 @@ protected:
std::set<cmTarget const*> WarnCMP0063;
- bool LinkScriptShell;
- bool UseRelativePaths;
- bool Configured;
bool EmitUniversalBinaryFlags;
// Hack for ExpandRuleVariable until object-oriented version is
@@ -471,10 +379,6 @@ protected:
cmIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal;
private:
- std::string ConvertToOutputForExistingCommon(const std::string& remote,
- std::string const& result,
- OutputFormat format);
-
void AddSharedFlags(std::string& flags, const std::string& lang,
bool shared);
bool GetShouldUseOldFlags(bool shared, const std::string &lang) const;
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index 870b9b9..8e498dd 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -37,7 +37,7 @@ void cmLocalGhsMultiGenerator::Generate()
{
continue;
}
- cmGhsMultiTargetGenerator tg(l->second->Target);
+ cmGhsMultiTargetGenerator tg(l->second);
tg.Generate();
}
}
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index c08c91f..a293d06 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -25,8 +25,7 @@
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
- , ConfigName("")
+ : cmLocalCommonGenerator(gg, parent, snapshot)
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";
@@ -41,6 +40,15 @@ cmLocalNinjaGenerator::~cmLocalNinjaGenerator()
void cmLocalNinjaGenerator::Generate()
{
+ // Compute the path to use when referencing the current output
+ // directory from the top output directory.
+ this->HomeRelativeOutputPath =
+ this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT);
+ if(this->HomeRelativeOutputPath == ".")
+ {
+ this->HomeRelativeOutputPath = "";
+ }
+
this->SetConfigName();
this->WriteProcessedMakefile(this->GetBuildFileStream());
@@ -49,7 +57,7 @@ void cmLocalNinjaGenerator::Generate()
#endif
// We do that only once for the top CMakeLists.txt file.
- if(this->IsRootMakefile())
+ if(this->Makefile->IsRootMakefile())
{
this->WriteBuildFileTop();
@@ -91,25 +99,6 @@ void cmLocalNinjaGenerator::Generate()
this->WriteCustomCommandBuildStatements();
}
-// Implemented in:
-// cmLocalUnixMakefileGenerator3.
-// Used in:
-// Source/cmMakefile.cxx
-// Source/cmGlobalGenerator.cxx
-void cmLocalNinjaGenerator::Configure()
-{
- // Compute the path to use when referencing the current output
- // directory from the top output directory.
- this->HomeRelativeOutputPath =
- this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT);
- if(this->HomeRelativeOutputPath == ".")
- {
- this->HomeRelativeOutputPath = "";
- }
- this->cmLocalGenerator::Configure();
-
-}
-
// TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it.
std::string cmLocalNinjaGenerator
::GetTargetDirectory(cmTarget const& target) const
@@ -271,22 +260,6 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
os << "\n";
}
-void cmLocalNinjaGenerator::SetConfigName()
-{
- // Store the configuration name that will be generated.
- if(const char* config =
- this->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- // Use the build type given by the user.
- this->ConfigName = config;
- }
- else
- {
- // No configuration type given.
- this->ConfigName = "";
- }
-}
-
//----------------------------------------------------------------------------
void cmLocalNinjaGenerator::ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
@@ -308,7 +281,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
<< "# Write statements declared in CMakeLists.txt:" << std::endl
<< "# "
<< this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl;
- if(this->IsRootMakefile())
+ if(this->Makefile->IsRootMakefile())
os << "# Which is the root file." << std::endl;
cmGlobalNinjaGenerator::WriteDivider(os);
os << std::endl;
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 7ae97de..d10be0c 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -13,7 +13,7 @@
#ifndef cmLocalNinjaGenerator_h
# define cmLocalNinjaGenerator_h
-# include "cmLocalGenerator.h"
+# include "cmLocalCommonGenerator.h"
# include "cmNinjaTypes.h"
class cmCustomCommandGenerator;
@@ -28,7 +28,7 @@ class cmake;
* cmLocalNinjaGenerator produces a local build.ninja file from its
* member Makefile.
*/
-class cmLocalNinjaGenerator : public cmLocalGenerator
+class cmLocalNinjaGenerator : public cmLocalCommonGenerator
{
public:
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
@@ -38,8 +38,6 @@ public:
virtual void Generate();
- virtual void Configure();
-
virtual std::string GetTargetDirectory(cmTarget const& target) const;
const cmGlobalNinjaGenerator* GetGlobalNinjaGenerator() const;
@@ -48,9 +46,6 @@ public:
const cmake* GetCMakeInstance() const;
cmake* GetCMakeInstance();
- std::string const& GetConfigName() const
- { return this->ConfigName; }
-
/// @returns the relative path between the HomeOutputDirectory and this
/// local generators StartOutputDirectory.
std::string GetHomeRelativeOutputPath() const
@@ -112,8 +107,6 @@ private:
void WriteProcessedMakefile(std::ostream& os);
void WritePools(std::ostream& os);
- void SetConfigName();
-
void WriteCustomCommandRule();
void WriteCustomCommandBuildStatement(cmCustomCommand const *cc,
const cmNinjaDeps& orderOnlyDeps);
@@ -122,7 +115,6 @@ private:
std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg);
- std::string ConfigName;
std::string HomeRelativeOutputPath;
typedef std::map<cmCustomCommand const*, std::set<cmTarget*> >
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 3eea59b..5d17a40 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -82,7 +82,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
cmLocalUnixMakefileGenerator3::
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+ : cmLocalCommonGenerator(gg, parent, snapshot)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
@@ -98,37 +98,9 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3()
}
//----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::Configure()
-{
- // Compute the path to use when referencing the current output
- // directory from the top output directory.
- this->HomeRelativeOutputPath =
- this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT);
- if(this->HomeRelativeOutputPath == ".")
- {
- this->HomeRelativeOutputPath = "";
- }
- if(!this->HomeRelativeOutputPath.empty())
- {
- this->HomeRelativeOutputPath += "/";
- }
- this->cmLocalGenerator::Configure();
-}
-
-//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::Generate()
{
- // Store the configuration name that will be generated.
- if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
- {
- // Use the build type given by the user.
- this->ConfigurationName = config;
- }
- else
- {
- // No configuration type given.
- this->ConfigurationName = "";
- }
+ this->SetConfigName();
// Record whether some options are enabled to avoid checking many
// times later.
@@ -169,6 +141,22 @@ void cmLocalUnixMakefileGenerator3::Generate()
this->WriteDirectoryInformationFile();
}
+void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
+{
+ // Compute the path to use when referencing the current output
+ // directory from the top output directory.
+ this->HomeRelativeOutputPath =
+ this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT);
+ if(this->HomeRelativeOutputPath == ".")
+ {
+ this->HomeRelativeOutputPath = "";
+ }
+ if(!this->HomeRelativeOutputPath.empty())
+ {
+ this->HomeRelativeOutputPath += "/";
+ }
+}
+
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
@@ -499,7 +487,7 @@ void cmLocalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
if(t->second->Target
- ->NeedRelinkBeforeInstall(this->ConfigurationName))
+ ->NeedRelinkBeforeInstall(this->ConfigName))
{
makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall";
@@ -1019,7 +1007,7 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
- cmCustomCommandGenerator ccg(*i, this->ConfigurationName,
+ cmCustomCommandGenerator ccg(*i, this->ConfigName,
this->Makefile);
this->AppendCustomDepend(depends, ccg);
}
@@ -1036,7 +1024,7 @@ cmLocalUnixMakefileGenerator3
{
// Lookup the real name of the dependency in case it is a CMake target.
std::string dep;
- if(this->GetRealDependency(*d, this->ConfigurationName,
+ if(this->GetRealDependency(*d, this->ConfigName,
dep))
{
depends.push_back(dep);
@@ -1055,7 +1043,7 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
- cmCustomCommandGenerator ccg(*i, this->ConfigurationName,
+ cmCustomCommandGenerator ccg(*i, this->ConfigName,
this->Makefile);
this->AppendCustomCommand(commands, ccg, target, true, relative);
}
@@ -1259,7 +1247,7 @@ cmLocalUnixMakefileGenerator3
f != files.end(); ++f)
{
std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED);
- fout << " " << cmLocalGenerator::EscapeForCMake(fc) << "\n";
+ fout << " " << cmOutputConverter::EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
@@ -1845,7 +1833,6 @@ void cmLocalUnixMakefileGenerator3
std::vector<std::string> commands;
// Write the all rule.
- std::string dir;
std::string recursiveTarget = this->Makefile->GetCurrentBinaryDirectory();
recursiveTarget += "/all";
@@ -2046,7 +2033,7 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
this->AddCompileDefinitions(defines, &target,
- this->ConfigurationName, l->first);
+ this->ConfigName, l->first);
if(!defines.empty())
{
cmakefileStream
@@ -2057,7 +2044,7 @@ void cmLocalUnixMakefileGenerator3
di != defines.end(); ++di)
{
cmakefileStream
- << " " << cmLocalGenerator::EscapeForCMake(*di) << "\n";
+ << " " << cmOutputConverter::EscapeForCMake(*di) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2111,7 +2098,7 @@ void cmLocalUnixMakefileGenerator3
tri != transformRules.end(); ++tri)
{
cmakefileStream << " "
- << cmLocalGenerator::EscapeForCMake(*tri) << "\n";
+ << cmOutputConverter::EscapeForCMake(*tri) << "\n";
}
cmakefileStream
<< " )\n";
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 988d660..01ac01b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -12,7 +12,7 @@
#ifndef cmLocalUnixMakefileGenerator3_h
#define cmLocalUnixMakefileGenerator3_h
-#include "cmLocalGenerator.h"
+#include "cmLocalCommonGenerator.h"
// for cmDepends::DependencyVector
#include "cmDepends.h"
@@ -31,7 +31,7 @@ class cmSourceFile;
* cmLocalUnixMakefileGenerator3 produces a LocalUnix makefile from its
* member Makefile.
*/
-class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
+class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
{
public:
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
@@ -39,18 +39,13 @@ public:
cmState::Snapshot snapshot);
virtual ~cmLocalUnixMakefileGenerator3();
- /**
- * Process the CMakeLists files for this directory to fill in the
- * Makefile ivar
- */
- virtual void Configure();
+ virtual void ComputeHomeRelativeOutputPath();
/**
* Generate the makefile for this directory.
*/
virtual void Generate();
-
// this returns the relative path between the HomeOutputDirectory and this
// local generators StartOutputDirectory
const std::string &GetHomeRelativeOutputPath();
@@ -153,9 +148,6 @@ public:
void AddImplicitDepends(cmTarget const& tgt, const std::string& lang,
const char* obj, const char* src);
- void AppendGlobalTargetDepends(std::vector<std::string>& depends,
- cmTarget& target);
-
// write the target rules for the local Makefile into the stream
void WriteLocalAllRules(std::ostream& ruleFileStream);
@@ -260,26 +252,8 @@ private:
ImplicitDependTargetMap ImplicitDepends;
- //==========================================================================
- // Configuration settings.
- int MakefileVariableSize;
- std::string ConfigurationName;
- bool MakeCommandEscapeTargetTwice;
- bool BorlandMakeCurlyHack;
- //==========================================================================
-
std::string HomeRelativeOutputPath;
- /* Copy the setting of CMAKE_COLOR_MAKEFILE from the makefile at the
- beginning of generation to avoid many duplicate lookups. */
- bool ColorMakefile;
-
- /* Copy the setting of CMAKE_SKIP_PREPROCESSED_SOURCE_RULES and
- CMAKE_SKIP_ASSEMBLY_SOURCE_RULES at the beginning of generation to
- avoid many duplicate lookups. */
- bool SkipPreprocessedSourceRules;
- bool SkipAssemblySourceRules;
-
struct LocalObjectEntry
{
cmTarget* Target;
@@ -308,6 +282,13 @@ private:
/* does the work for each target */
std::map<std::string, std::string> MakeVariableMap;
std::map<std::string, std::string> ShortMakeVariableMap;
+
+ int MakefileVariableSize;
+ bool MakeCommandEscapeTargetTwice;
+ bool BorlandMakeCurlyHack;
+ bool ColorMakefile;
+ bool SkipPreprocessedSourceRules;
+ bool SkipAssemblySourceRules;
};
#endif
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index ad6a020..9ded83a 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -107,10 +107,9 @@ void cmLocalVisualStudio10Generator
cmVS10XMLParser parser;
parser.ParseFile(path);
- // if we can not find a GUID then create one
+ // if we can not find a GUID then we will generate one later
if(parser.GUID.empty())
{
- this->GlobalGenerator->CreateGUID(name);
return;
}
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index ad34857..a26a1dd 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -235,13 +235,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
comment += makefileIn;
std::string args;
args = "-H";
- args += this->Convert(this->Makefile->GetHomeDirectory(),
- START_OUTPUT, UNCHANGED, true);
+ args += this->Makefile->GetHomeDirectory();
commandLine.push_back(args);
args = "-B";
- args +=
- this->Convert(this->Makefile->GetHomeOutputDirectory(),
- START_OUTPUT, UNCHANGED, true);
+ args += this->Makefile->GetHomeOutputDirectory();
commandLine.push_back(args);
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
@@ -498,7 +495,7 @@ void cmLocalVisualStudio6Generator
// Tell MS-Dev what the source is. If the compiler knows how to
// build it, then it will.
fout << "SOURCE=" <<
- this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n";
+ this->ConvertToOutputFormat(source.c_str(), SHELL) << "\n\n";
if(!depends.empty())
{
// Write out the dependencies for the rule.
@@ -507,7 +504,7 @@ void cmLocalVisualStudio6Generator
d != depends.end(); ++d)
{
fout << "\\\n\t" <<
- this->ConvertToOptionallyRelativeOutputPath(d->c_str());
+ this->ConvertToOutputFormat(d->c_str(), SHELL);
}
fout << "\n";
}
@@ -663,7 +660,7 @@ cmLocalVisualStudio6Generator
if(this->GetRealDependency(d->c_str(), config.c_str(), dep))
{
fout << "\\\n\t" <<
- this->ConvertToOptionallyRelativeOutputPath(dep.c_str());
+ this->ConvertToOutputFormat(dep.c_str(), SHELL);
}
}
fout << "\n";
@@ -689,7 +686,7 @@ cmLocalVisualStudio6Generator
++o)
{
// Write a rule for every output generated by this command.
- fout << this->ConvertToOptionallyRelativeOutputPath(o->c_str())
+ fout << this->ConvertToOutputFormat(o->c_str(), SHELL)
<< " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
fout << script.c_str() << "\n\n";
}
@@ -906,7 +903,7 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target,
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string tmp =
- this->ConvertToOptionallyRelativeOutputPath(i->c_str());
+ this->ConvertToOutputFormat(i->c_str(), SHELL);
if(useShortPath)
{
cmSystemTools::GetShortPath(tmp.c_str(), tmp);
@@ -997,14 +994,14 @@ void cmLocalVisualStudio6Generator
if(libPath.size())
{
std::string lpath =
- this->ConvertToOptionallyRelativeOutputPath(libPath.c_str());
+ this->ConvertToOutputFormat(libPath.c_str(), SHELL);
if(lpath.size() == 0)
{
lpath = ".";
}
std::string lpathIntDir = libPath + "$(INTDIR)";
lpathIntDir =
- this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
+ this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL);
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:";
@@ -1030,14 +1027,14 @@ void cmLocalVisualStudio6Generator
if(exePath.size())
{
std::string lpath =
- this->ConvertToOptionallyRelativeOutputPath(exePath.c_str());
+ this->ConvertToOutputFormat(exePath.c_str(), SHELL);
if(lpath.size() == 0)
{
lpath = ".";
}
std::string lpathIntDir = exePath + "$(INTDIR)";
lpathIntDir =
- this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
+ this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL);
if(pathEmitted.insert(lpath).second)
{
@@ -1071,14 +1068,14 @@ void cmLocalVisualStudio6Generator
path += "/";
}
std::string lpath =
- this->ConvertToOptionallyRelativeOutputPath(path.c_str());
+ this->ConvertToOutputFormat(path.c_str(), SHELL);
if(lpath.size() == 0)
{
lpath = ".";
}
std::string lpathIntDir = path + "$(INTDIR)";
lpathIntDir =
- this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
+ this->ConvertToOutputFormat(lpathIntDir.c_str(), SHELL);
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:";
@@ -1142,9 +1139,9 @@ void cmLocalVisualStudio6Generator
libDebug += ".lib";
}
}
- lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str());
+ lib = this->ConvertToOutputFormat(lib.c_str(), SHELL);
libDebug =
- this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str());
+ this->ConvertToOutputFormat(libDebug.c_str(), SHELL);
if (j->second == cmTarget::GENERAL)
{
@@ -1367,21 +1364,21 @@ void cmLocalVisualStudio6Generator
{
#ifdef CM_USE_OLD_VS6
outputDirOld =
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath
- (target.GetDirectory().c_str()));
+ removeQuotes(this->ConvertToOutputFormat
+ (target.GetDirectory().c_str(), SHELL));
#endif
outputDirDebug =
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath(
- target.GetDirectory("Debug").c_str()));
+ removeQuotes(this->ConvertToOutputFormat(
+ target.GetDirectory("Debug").c_str(), SHELL));
outputDirRelease =
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath(
- target.GetDirectory("Release").c_str()));
+ removeQuotes(this->ConvertToOutputFormat(
+ target.GetDirectory("Release").c_str(), SHELL));
outputDirMinSizeRel =
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath(
- target.GetDirectory("MinSizeRel").c_str()));
+ removeQuotes(this->ConvertToOutputFormat(
+ target.GetDirectory("MinSizeRel").c_str(), SHELL));
outputDirRelWithDebInfo =
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath(
- target.GetDirectory("RelWithDebInfo").c_str()));
+ removeQuotes(this->ConvertToOutputFormat(
+ target.GetDirectory("RelWithDebInfo").c_str(), SHELL));
}
else if(target.GetType() == cmTarget::OBJECT_LIBRARY)
{
@@ -1449,15 +1446,13 @@ void cmLocalVisualStudio6Generator
targetImplibFlagMinSizeRel = "/implib:";
targetImplibFlagRelWithDebInfo = "/implib:";
targetImplibFlagDebug +=
- this->ConvertToOptionallyRelativeOutputPath(fullPathImpDebug.c_str());
+ this->ConvertToOutputFormat(fullPathImpDebug.c_str(), SHELL);
targetImplibFlagRelease +=
- this->ConvertToOptionallyRelativeOutputPath(fullPathImpRelease.c_str());
+ this->ConvertToOutputFormat(fullPathImpRelease.c_str(), SHELL);
targetImplibFlagMinSizeRel +=
- this->ConvertToOptionallyRelativeOutputPath(
- fullPathImpMinSizeRel.c_str());
+ this->ConvertToOutputFormat(fullPathImpMinSizeRel.c_str(), SHELL);
targetImplibFlagRelWithDebInfo +=
- this->ConvertToOptionallyRelativeOutputPath(
- fullPathImpRelWithDebInfo.c_str());
+ this->ConvertToOutputFormat(fullPathImpRelWithDebInfo.c_str(), SHELL);
}
#ifdef CM_USE_OLD_VS6
@@ -1669,12 +1664,12 @@ void cmLocalVisualStudio6Generator
// to convert to output path for unix to win32 conversion
cmSystemTools::ReplaceString
(line, "LIBRARY_OUTPUT_PATH",
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath
- (libPath.c_str())).c_str());
+ removeQuotes(this->ConvertToOutputFormat
+ (libPath.c_str(), SHELL)).c_str());
cmSystemTools::ReplaceString
(line, "EXECUTABLE_OUTPUT_PATH",
- removeQuotes(this->ConvertToOptionallyRelativeOutputPath
- (exePath.c_str())).c_str());
+ removeQuotes(this->ConvertToOutputFormat
+ (exePath.c_str(), SHELL)).c_str());
#endif
if(targetBuilds || target.GetType() == cmTarget::OBJECT_LIBRARY)
@@ -1884,9 +1879,9 @@ void cmLocalVisualStudio6Generator
}
dir += "$(IntDir)";
options += "# ADD LINK32 /LIBPATH:";
- options += this->ConvertToOptionallyRelativeOutputPath(dir.c_str());
+ options += this->ConvertToOutputFormat(dir.c_str(), SHELL);
options += " /LIBPATH:";
- options += this->ConvertToOptionallyRelativeOutputPath(d->c_str());
+ options += this->ConvertToOutputFormat(d->c_str(), SHELL);
options += "\n";
}
}
@@ -1897,7 +1892,7 @@ void cmLocalVisualStudio6Generator
if(l->IsPath)
{
options +=
- this->ConvertToOptionallyRelativeOutputPath(l->Value.c_str());
+ this->ConvertToOutputFormat(l->Value.c_str(), SHELL);
}
else if (!l->Target
|| l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
@@ -1933,7 +1928,7 @@ void cmLocalVisualStudio6Generator
options += "# ADD ";
options += tool;
options += "32 ";
- options += this->ConvertToOptionallyRelativeOutputPath(oi->c_str());
+ options += this->ConvertToOutputFormat(oi->c_str(), SHELL);
options += "\n";
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9c031cf..0e5e7a5 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -23,8 +23,6 @@
#include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h"
-#include <cmsys/System.h>
-
#include <ctype.h> // for isspace
static bool cmLVS6G_IsFAT(const char* dir);
@@ -82,8 +80,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
// Now create GUIDs for targets
cmTargets &tgts = this->Makefile->GetTargets();
- cmGlobalVisualStudio7Generator* gg =
- static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
@@ -96,10 +92,6 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
this->ReadAndStoreExternalGUID(
l->second.GetName().c_str(), path);
}
- else
- {
- gg->CreateGUID(l->first.c_str());
- }
}
@@ -305,13 +297,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
comment += makefileIn;
std::string args;
args = "-H";
- args += this->Convert(this->Makefile->GetHomeDirectory(),
- START_OUTPUT, UNCHANGED, true);
+ args += this->Makefile->GetHomeDirectory();
commandLine.push_back(args);
args = "-B";
- args +=
- this->Convert(this->Makefile->GetHomeOutputDirectory(),
- START_OUTPUT, UNCHANGED, true);
+ args += this->Makefile->GetHomeOutputDirectory();
commandLine.push_back(args);
commandLine.push_back("--check-stamp-file");
std::string stampFilename = this->Convert(stampName.c_str(), FULL,
@@ -1087,9 +1076,17 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
if(!this->ModuleDefinitionFile.empty())
{
std::string defFile =
- this->ConvertToOptionallyRelativeOutputPath(this->ModuleDefinitionFile);
+ this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL);
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
}
+ if (target.GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def");
+ }
+ }
switch(target.GetType())
{
case cmTarget::UNKNOWN_LIBRARY:
@@ -2024,7 +2021,28 @@ void cmLocalVisualStudio7Generator
// Add pre-link event.
tool = this->FortranProject? "VFPreLinkEventTool":"VCPreLinkEventTool";
event.Start(tool);
- event.Write(target.GetPreLinkCommands());
+ bool addedPrelink = false;
+ if (target.GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ addedPrelink = true;
+ std::vector<cmCustomCommand> commands =
+ target.GetPreLinkCommands();
+ cmGlobalVisualStudioGenerator* gg
+ = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(&target);
+ gg->AddSymbolExportCommand(
+ gt, commands, configName);
+ event.Write(commands);
+ }
+ }
+ if (!addedPrelink)
+ {
+ event.Write(target.GetPreLinkCommands());
+ }
cmsys::auto_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, this->FortranProject));
if(pcc.get())
@@ -2234,7 +2252,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s)
std::string cmLocalVisualStudio7Generator
::ConvertToXMLOutputPath(const char* path)
{
- std::string ret = this->ConvertToOptionallyRelativeOutputPath(path);
+ std::string ret = this->ConvertToOutputFormat(path, SHELL);
cmSystemTools::ReplaceString(ret, "&", "&amp;");
cmSystemTools::ReplaceString(ret, "\"", "&quot;");
cmSystemTools::ReplaceString(ret, "<", "&lt;");
@@ -2245,7 +2263,7 @@ std::string cmLocalVisualStudio7Generator
std::string cmLocalVisualStudio7Generator
::ConvertToXMLOutputPathSingle(const char* path)
{
- std::string ret = this->ConvertToOptionallyRelativeOutputPath(path);
+ std::string ret = this->ConvertToOutputFormat(path, SHELL);
cmSystemTools::ReplaceString(ret, "\"", "");
cmSystemTools::ReplaceString(ret, "&", "&amp;");
cmSystemTools::ReplaceString(ret, "<", "&lt;");
@@ -2312,12 +2330,9 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
{
cmVS7XMLParser parser;
parser.ParseFile(path);
- // if we can not find a GUID then create one
+ // if we can not find a GUID then we will generate one later
if(parser.GUID.size() == 0)
{
- cmGlobalVisualStudio7Generator* gg =
- static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
- gg->CreateGUID(name);
return;
}
std::string guidStoreName = name;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 7ac4432..6d3054a 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -96,12 +96,9 @@ bool cmMacroHelperCommand::InvokeInitialPass
return false;
}
- // Enforce matching logical blocks inside the macro.
- cmMakefile::LexicalPushPop lexScope(this->Makefile);
-
- // Push a weak policy scope which restores the policies recorded at
- // macro creation.
- cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies);
+ cmMakefile::MacroPushPop macroScope(this->Makefile,
+ this->FilePath,
+ this->Policies);
// set the value of argc
std::ostringstream argcDefStream;
@@ -126,10 +123,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
sprintf(argvName,"${ARGV%i}",j);
argVs.push_back(argvName);
}
- if(!this->Functions.empty())
- {
- this->FilePath = this->Functions[0].FilePath;
- }
// Invoke all the functions that were collected in the block.
cmListFileFunction newLFF;
// for each function
@@ -139,7 +132,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
newLFF.Arguments.clear();
newLFF.Arguments.reserve(this->Functions[c].Arguments.size());
newLFF.Name = this->Functions[c].Name;
- newLFF.FilePath = this->Functions[c].FilePath;
newLFF.Line = this->Functions[c].Line;
// for each argument of the current function
@@ -147,10 +139,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
this->Functions[c].Arguments.begin();
k != this->Functions[c].Arguments.end(); ++k)
{
- // Set the FilePath on the arguments to match the function since it is
- // not stored and the original values may be freed
- k->FilePath = this->FilePath.c_str();
-
cmListFileArgument arg;
arg.Value = k->Value;
if(k->Delim != cmListFileArgument::Bracket)
@@ -181,7 +169,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
}
}
arg.Delim = k->Delim;
- arg.FilePath = k->FilePath;
arg.Line = k->Line;
newLFF.Arguments.push_back(arg);
}
@@ -191,8 +178,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
{
// The error message should have already included the call stack
// so we do not need to report an error here.
- lexScope.Quiet();
- polScope.Quiet();
+ macroScope.Quiet();
inStatus.SetNestedError(true);
return false;
}
@@ -230,6 +216,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
cmMacroHelperCommand *f = new cmMacroHelperCommand();
f->Args = this->Args;
f->Functions = this->Functions;
+ f->FilePath = this->GetStartingContext().FilePath;
mf.RecordPolicies(f->Policies);
std::string newName = "_" + this->Args[0];
mf.GetState()->RenameCommand(this->Args[0], newName);
@@ -259,7 +246,8 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endmacro"))
{
std::vector<std::string> expandedArguments;
- mf.ExpandArguments(lff.Arguments, expandedArguments);
+ mf.ExpandArguments(lff.Arguments, expandedArguments,
+ this->GetStartingContext().FilePath.c_str());
// if the endmacro has arguments make sure they
// match the arguments of the macro
if ((expandedArguments.empty() ||
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7c74a0f..94c77e1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -105,7 +105,7 @@ public:
++it;
if(it == this->VarStack.rend())
{
- cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent();
+ cmLocalGenerator* plg = mf->LocalGenerator->GetParent();
if(!plg)
{
return false;
@@ -146,7 +146,7 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
- this->GeneratingBuildSystem = false;
+ this->Configured = false;
this->SuppressWatches = false;
// Setup the default include file regular expression (match everything).
@@ -213,8 +213,6 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$");
#endif
- this->Properties.SetCMakeInstance(this->GetCMakeInstance());
-
{
const char* dir = this->GetCMakeInstance()->GetHomeDirectory();
this->AddDefinition("CMAKE_SOURCE_DIR", dir);
@@ -249,11 +247,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const
{
// Collect context information.
- if(!this->CallStack.empty())
+ if(!this->ExecutionStatusStack.empty())
{
if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR))
{
- this->CallStack.back().Status->SetNestedError(true);
+ this->ExecutionStatusStack.back()->SetNestedError(true);
}
this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
}
@@ -266,8 +264,8 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
if(!this->GetCMakeInstance()->GetIsInTryCompile())
{
- lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
- cmLocalGenerator::HOME);
+ cmOutputConverter converter(this->StateSnapshot);
+ lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
}
lfc.Line = 0;
this->GetCMakeInstance()->IssueMessage(t, text, lfc);
@@ -277,26 +275,36 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
//----------------------------------------------------------------------------
cmListFileBacktrace cmMakefile::GetBacktrace() const
{
- cmListFileBacktrace backtrace(this->GetLocalGenerator());
- for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
- i != this->CallStack.rend(); ++i)
+ cmListFileBacktrace backtrace;
+ if (!this->ContextStack.empty())
{
- backtrace.Append(*i->Context);
+ backtrace = cmListFileBacktrace(this->StateSnapshot,
+ *this->ContextStack.back());
}
return backtrace;
}
//----------------------------------------------------------------------------
+cmListFileBacktrace
+cmMakefile::GetBacktrace(cmCommandContext const& cc) const
+{
+ cmState::Snapshot snp = this->StateSnapshot;
+ return cmListFileBacktrace(snp, cc);
+}
+
+//----------------------------------------------------------------------------
cmListFileContext cmMakefile::GetExecutionContext() const
{
- return *this->CallStack.back().Context;
+ return cmListFileContext::FromCommandContext(
+ *this->ContextStack.back(),
+ this->StateSnapshot.GetExecutionListFile());
}
//----------------------------------------------------------------------------
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{
std::ostringstream msg;
- msg << lff.FilePath << "(" << lff.Line << "): ";
+ msg << this->GetExecutionFilePath() << "(" << lff.Line << "): ";
msg << lff.Name << "(";
for(std::vector<cmListFileArgument>::const_iterator i =
lff.Arguments.begin(); i != lff.Arguments.end(); ++i)
@@ -397,12 +405,12 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
class cmMakefile::IncludeScope
{
public:
- IncludeScope(cmMakefile* mf, const char* fname, bool noPolicyScope);
+ IncludeScope(cmMakefile* mf, std::string const& filenametoread,
+ bool noPolicyScope);
~IncludeScope();
void Quiet() { this->ReportError = false; }
private:
cmMakefile* Makefile;
- const char* File;
bool NoPolicyScope;
bool CheckCMP0011;
bool ReportError;
@@ -410,9 +418,10 @@ private:
};
//----------------------------------------------------------------------------
-cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, const char* fname,
+cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
+ std::string const& filenametoread,
bool noPolicyScope):
- Makefile(mf), File(fname), NoPolicyScope(noPolicyScope),
+ Makefile(mf), NoPolicyScope(noPolicyScope),
CheckCMP0011(false), ReportError(true)
{
if(!this->NoPolicyScope)
@@ -446,11 +455,25 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, const char* fname,
// The included file cannot pop our policy scope.
this->Makefile->PushPolicyBarrier();
+ this->Makefile->ListFileStack.push_back(filenametoread);
+ this->Makefile->PushFunctionBlockerBarrier();
+
+ this->Makefile->StateSnapshot =
+ this->Makefile->GetState()->CreateCallStackSnapshot(
+ this->Makefile->StateSnapshot,
+ this->Makefile->ContextStack.back()->Name,
+ this->Makefile->ContextStack.back()->Line,
+ filenametoread);
}
//----------------------------------------------------------------------------
cmMakefile::IncludeScope::~IncludeScope()
{
+ this->Makefile->StateSnapshot =
+ this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot);
+ assert(this->Makefile->StateSnapshot.IsValid());
+
+ this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
// Enforce matching policy scopes inside the included file.
this->Makefile->PopPolicyBarrier(this->ReportError);
@@ -475,6 +498,7 @@ cmMakefile::IncludeScope::~IncludeScope()
this->EnforceCMP0011();
}
}
+ this->Makefile->ListFileStack.pop_back();
}
//----------------------------------------------------------------------------
@@ -489,7 +513,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
{
std::ostringstream w;
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n"
- << "The included script\n " << this->File << "\n"
+ << "The included script\n "
+ << this->Makefile->ListFileStack.back() << "\n"
<< "affects policy settings. "
<< "CMake is implying the NO_POLICY_SCOPE option for compatibility, "
<< "so the effects are applied to the including context.";
@@ -501,7 +526,8 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
{
std::ostringstream e;
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
- << "The included script\n " << this->File << "\n"
+ << "The included script\n "
+ << this->Makefile->ListFileStack.back() << "\n"
<< "affects policy settings, so it requires this policy to be set.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
@@ -515,38 +541,123 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
}
}
-bool cmMakefile::ProcessBuildsystemFile(const char* listfile)
+class cmParseFileScope
{
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile);
- std::string curSrc = this->GetCurrentSourceDirectory();
- return this->ReadListFile(listfile, true,
- curSrc == this->GetHomeDirectory());
-}
+public:
+ cmParseFileScope(cmMakefile* mf)
+ : Makefile(mf)
+ {
+ this->Makefile->ContextStack.push_back(&this->Context);
+ }
-bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
+ ~cmParseFileScope()
+ {
+ this->Makefile->ContextStack.pop_back();
+ }
+
+private:
+ cmMakefile* Makefile;
+ cmCommandContext Context;
+};
+
+bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
{
this->AddDefinition("CMAKE_PARENT_LIST_FILE",
this->GetDefinition("CMAKE_CURRENT_LIST_FILE"));
- bool result = this->ReadListFile(listfile, noPolicyScope, false);
- this->ListFileStack.pop_back();
- return result;
+ std::string filenametoread =
+ cmSystemTools::CollapseFullPath(filename,
+ this->GetCurrentSourceDirectory());
+
+ IncludeScope incScope(this, filenametoread, noPolicyScope);
+
+ cmListFile listFile;
+ {
+ cmParseFileScope pfs(this);
+ if (!listFile.ParseFile(filenametoread.c_str(), false, this))
+ {
+ return false;
+ }
+ }
+
+ this->ReadListFile(listFile, filenametoread);
+ if(cmSystemTools::GetFatalErrorOccured())
+ {
+ incScope.Quiet();
+ }
+ return true;
}
-bool cmMakefile::ReadListFile(const char* listfile)
+class cmMakefile::ListFileScope
{
- bool result = this->ReadListFile(listfile, true, false);
- this->ListFileStack.pop_back();
- return result;
-}
+public:
+ ListFileScope(cmMakefile* mf, std::string const& filenametoread)
+ : Makefile(mf), ReportError(true)
+ {
+ this->Makefile->ListFileStack.push_back(filenametoread);
+ this->Makefile->PushPolicyBarrier();
+
+ long line = 0;
+ std::string name;
+ if (!this->Makefile->ContextStack.empty())
+ {
+ line = this->Makefile->ContextStack.back()->Line;
+ name = this->Makefile->ContextStack.back()->Name;
+ }
+ this->Makefile->StateSnapshot =
+ this->Makefile->GetState()->CreateInlineListFileSnapshot(
+ this->Makefile->StateSnapshot, name, line, filenametoread);
+ assert(this->Makefile->StateSnapshot.IsValid());
+ this->Makefile->PushFunctionBlockerBarrier();
+ }
+
+ ~ListFileScope()
+ {
+ this->Makefile->StateSnapshot =
+ this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot);
+ assert(this->Makefile->StateSnapshot.IsValid());
+
+ this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
+ this->Makefile->PopPolicyBarrier(this->ReportError);
+ this->Makefile->ListFileStack.pop_back();
+ }
+
+ void Quiet() { this->ReportError = false; }
+private:
+ cmMakefile* Makefile;
+ bool ReportError;
+};
-bool cmMakefile::ReadListFile(const char* listfile,
- bool noPolicyScope,
- bool requireProjectCommand)
+bool cmMakefile::ReadListFile(const char* filename)
{
std::string filenametoread =
- cmSystemTools::CollapseFullPath(listfile,
+ cmSystemTools::CollapseFullPath(filename,
this->GetCurrentSourceDirectory());
+ ListFileScope scope(this, filenametoread);
+
+ cmListFile listFile;
+ {
+ cmParseFileScope pfs(this);
+ if (!listFile.ParseFile(filenametoread.c_str(), false, this))
+ {
+ return false;
+ }
+ }
+
+ this->ReadListFile(listFile, filenametoread);
+ if(cmSystemTools::GetFatalErrorOccured())
+ {
+ scope.Quiet();
+ }
+ return true;
+}
+
+void cmMakefile::ReadListFile(cmListFile const& listFile,
+ std::string const& filenametoread)
+{
+ // add this list file to the list of dependencies
+ this->ListFiles.push_back(filenametoread);
+
std::string currentParentFile
= this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
std::string currentFile
@@ -560,55 +671,14 @@ bool cmMakefile::ReadListFile(const char* listfile,
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
- this->ListFileStack.push_back(filenametoread);
-
- bool res = this->ReadListFileInternal(filenametoread.c_str(),
- noPolicyScope, requireProjectCommand);
-
- this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
- this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
- this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
- cmSystemTools::GetFilenamePath(currentFile).c_str());
- this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
- this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
-
- if (res)
- {
- this->CheckForUnusedVariables();
- }
-
- return res;
-}
-
-bool cmMakefile::ReadListFileInternal(const char* filenametoread,
- bool noPolicyScope,
- bool requireProjectCommand)
-{
- cmListFile cacheFile;
- if( !cacheFile.ParseFile(filenametoread, requireProjectCommand, this) )
- {
- return false;
- }
- // add this list file to the list of dependencies
- this->ListFiles.push_back( filenametoread);
-
- // Enforce balanced blocks (if/endif, function/endfunction, etc.).
- {
- LexicalPushPop lexScope(this);
- IncludeScope incScope(this, filenametoread, noPolicyScope);
-
// Run the parsed commands.
- const size_t numberFunctions = cacheFile.Functions.size();
+ const size_t numberFunctions = listFile.Functions.size();
for(size_t i =0; i < numberFunctions; ++i)
{
cmExecutionStatus status;
- this->ExecuteCommand(cacheFile.Functions[i],status);
+ this->ExecuteCommand(listFile.Functions[i],status);
if(cmSystemTools::GetFatalErrorOccured())
{
- // Exit early due to error.
- lexScope.Quiet();
- incScope.Quiet();
break;
}
if(status.GetReturnInvoked())
@@ -617,16 +687,15 @@ bool cmMakefile::ReadListFileInternal(const char* filenametoread,
break;
}
}
- }
-
- // If this is the directory-level CMakeLists.txt file then perform
- // some extra checks.
- if(this->ListFileStack.size() == 1)
- {
- this->EnforceDirectoryLevelRules();
- }
+ this->CheckForUnusedVariables();
- return true;
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
+ this->AddDefinition("CMAKE_CURRENT_LIST_DIR",
+ cmSystemTools::GetFilenamePath(currentFile).c_str());
+ this->MarkVariableAsUsed("CMAKE_PARENT_LIST_FILE");
+ this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE");
+ this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR");
}
//----------------------------------------------------------------------------
@@ -1476,10 +1545,8 @@ void cmMakefile::AddLinkDirectory(const std::string& dir)
}
}
-void cmMakefile::InitializeFromParent()
+void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
- cmMakefile *parent = this->LocalGenerator->GetParent()->GetMakefile();
-
// Initialize definitions with the closure of the parent scope.
this->Internal->InitializeDefinitions(parent);
@@ -1553,10 +1620,176 @@ void cmMakefile::InitializeFromParent()
this->ImportedTargets = parent->ImportedTargets;
}
-void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
+void cmMakefile::PushFunctionScope(std::string const& fileName,
+ const cmPolicies::PolicyMap& pm)
+{
+ this->StateSnapshot =
+ this->GetState()->CreateFunctionCallSnapshot(
+ this->StateSnapshot,
+ this->ContextStack.back()->Name, this->ContextStack.back()->Line,
+ fileName);
+ assert(this->StateSnapshot.IsValid());
+
+ this->Internal->PushDefinitions();
+
+ this->PushLoopBlockBarrier();
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ this->GetGlobalGenerator()->GetFileLockPool().PushFunctionScope();
+#endif
+
+ this->PushFunctionBlockerBarrier();
+
+ this->PushPolicy(true, pm);
+ this->PushPolicyBarrier();
+}
+
+void cmMakefile::PopFunctionScope(bool reportError)
{
- lg2->GetMakefile()->InitializeFromParent();
- std::string currentStart = lg2->GetMakefile()->GetCurrentSourceDirectory();
+ this->PopPolicyBarrier(reportError);
+ this->PopPolicy();
+
+ this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot);
+ assert(this->StateSnapshot.IsValid());
+
+ this->PopFunctionBlockerBarrier(reportError);
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ this->GetGlobalGenerator()->GetFileLockPool().PopFunctionScope();
+#endif
+
+ this->PopLoopBlockBarrier();
+
+ this->CheckForUnusedVariables();
+
+ this->Internal->PopDefinitions();
+}
+
+void cmMakefile::PushMacroScope(std::string const& fileName,
+ const cmPolicies::PolicyMap& pm)
+{
+ this->StateSnapshot =
+ this->GetState()->CreateMacroCallSnapshot(
+ this->StateSnapshot,
+ this->ContextStack.back()->Name, this->ContextStack.back()->Line,
+ fileName);
+ assert(this->StateSnapshot.IsValid());
+
+ this->PushFunctionBlockerBarrier();
+
+ this->PushPolicy(true, pm);
+ this->PushPolicyBarrier();
+}
+
+void cmMakefile::PopMacroScope(bool reportError)
+{
+ this->PopPolicyBarrier(reportError);
+ this->PopPolicy();
+
+ this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot);
+ assert(this->StateSnapshot.IsValid());
+
+ this->PopFunctionBlockerBarrier(reportError);
+}
+
+bool cmMakefile::IsRootMakefile() const
+{
+ return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid();
+}
+
+class cmMakefile::BuildsystemFileScope
+{
+public:
+ BuildsystemFileScope(cmMakefile* mf)
+ : Makefile(mf), ReportError(true)
+ {
+ std::string currentStart =
+ this->Makefile->StateSnapshot.GetCurrentSourceDirectory();
+ currentStart += "/CMakeLists.txt";
+ this->Makefile->StateSnapshot.SetListFile(currentStart);
+ this->Makefile->ListFileStack.push_back(currentStart);
+ this->Makefile->PushPolicyBarrier();
+ this->Makefile->PushFunctionBlockerBarrier();
+
+ this->GG = mf->GetGlobalGenerator();
+ this->CurrentMakefile = this->GG->GetCurrentMakefile();
+ this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
+ this->GG->GetCMakeInstance()->SetCurrentSnapshot(
+ this->GG->GetCMakeInstance()->GetCurrentSnapshot());
+ this->GG->SetCurrentMakefile(mf);
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ this->GG->GetFileLockPool().PushFileScope();
+#endif
+ }
+
+ ~BuildsystemFileScope()
+ {
+ this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
+ this->Makefile->PopPolicyBarrier(this->ReportError);
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ this->GG->GetFileLockPool().PopFileScope();
+#endif
+ this->GG->SetCurrentMakefile(this->CurrentMakefile);
+ this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
+ }
+
+ void Quiet() { this->ReportError = false; }
+private:
+ cmMakefile* Makefile;
+ cmGlobalGenerator* GG;
+ cmMakefile* CurrentMakefile;
+ cmState::Snapshot Snapshot;
+ bool ReportError;
+};
+
+//----------------------------------------------------------------------------
+void cmMakefile::Configure()
+{
+ BuildsystemFileScope scope(this);
+
+ // make sure the CMakeFiles dir is there
+ std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory();
+ filesDir += cmake::GetCMakeFilesDirectory();
+ cmSystemTools::MakeDirectory(filesDir.c_str());
+
+ std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
+ currentStart += "/CMakeLists.txt";
+ assert(cmSystemTools::FileExists(currentStart.c_str(), true));
+ this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
+
+ cmListFile listFile;
+ {
+ cmParseFileScope pfs(this);
+ if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this))
+ {
+ this->SetConfigured();
+ return;
+ }
+ }
+ this->ReadListFile(listFile, currentStart);
+ if(cmSystemTools::GetFatalErrorOccured())
+ {
+ scope.Quiet();
+ }
+
+ // at the end handle any old style subdirs
+ std::vector<cmMakefile*> subdirs = this->UnConfiguredDirectories;
+
+ // for each subdir recurse
+ std::vector<cmMakefile*>::iterator sdi = subdirs.begin();
+ for (; sdi != subdirs.end(); ++sdi)
+ {
+ this->ConfigureSubDirectory(*sdi);
+ }
+
+ this->AddCMakeDependFilesFromUser();
+ this->SetConfigured();
+}
+
+void cmMakefile::ConfigureSubDirectory(cmMakefile *mf)
+{
+ mf->InitializeFromParent(this);
+ std::string currentStart = mf->GetCurrentSourceDirectory();
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Entering ";
@@ -1594,11 +1827,12 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
// NEW behavior prints the error.
this->IssueMessage(cmake::FATAL_ERROR, e.str());
}
- lg2->SetConfiguredCMP0014(true);
+ mf->SetConfigured();
return;
}
// finally configure the subdir
- lg2->Configure();
+ mf->Configure();
+
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Returning to ";
@@ -1619,24 +1853,32 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
}
cmState::Snapshot newSnapshot = this->GetState()
- ->CreateSnapshot(this->StateSnapshot);
+ ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot,
+ this->ContextStack.back()->Name,
+ this->ContextStack.back()->Line);
// create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator()
->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
this->GetGlobalGenerator()->AddLocalGenerator(lg2);
+ cmMakefile* subMf = lg2->GetMakefile();
+
// set the subdirs start dirs
- lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath);
- lg2->GetMakefile()->SetCurrentBinaryDirectory(binPath);
+ subMf->SetCurrentSourceDirectory(srcPath);
+ subMf->SetCurrentBinaryDirectory(binPath);
if(excludeFromAll)
{
- lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
+ subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
if (immediate)
{
- this->ConfigureSubDirectory(lg2);
+ this->ConfigureSubDirectory(subMf);
+ }
+ else
+ {
+ this->UnConfiguredDirectories.push_back(subMf);
}
}
@@ -1831,7 +2073,7 @@ void cmMakefile::LogUnused(const char* reason,
{
std::string path;
cmListFileContext lfc;
- if (!this->CallStack.empty())
+ if (!this->ExecutionStatusStack.empty())
{
lfc = this->GetExecutionContext();
path = lfc.FilePath;
@@ -1843,8 +2085,8 @@ void cmMakefile::LogUnused(const char* reason,
lfc.FilePath = path;
lfc.Line = 0;
}
- lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath,
- cmLocalGenerator::HOME);
+ cmOutputConverter converter(this->StateSnapshot);
+ lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
if (this->CheckSystemVars ||
cmSystemTools::IsSubDirectory(path,
@@ -2116,25 +2358,10 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
return;
}
// build the whole source group path
- const char* fullname = sg->GetFullName();
- cmGlobalGenerator* gg = this->GetGlobalGenerator();
- if(strlen(fullname))
- {
- std::string guidName = "SG_Filter_";
- guidName += fullname;
- gg->CreateGUID(guidName);
- }
for(++i; i<=lastElement; ++i)
{
sg->AddChild(cmSourceGroup(name[i].c_str(), 0, sg->GetFullName()));
sg = sg->LookupChild(name[i].c_str());
- fullname = sg->GetFullName();
- if(strlen(fullname))
- {
- std::string guidName = "SG_Filter_";
- guidName += fullname;
- gg->CreateGUID(guidName);
- }
}
sg->SetGroupRegex(regex);
@@ -2390,18 +2617,11 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
return ret;
}
-std::vector<std::string> cmMakefile
-::GetDefinitions(int cacheonly /* = 0 */) const
+std::vector<std::string> cmMakefile::GetDefinitions() const
{
- std::vector<std::string> res;
- if ( !cacheonly )
- {
- res = this->Internal->ClosureKeys();
- }
- std::vector<std::string> cacheKeys =
- this->GetState()->GetCacheEntryKeys();
+ std::vector<std::string> res = this->Internal->ClosureKeys();
+ std::vector<std::string> cacheKeys = this->GetState()->GetCacheEntryKeys();
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
-
std::sort(res.begin(), res.end());
return res;
}
@@ -2763,8 +2983,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
{
std::ostringstream msg;
cmListFileContext lfc;
- lfc.FilePath = this->LocalGenerator
- ->Convert(filename, cmLocalGenerator::HOME);
+ cmOutputConverter converter(this->StateSnapshot);
+ lfc.FilePath =
+ converter.Convert(filename, cmOutputConverter::HOME);
lfc.Line = line;
msg << "uninitialized variable \'" << lookup << "\'";
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
@@ -3163,7 +3384,6 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
this->FunctionBlockerBarriers.back();
while(this->FunctionBlockers.size() > barrier)
{
- cmMakefile::LoopBlockPop loopBlockPop(this);
cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back());
this->FunctionBlockers.pop_back();
if(reportError)
@@ -3215,11 +3435,26 @@ bool cmMakefile::IsLoopBlock() const
return !this->LoopBlockCounter.empty() && this->LoopBlockCounter.top() > 0;
}
+std::string cmMakefile::GetExecutionFilePath() const
+{
+ if (this->ContextStack.empty())
+ {
+ return std::string();
+ }
+ assert(this->StateSnapshot.IsValid());
+ return this->StateSnapshot.GetExecutionListFile();
+}
+
//----------------------------------------------------------------------------
bool cmMakefile::ExpandArguments(
std::vector<cmListFileArgument> const& inArgs,
- std::vector<std::string>& outArgs) const
+ std::vector<std::string>& outArgs, const char* filename) const
{
+ std::string efp = this->GetExecutionFilePath();
+ if (!filename)
+ {
+ filename = efp.c_str();
+ }
std::vector<cmListFileArgument>::const_iterator i;
std::string value;
outArgs.reserve(inArgs.size());
@@ -3234,8 +3469,7 @@ bool cmMakefile::ExpandArguments(
// Expand the variables in the argument.
value = i->Value;
this->ExpandVariablesInString(value, false, false, false,
- i->FilePath, i->Line,
- false, false);
+ filename, i->Line, false, false);
// If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments.
@@ -3254,8 +3488,13 @@ bool cmMakefile::ExpandArguments(
//----------------------------------------------------------------------------
bool cmMakefile::ExpandArguments(
std::vector<cmListFileArgument> const& inArgs,
- std::vector<cmExpandedCommandArgument>& outArgs) const
+ std::vector<cmExpandedCommandArgument>& outArgs, const char* filename) const
{
+ std::string efp = this->GetExecutionFilePath();
+ if (!filename)
+ {
+ filename = efp.c_str();
+ }
std::vector<cmListFileArgument>::const_iterator i;
std::string value;
outArgs.reserve(inArgs.size());
@@ -3270,8 +3509,7 @@ bool cmMakefile::ExpandArguments(
// Expand the variables in the argument.
value = i->Value;
this->ExpandVariablesInString(value, false, false, false,
- i->FilePath, i->Line,
- false, false);
+ filename, i->Line, false, false);
// If the argument is quoted, it should be one argument.
// Otherwise, it may be a list of arguments.
@@ -3295,7 +3533,7 @@ bool cmMakefile::ExpandArguments(
//----------------------------------------------------------------------------
void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
{
- if(!this->CallStack.empty())
+ if(!this->ExecutionStatusStack.empty())
{
// Record the context in which the blocker is created.
fb->SetStartingContext(this->GetExecutionContext());
@@ -3328,11 +3566,13 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb,
if(!(*pos)->ShouldRemove(lff, *this))
{
cmListFileContext const& lfc = fb->GetStartingContext();
+ cmListFileContext closingContext =
+ cmListFileContext::FromCommandContext(lff, lfc.FilePath);
std::ostringstream e;
e << "A logical block opening on the line\n"
<< " " << lfc << "\n"
<< "closes on the line\n"
- << " " << lff << "\n"
+ << " " << closingContext << "\n"
<< "with mis-matching arguments.";
this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
}
@@ -3345,19 +3585,6 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb,
return cmsys::auto_ptr<cmFunctionBlocker>();
}
-//----------------------------------------------------------------------------
-cmMakefile::LexicalPushPop::LexicalPushPop(cmMakefile* mf):
- Makefile(mf), ReportError(true)
-{
- this->Makefile->PushFunctionBlockerBarrier();
-}
-
-//----------------------------------------------------------------------------
-cmMakefile::LexicalPushPop::~LexicalPushPop()
-{
- this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
-}
-
const char* cmMakefile::GetHomeDirectory() const
{
return this->GetCMakeInstance()->GetHomeDirectory();
@@ -3982,7 +4209,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
}
}
- this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY);
+ this->Properties.SetProperty(prop, value);
}
void cmMakefile::AppendProperty(const std::string& prop,
@@ -4022,23 +4249,26 @@ void cmMakefile::AppendProperty(const std::string& prop,
return;
}
- this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
+ this->Properties.AppendProperty(prop, value, asString);
}
const char *cmMakefile::GetProperty(const std::string& prop) const
{
- return this->GetProperty(prop, cmProperty::DIRECTORY);
+ const bool chain = this->GetState()->
+ IsPropertyChained(prop, cmProperty::DIRECTORY);
+ return this->GetProperty(prop, chain);
}
const char *cmMakefile::GetProperty(const std::string& prop,
- cmProperty::ScopeType scope) const
+ bool chain) const
{
// watch for specific properties
static std::string output;
output = "";
if (prop == "PARENT_DIRECTORY")
{
- cmState::Snapshot parent = this->StateSnapshot.GetParent();
+ cmState::Snapshot parent =
+ this->StateSnapshot.GetBuildsystemDirectoryParent();
if(parent.IsValid())
{
return parent.GetCurrentSourceDirectory();
@@ -4055,36 +4285,20 @@ const char *cmMakefile::GetProperty(const std::string& prop,
output = cmJoin(this->ListFileStack, ";");
return output.c_str();
}
- else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES")
+ else if ( prop == "CACHE_VARIABLES" )
{
- int cacheonly = 0;
- if ( prop == "CACHE_VARIABLES" )
- {
- cacheonly = 1;
- }
- output = cmJoin(this->GetDefinitions(cacheonly), ";");
+ output = cmJoin(this->GetState()->GetCacheEntryKeys(), ";");
return output.c_str();
}
- else if (prop == "MACROS")
+ else if (prop == "VARIABLES")
{
- this->GetListOfMacros(output);
+ output = cmJoin(this->GetDefinitions(), ";");
return output.c_str();
}
- else if (prop == "DEFINITIONS")
+ else if (prop == "MACROS")
{
- switch(this->GetPolicyStatus(cmPolicies::CMP0059))
- {
- case cmPolicies::WARN:
- this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies::
- GetPolicyWarning(cmPolicies::CMP0059));
- case cmPolicies::OLD:
- output += this->DefineFlagsOrig;
- return output.c_str();
- case cmPolicies::NEW:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- break;
- }
+ this->GetListOfMacros(output);
+ return output.c_str();
}
else if (prop == "LINK_DIRECTORIES")
{
@@ -4134,15 +4348,13 @@ const char *cmMakefile::GetProperty(const std::string& prop,
return output.c_str();
}
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, scope, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal && chain)
{
if(this->LocalGenerator->GetParent())
{
return this->LocalGenerator->GetParent()->GetMakefile()->
- GetProperty(prop, scope);
+ GetProperty(prop, chain);
}
return this->GetState()->GetGlobalProperty(prop);
}
@@ -4155,33 +4367,6 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
return cmSystemTools::IsOn(this->GetProperty(prop));
}
-//----------------------------------------------------------------------------
-const char* cmMakefile::GetFeature(const std::string& feature,
- const std::string& config)
-{
- // TODO: Define accumulation policy for features (prepend, append, replace).
- // Currently we always replace.
- if(!config.empty())
- {
- std::string featureConfig = feature;
- featureConfig += "_";
- featureConfig += cmSystemTools::UpperCase(config);
- if(const char* value = this->GetProperty(featureConfig))
- {
- return value;
- }
- }
- if(const char* value = this->GetProperty(feature))
- {
- return value;
- }
- if(cmLocalGenerator* parent = this->LocalGenerator->GetParent())
- {
- return parent->GetMakefile()->GetFeature(feature, config);
- }
- return 0;
-}
-
cmTarget* cmMakefile::FindTarget(const std::string& name,
bool excludeAliases) const
{
@@ -4597,6 +4782,16 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
this->MarkVariableAsUsed(nMatchesVariable);
}
+cmState::Snapshot cmMakefile::GetStateSnapshot() const
+{
+ return this->StateSnapshot;
+}
+
+const char* cmMakefile::GetDefineFlagsCMP0059() const
+{
+ return this->DefineFlagsOrig.c_str();
+}
+
//----------------------------------------------------------------------------
cmPolicies::PolicyStatus
cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const
@@ -5358,3 +5553,44 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const
}
return true;
}
+
+
+cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf,
+ const std::string& fileName,
+ cmPolicies::PolicyMap const& pm)
+ : Makefile(mf), ReportError(true)
+{
+ this->Makefile->PushFunctionScope(fileName, pm);
+}
+
+cmMakefile::FunctionPushPop::~FunctionPushPop()
+{
+ this->Makefile->PopFunctionScope(this->ReportError);
+}
+
+
+cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf,
+ const std::string& fileName,
+ const cmPolicies::PolicyMap& pm)
+ : Makefile(mf), ReportError(true)
+{
+ this->Makefile->PushMacroScope(fileName, pm);
+}
+
+cmMakefile::MacroPushPop::~MacroPushPop()
+{
+ this->Makefile->PopMacroScope(this->ReportError);
+}
+
+cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmCommandContext& lfc,
+ cmExecutionStatus& status): Makefile(mf)
+{
+ this->Makefile->ContextStack.push_back(&lfc);
+ this->Makefile->ExecutionStatusStack.push_back(&status);
+}
+
+cmMakefileCall::~cmMakefileCall()
+{
+ this->Makefile->ExecutionStatusStack.pop_back();
+ this->Makefile->ContextStack.pop_back();
+}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index efd73a1..82a2279 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -14,7 +14,6 @@
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
-#include "cmPolicies.h"
#include "cmPropertyMap.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -80,17 +79,20 @@ public:
*/
~cmMakefile();
- bool ReadListFile(const char* listfile);
+ bool ReadListFile(const char* filename);
- bool ReadDependentFile(const char* listfile, bool noPolicyScope = true);
+ bool ReadDependentFile(const char* filename, bool noPolicyScope = true);
- bool ProcessBuildsystemFile(const char* listfile);
+ bool ProcessBuildsystemFile(const char* filename);
/**
* Add a function blocker to this makefile
*/
void AddFunctionBlocker(cmFunctionBlocker* fb);
+ /// @return whether we are processing the top CMakeLists.txt file.
+ bool IsRootMakefile() const;
+
/**
* Remove the function blocker whose scope ends with the given command.
* This returns ownership of the function blocker object.
@@ -98,28 +100,6 @@ public:
cmsys::auto_ptr<cmFunctionBlocker>
RemoveFunctionBlocker(cmFunctionBlocker* fb, const cmListFileFunction& lff);
- /** Push/pop a lexical (function blocker) barrier automatically. */
- class LexicalPushPop
- {
- public:
- LexicalPushPop(cmMakefile* mf);
- ~LexicalPushPop();
- void Quiet() { this->ReportError = false; }
- private:
- cmMakefile* Makefile;
- bool ReportError;
- };
- friend class LexicalPushPop;
-
- class LoopBlockPop
- {
- public:
- LoopBlockPop(cmMakefile* mf) { this->Makefile = mf; }
- ~LoopBlockPop() { this->Makefile->PopLoopBlock(); }
- private:
- cmMakefile* Makefile;
- };
-
/**
* Try running cmake and building a file. This is used for dynalically
* loaded commands, not as part of the usual build process.
@@ -270,10 +250,12 @@ public:
bool excludeFromAll,
bool immediate);
+ void Configure();
+
/**
* Configure a subdirectory
*/
- void ConfigureSubDirectory(cmLocalGenerator *);
+ void ConfigureSubDirectory(cmMakefile* mf);
/**
* Add an include directory to the build.
@@ -372,13 +354,6 @@ public:
friend class PolicyPushPop;
/**
- * Get the Policies Instance
- */
- cmPolicies *GetPolicies() const;
-
- mutable std::set<cmListFileContext> CMP0054ReportedIds;
-
- /**
* Determine if the given context, name pair has already been reported
* in context of CMP0054.
*/
@@ -515,7 +490,7 @@ public:
* cacheonly is specified and is greater than 0, then only cache
* variables will be listed.
*/
- std::vector<std::string> GetDefinitions(int cacheonly=0) const;
+ std::vector<std::string> GetDefinitions() const;
/**
* Test a boolean variable to see if it is true or false.
@@ -572,6 +547,7 @@ public:
* Get the current context backtrace.
*/
cmListFileBacktrace GetBacktrace() const;
+ cmListFileBacktrace GetBacktrace(cmCommandContext const& lfc) const;
cmListFileContext GetExecutionContext() const;
/**
@@ -667,10 +643,12 @@ public:
* variable replacement and list expansion.
*/
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
- std::vector<std::string>& outArgs) const;
+ std::vector<std::string>& outArgs,
+ const char* filename = 0) const;
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
- std::vector<cmExpandedCommandArgument>& outArgs) const;
+ std::vector<cmExpandedCommandArgument>& outArgs,
+ const char* filename = 0) const;
/**
* Get the instance
@@ -720,18 +698,14 @@ public:
void AppendProperty(const std::string& prop, const char *value,
bool asString=false);
const char *GetProperty(const std::string& prop) const;
- const char *GetProperty(const std::string& prop,
- cmProperty::ScopeType scope) const;
+ const char *GetProperty(const std::string& prop, bool chain) const;
bool GetPropertyAsBool(const std::string& prop) const;
- const char* GetFeature(const std::string& feature,
- const std::string& config);
-
// Get the properties
cmPropertyMap &GetProperties() { return this->Properties; }
///! Initialize a makefile from its parent
- void InitializeFromParent();
+ void InitializeFromParent(cmMakefile* parent);
void AddInstallGenerator(cmInstallGenerator* g)
{ if(g) this->InstallGenerators.push_back(g); }
@@ -743,7 +717,38 @@ public:
const std::vector<cmTestGenerator*>& GetTestGenerators() const
{ return this->TestGenerators; }
- // push and pop variable scopes
+ class FunctionPushPop
+ {
+ public:
+ FunctionPushPop(cmMakefile* mf, std::string const& fileName,
+ cmPolicies::PolicyMap const& pm);
+ ~FunctionPushPop();
+
+ void Quiet() { this->ReportError = false; }
+ private:
+ cmMakefile* Makefile;
+ bool ReportError;
+ };
+
+ class MacroPushPop
+ {
+ public:
+ MacroPushPop(cmMakefile* mf, std::string const& fileName,
+ cmPolicies::PolicyMap const& pm);
+ ~MacroPushPop();
+
+ void Quiet() { this->ReportError = false; }
+ private:
+ cmMakefile* Makefile;
+ bool ReportError;
+ };
+
+ void PushFunctionScope(std::string const& fileName,
+ cmPolicies::PolicyMap const& pm);
+ void PopFunctionScope(bool reportError);
+ void PushMacroScope(std::string const& fileName,
+ cmPolicies::PolicyMap const& pm);
+ void PopMacroScope(bool reportError);
void PushScope();
void PopScope();
void RaiseScope(const std::string& var, const char *value);
@@ -781,8 +786,8 @@ public:
return this->CompileDefinitionsEntries;
}
- bool IsGeneratingBuildSystem() const { return this->GeneratingBuildSystem; }
- void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; }
+ bool IsConfigured() const { return this->Configured; }
+ void SetConfigured(){ this->Configured = true; }
void AddQtUiFileWithOptions(cmSourceFile *sf);
std::vector<cmSourceFile*> GetQtUiFilesWithOptions() const;
@@ -816,6 +821,14 @@ public:
void ClearMatches();
void StoreMatches(cmsys::RegularExpression& re);
+ cmState::Snapshot GetStateSnapshot() const;
+
+ const char* GetDefineFlagsCMP0059() const;
+
+ std::string GetExecutionFilePath() const;
+
+ void EnforceDirectoryLevelRules() const;
+
protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
@@ -823,6 +836,8 @@ protected:
// Check for a an unused variable
void LogUnused(const char* reason, const std::string& name) const;
+ mutable std::set<cmListFileContext> CMP0054ReportedIds;
+
std::string ProjectName; // project name
// libraries, classes, and executables
@@ -888,13 +903,8 @@ private:
cmState::Snapshot StateSnapshot;
- bool ReadListFile(const char* listfile,
- bool noPolicyScope,
- bool requireProjectCommand);
-
- bool ReadListFileInternal(const char* filenametoread,
- bool noPolicyScope,
- bool requireProjectCommand);
+ void ReadListFile(cmListFile const& listFile,
+ const std::string& filenametoread);
bool ParseDefineFlag(std::string const& definition, bool remove);
@@ -920,24 +930,17 @@ private:
mutable cmsys::RegularExpression cmAtVarRegex;
mutable cmsys::RegularExpression cmNamedCurly;
- cmPropertyMap Properties;
+ std::vector<cmMakefile*> UnConfiguredDirectories;
- // Unused variable flags
- bool WarnUnused;
- bool CheckSystemVars;
+ cmPropertyMap Properties;
// stack of list files being read
std::vector<std::string> ListFileStack;
- // stack of commands being invoked.
- struct CallStackEntry
- {
- cmListFileContext const* Context;
- cmExecutionStatus* Status;
- };
- typedef std::vector<CallStackEntry> CallStackType;
- CallStackType CallStack;
+ std::vector<cmCommandContext const*> ContextStack;
+ std::vector<cmExecutionStatus*> ExecutionStatusStack;
friend class cmMakefileCall;
+ friend class cmParseFileScope;
std::vector<cmTarget*> ImportedTargetsOwned;
TargetMap ImportedTargets;
@@ -951,6 +954,10 @@ private:
friend class cmCMakePolicyCommand;
class IncludeScope;
friend class IncludeScope;
+ class ListFileScope;
+ friend class ListFileScope;
+ class BuildsystemFileScope;
+ friend class BuildsystemFileScope;
// stack of policy settings
struct PolicyStackEntry: public cmPolicies::PolicyMap
@@ -967,11 +974,6 @@ private:
cmPolicies::PolicyStatus
GetPolicyStatusInternal(cmPolicies::PolicyID id) const;
- bool CheckCMP0000;
-
- // Enforce rules about CMakeLists.txt files.
- void EnforceDirectoryLevelRules() const;
-
// CMP0053 == old
cmake::MessageType ExpandVariablesInStringOld(
std::string& errorstr,
@@ -994,7 +996,6 @@ private:
long line,
bool removeEmpty,
bool replaceAt) const;
- bool GeneratingBuildSystem;
/**
* Old version of GetSourceFileWithOutput(const std::string&) kept for
* backward-compatibility. It implements a linear search and support
@@ -1040,6 +1041,11 @@ private:
void CheckForUnusedVariables() const;
+ // Unused variable flags
+ bool WarnUnused;
+ bool CheckSystemVars;
+ bool CheckCMP0000;
+ bool Configured;
mutable bool SuppressWatches;
};
@@ -1049,16 +1055,9 @@ class cmMakefileCall
{
public:
cmMakefileCall(cmMakefile* mf,
- cmListFileContext const& lfc,
- cmExecutionStatus& status): Makefile(mf)
- {
- cmMakefile::CallStackEntry entry = {&lfc, &status};
- this->Makefile->CallStack.push_back(entry);
- }
- ~cmMakefileCall()
- {
- this->Makefile->CallStack.pop_back();
- }
+ cmCommandContext const& lfc,
+ cmExecutionStatus& status);
+ ~cmMakefileCall();
private:
cmMakefile* Makefile;
};
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 37b297e..416063f 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -22,7 +22,7 @@
//----------------------------------------------------------------------------
cmMakefileExecutableTargetGenerator
::cmMakefileExecutableTargetGenerator(cmGeneratorTarget* target):
- cmMakefileTargetGenerator(target->Target)
+ cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnDepends;
this->Target->GetExecutableNames(
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 450f573..696dcc4 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -18,11 +18,12 @@
#include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmake.h"
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------------
cmMakefileLibraryTargetGenerator
::cmMakefileLibraryTargetGenerator(cmGeneratorTarget* target):
- cmMakefileTargetGenerator(target->Target)
+ cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnDepends;
if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
@@ -563,6 +564,58 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
useResponseFileForObjects, buildObjs, depends,
useWatcomQuote);
+ // maybe create .def file from list of objects
+ if (this->Target->GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if(this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ std::string name_of_def_file =
+ this->Target->GetSupportDirectory();
+ name_of_def_file += std::string("/") +
+ this->Target->GetName();
+ name_of_def_file += ".def";
+ std::string cmd = cmSystemTools::GetCMakeCommand();
+ cmd = this->Convert(cmd, cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL);
+ cmd += " -E __create_def ";
+ cmd += this->Convert(name_of_def_file,
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ cmd += " ";
+ std::string objlist_file = name_of_def_file;
+ objlist_file += ".objs";
+ cmd += this->Convert(objlist_file,
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ real_link_commands.push_back(cmd);
+ // create a list of obj files for the -E __create_def to read
+ cmGeneratedFileStream fout(objlist_file.c_str());
+ for(std::vector<std::string>::const_iterator i = this->Objects.begin();
+ i != this->Objects.end(); ++i)
+ {
+ if(cmHasLiteralSuffix(*i, ".obj"))
+ {
+ fout << *i << "\n";
+ }
+ }
+ for(std::vector<std::string>::const_iterator i =
+ this->ExternalObjects.begin();
+ i != this->ExternalObjects.end(); ++i)
+ {
+ fout << *i << "\n";
+ }
+ // now add the def file link flag
+ linkFlags += " ";
+ linkFlags +=
+ this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
+ linkFlags += this->Convert(name_of_def_file,
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::SHELL);
+ linkFlags += " ";
+ }
+ }
+
cmLocalGenerator::RuleVariables vars;
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7b88bc7..ef4bbbe 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -32,25 +32,20 @@
#include <ctype.h>
-cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target)
- : OSXBundleGenerator(0)
+cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
+ : cmCommonTargetGenerator(target)
+ , OSXBundleGenerator(0)
, MacOSXContentGenerator(0)
{
this->BuildFileStream = 0;
this->InfoFileStream = 0;
this->FlagFileStream = 0;
this->CustomCommandDriver = OnBuild;
- this->FortranModuleDirectoryComputed = false;
- this->Target = target;
- this->Makefile = this->Target->GetMakefile();
this->LocalGenerator =
- static_cast<cmLocalUnixMakefileGenerator3*>(
- this->Makefile->GetLocalGenerator());
- this->ConfigName = this->LocalGenerator->ConfigurationName.c_str();
+ static_cast<cmLocalUnixMakefileGenerator3*>(target->GetLocalGenerator());
this->GlobalGenerator =
static_cast<cmGlobalUnixMakefileGenerator3*>(
this->LocalGenerator->GetGlobalGenerator());
- this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target);
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
this->NoRuleMessages = false;
if(const char* ruleStatus = cm->GetState()
@@ -277,80 +272,6 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< "\n\n";
}
-//----------------------------------------------------------------------------
-std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
-{
- ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
- if (i == this->FlagsByLanguage.end())
- {
- std::string flags;
- const char *lang = l.c_str();
-
- // Add language feature flags.
- this->AddFeatureFlags(flags, lang);
-
- this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
- lang, this->ConfigName);
-
- // Fortran-specific flags computed for this target.
- if(l == "Fortran")
- {
- this->AddFortranFlags(flags);
- }
-
- this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
- lang, this->ConfigName);
-
- this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target,
- lang);
-
- // Add include directory flags.
- this->AddIncludeFlags(flags, lang);
-
- // Append old-style preprocessor definition flags.
- this->LocalGenerator->
- AppendFlags(flags, this->Makefile->GetDefineFlags());
-
- // Add include directory flags.
- this->LocalGenerator->
- AppendFlags(flags,this->GetFrameworkFlags(l));
-
- // Add target-specific flags.
- this->LocalGenerator->AddCompileOptions(flags, this->Target,
- lang, this->ConfigName);
-
- ByLanguageMap::value_type entry(l, flags);
- i = this->FlagsByLanguage.insert(entry).first;
- }
- return i->second;
-}
-
-std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
-{
- ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
- if (i == this->DefinesByLanguage.end())
- {
- std::set<std::string> defines;
- const char *lang = l.c_str();
- // Add the export symbol definition for shared library objects.
- if(const char* exportMacro = this->Target->GetExportMacro())
- {
- this->LocalGenerator->AppendDefines(defines, exportMacro);
- }
-
- // Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
- this->LocalGenerator->ConfigurationName, l);
-
- std::string definesString;
- this->LocalGenerator->JoinDefines(defines, definesString, lang);
-
- ByLanguageMap::value_type entry(l, definesString);
- i = this->DefinesByLanguage.insert(entry).first;
- }
- return i->second;
-}
-
void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
{
// write language flags for target
@@ -512,35 +433,6 @@ void cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void
cmMakefileTargetGenerator
-::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source)
-{
- const char* srcfmt = source.GetProperty("Fortran_FORMAT");
- cmLocalGenerator::FortranFormat format =
- this->LocalGenerator->GetFortranFormat(srcfmt);
- if(format == cmLocalGenerator::FortranFormatNone)
- {
- const char* tgtfmt = this->Target->GetProperty("Fortran_FORMAT");
- format = this->LocalGenerator->GetFortranFormat(tgtfmt);
- }
- const char* var = 0;
- switch (format)
- {
- case cmLocalGenerator::FortranFormatFixed:
- var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; break;
- case cmLocalGenerator::FortranFormatFree:
- var = "CMAKE_Fortran_FORMAT_FREE_FLAG"; break;
- default: break;
- }
- if(var)
- {
- this->LocalGenerator->AppendFlags(
- flags, this->Makefile->GetDefinition(var));
- }
-}
-
-//----------------------------------------------------------------------------
-void
-cmMakefileTargetGenerator
::WriteObjectBuildFile(std::string &obj,
const std::string& lang,
cmSourceFile const& source,
@@ -568,7 +460,7 @@ cmMakefileTargetGenerator
this->LocalGenerator->AppendFlags(flags, langFlags);
std::string configUpper =
- cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName);
+ cmSystemTools::UpperCase(this->LocalGenerator->GetConfigName());
// Add Fortran format flags.
if(lang == "Fortran")
@@ -614,13 +506,7 @@ cmMakefileTargetGenerator
}
// Get the output paths for source and object files.
- std::string sourceFile = source.GetFullPath();
- if(this->LocalGenerator->UseRelativePaths)
- {
- sourceFile = this->Convert(sourceFile,
- cmLocalGenerator::START_OUTPUT);
- }
- sourceFile = this->Convert(sourceFile,
+ std::string sourceFile = this->Convert(source.GetFullPath(),
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
@@ -775,6 +661,25 @@ cmMakefileTargetGenerator
}
}
+ // Maybe insert a compiler launcher like ccache or distcc
+ if (!compileCommands.empty() && (lang == "C" || lang == "CXX"))
+ {
+ std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
+ const char *clauncher = this->Target->GetProperty(clauncher_prop);
+ if (clauncher && *clauncher)
+ {
+ std::vector<std::string> launcher_cmd;
+ cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true);
+ for (std::vector<std::string>::iterator i = launcher_cmd.begin(),
+ e = launcher_cmd.end(); i != e; ++i)
+ {
+ *i = this->LocalGenerator->EscapeForShell(*i);
+ }
+ std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " ";
+ compileCommands.front().insert(0, run_launcher);
+ }
+ }
+
// Expand placeholders in the commands.
for(std::vector<std::string>::iterator i = compileCommands.begin();
i != compileCommands.end(); ++i)
@@ -1132,8 +1037,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
pi != this->MultipleOutputPairs.end(); ++pi)
{
*this->InfoFileStream
- << " " << cmLocalGenerator::EscapeForCMake(pi->first)
- << " " << cmLocalGenerator::EscapeForCMake(pi->second)
+ << " " << cmOutputConverter::EscapeForCMake(pi->first)
+ << " " << cmOutputConverter::EscapeForCMake(pi->second)
<< "\n";
}
*this->InfoFileStream << " )\n\n";
@@ -1146,7 +1051,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "# Targets to which this target links.\n"
<< "set(CMAKE_TARGET_LINKED_INFO_FILES\n";
std::set<cmTarget const*> emitted;
- const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
+ const char* cfg = this->LocalGenerator->GetConfigName().c_str();
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
{
cmComputeLinkInformation::ItemVector const& items = cli->GetItems();
@@ -1161,8 +1066,10 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
&& linkee->GetType() != cmTarget::INTERFACE_LIBRARY
&& emitted.insert(linkee).second)
{
+ cmGeneratorTarget* gt =
+ this->GlobalGenerator->GetGeneratorTarget(linkee);
+ cmLocalGenerator* lg = gt->GetLocalGenerator();
cmMakefile* mf = linkee->GetMakefile();
- cmLocalGenerator* lg = mf->GetLocalGenerator();
std::string di = mf->GetCurrentBinaryDirectory();
di += "/";
di += lg->GetTargetDirectory(*linkee);
@@ -1544,68 +1451,6 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
}
//----------------------------------------------------------------------------
-std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
-{
- if(!this->Makefile->IsOn("APPLE"))
- {
- return std::string();
- }
-
- std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG";
- const char* fwSearchFlag =
- this->Makefile->GetDefinition(fwSearchFlagVar);
- if(!(fwSearchFlag && *fwSearchFlag))
- {
- return std::string();
- }
-
- std::set<std::string> emitted;
-#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
- emitted.insert("/System/Library/Frameworks");
-#endif
- std::vector<std::string> includes;
-
- const std::string& config =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- this->LocalGenerator->GetIncludeDirectories(includes,
- this->GeneratorTarget,
- "C", config);
- // check all include directories for frameworks as this
- // will already have added a -F for the framework
- for(std::vector<std::string>::iterator i = includes.begin();
- i != includes.end(); ++i)
- {
- if(this->Target->NameResolvesToFramework(*i))
- {
- std::string frameworkDir = *i;
- frameworkDir += "/../";
- frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
- emitted.insert(frameworkDir);
- }
- }
-
- std::string flags;
- const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
- if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
- {
- std::vector<std::string> const& frameworks = cli->GetFrameworkPaths();
- for(std::vector<std::string>::const_iterator i = frameworks.begin();
- i != frameworks.end(); ++i)
- {
- if(emitted.insert(*i).second)
- {
- flags += fwSearchFlag;
- flags += this->Convert(*i,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL, true);
- flags += " ";
- }
- }
- }
- return flags;
-}
-
-//----------------------------------------------------------------------------
void cmMakefileTargetGenerator
::AppendTargetDepends(std::vector<std::string>& depends)
{
@@ -1616,7 +1461,7 @@ void cmMakefileTargetGenerator
}
// Loop over all library dependencies.
- const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
+ const char* cfg = this->LocalGenerator->GetConfigName().c_str();
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
{
std::vector<std::string> const& libDeps = cli->GetDepends();
@@ -1658,11 +1503,9 @@ void cmMakefileTargetGenerator
this->AppendTargetDepends(depends);
// Add a dependency on the link definitions file, if any.
- std::string def = this->GeneratorTarget->GetModuleDefinitionFile(
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
- if(!def.empty())
+ if(!this->ModuleDefinitionFile.empty())
{
- depends.push_back(def);
+ depends.push_back(this->ModuleDefinitionFile);
}
// Add user-specified dependencies.
@@ -1969,149 +1812,3 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
this->LocalGenerator->AppendFlags(flags, includeFlags);
}
}
-
-//----------------------------------------------------------------------------
-const char* cmMakefileTargetGenerator::GetFortranModuleDirectory()
-{
- // Compute the module directory.
- if(!this->FortranModuleDirectoryComputed)
- {
- const char* target_mod_dir =
- this->Target->GetProperty("Fortran_MODULE_DIRECTORY");
- const char* moddir_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
- if(target_mod_dir && moddir_flag)
- {
- // Compute the full path to the module directory.
- if(cmSystemTools::FileIsFullPath(target_mod_dir))
- {
- // Already a full path.
- this->FortranModuleDirectory = target_mod_dir;
- }
- else
- {
- // Interpret relative to the current output directory.
- this->FortranModuleDirectory =
- this->Makefile->GetCurrentBinaryDirectory();
- this->FortranModuleDirectory += "/";
- this->FortranModuleDirectory += target_mod_dir;
- }
-
- // Make sure the module output directory exists.
- cmSystemTools::MakeDirectory(this->FortranModuleDirectory.c_str());
- }
- this->FortranModuleDirectoryComputed = true;
- }
-
- // Return the computed directory.
- if(this->FortranModuleDirectory.empty())
- {
- return 0;
- }
- else
- {
- return this->FortranModuleDirectory.c_str();
- }
-}
-
-//----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
-{
- // Enable module output if necessary.
- if(const char* modout_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG"))
- {
- this->LocalGenerator->AppendFlags(flags, modout_flag);
- }
-
- // Add a module output directory flag if necessary.
- const char* mod_dir = this->GetFortranModuleDirectory();
- if(!mod_dir)
- {
- mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
- }
- if(mod_dir)
- {
- const char* moddir_flag =
- this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
- std::string modflag = moddir_flag;
- modflag += this->Convert(mod_dir,
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::SHELL);
- this->LocalGenerator->AppendFlags(flags, modflag);
- }
-
- // If there is a separate module path flag then duplicate the
- // include path with it. This compiler does not search the include
- // path for modules.
- if(const char* modpath_flag =
- this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
- {
- std::vector<std::string> includes;
- const std::string& config =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- this->LocalGenerator->GetIncludeDirectories(includes,
- this->GeneratorTarget,
- "C", config);
- for(std::vector<std::string>::const_iterator idi = includes.begin();
- idi != includes.end(); ++idi)
- {
- std::string flg = modpath_flag;
- flg += this->Convert(*idi,
- cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL);
- this->LocalGenerator->AppendFlags(flags, flg);
- }
- }
-}
-
-//----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
-{
- std::string def = this->GeneratorTarget->GetModuleDefinitionFile(
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
- if(def.empty())
- {
- return;
- }
-
- // TODO: Create a per-language flag variable.
- const char* defFileFlag =
- this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- if(!defFileFlag)
- {
- return;
- }
-
- // Append the flag and value. Use ConvertToLinkReference to help
- // vs6's "cl -link" pass it to the linker.
- std::string flag = defFileFlag;
- flag += (this->LocalGenerator->ConvertToLinkReference(def));
- this->LocalGenerator->AppendFlags(flags, flag);
-}
-
-//----------------------------------------------------------------------------
-const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature)
-{
- return this->Target->GetFeature(feature, this->ConfigName);
-}
-
-//----------------------------------------------------------------------------
-bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature)
-{
- return this->Target->GetFeatureAsBool(feature, this->ConfigName);
-}
-
-//----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::AddFeatureFlags(
- std::string& flags, const std::string& lang
- )
-{
- // Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
-
- if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION"))
- {
- this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
- }
-}
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 58044e8..b885672 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -12,6 +12,8 @@
#ifndef cmMakefileTargetGenerator_h
#define cmMakefileTargetGenerator_h
+#include "cmCommonTargetGenerator.h"
+
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmOSXBundleGenerator.h"
@@ -30,11 +32,11 @@ class cmSourceFile;
* \brief Support Routines for writing makefiles
*
*/
-class cmMakefileTargetGenerator
+class cmMakefileTargetGenerator: public cmCommonTargetGenerator
{
public:
// constructor to set the ivars
- cmMakefileTargetGenerator(cmTarget* target);
+ cmMakefileTargetGenerator(cmGeneratorTarget* target);
virtual ~cmMakefileTargetGenerator();
// construct using this factory call
@@ -124,12 +126,6 @@ protected:
void DriveCustomCommands(std::vector<std::string>& depends);
- // Return the a string with -F flags on apple
- std::string GetFrameworkFlags(std::string const& l);
-
- void AppendFortranFormatFlags(std::string& flags,
- cmSourceFile const& source);
-
// append intertarget dependencies
void AppendTargetDepends(std::vector<std::string>& depends);
@@ -173,12 +169,8 @@ protected:
virtual void CloseFileStreams();
void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang,
std::string& linkFlags);
- cmTarget *Target;
- cmGeneratorTarget* GeneratorTarget;
cmLocalUnixMakefileGenerator3 *LocalGenerator;
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
- cmMakefile *Makefile;
- std::string ConfigName;
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
CustomCommandDriveType CustomCommandDriver;
@@ -242,43 +234,6 @@ protected:
std::set<std::string> MacContentFolders;
cmOSXBundleGenerator* OSXBundleGenerator;
MacOSXContentGeneratorType* MacOSXContentGenerator;
-
- typedef std::map<std::string, std::string> ByLanguageMap;
- std::string GetFlags(const std::string &l);
- ByLanguageMap FlagsByLanguage;
- std::string GetDefines(const std::string &l);
- ByLanguageMap DefinesByLanguage;
-
- // Target-wide Fortran module output directory.
- bool FortranModuleDirectoryComputed;
- std::string FortranModuleDirectory;
- const char* GetFortranModuleDirectory();
-
- // Compute target-specific Fortran language flags.
- void AddFortranFlags(std::string& flags);
-
- // Helper to add flag for windows .def file.
- void AddModuleDefinitionFlag(std::string& flags);
-
- // Add language feature flags.
- void AddFeatureFlags(std::string& flags, const std::string& lang);
-
- // Feature query methods.
- const char* GetFeature(const std::string& feature);
- bool GetFeatureAsBool(const std::string& feature);
-
- //==================================================================
- // Convenience routines that do nothing more than forward to
- // implementaitons
- std::string Convert(const std::string& source,
- cmLocalGenerator::RelativeRoot relative,
- cmLocalGenerator::OutputFormat output =
- cmLocalGenerator::UNCHANGED,
- bool optional = false)
- {
- return this->LocalGenerator->Convert(source, relative, output, optional);
- }
-
};
#endif
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx
index 25d929c..303ca63 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -21,7 +21,7 @@
//----------------------------------------------------------------------------
cmMakefileUtilityTargetGenerator
::cmMakefileUtilityTargetGenerator(cmGeneratorTarget* target):
- cmMakefileTargetGenerator(target->Target)
+ cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnUtility;
this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index bbf03ff..88da09b 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -32,7 +32,7 @@
cmNinjaNormalTargetGenerator::
cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
- : cmNinjaTargetGenerator(target->Target)
+ : cmNinjaTargetGenerator(target)
, TargetNameOut()
, TargetNameSO()
, TargetNameReal()
@@ -486,6 +486,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
linkPath,
&genTarget,
useWatcomQuote);
+ if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")
+ && target.GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ std::string dllname = targetOutput;
+ std::string name_of_def_file
+ = target.GetSupportDirectory();
+ name_of_def_file += "/" + target.GetName();
+ name_of_def_file += ".def ";
+ vars["LINK_FLAGS"] += " /DEF:";
+ vars["LINK_FLAGS"] += this->GetLocalGenerator()
+ ->ConvertToOutputFormat(name_of_def_file.c_str(),
+ cmLocalGenerator::SHELL);
+ }
+ }
this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars);
@@ -600,6 +616,44 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
}
+ // maybe create .def file from list of objects
+ if (target.GetType() == cmTarget::SHARED_LIBRARY &&
+ this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ std::string cmakeCommand =
+ this->GetLocalGenerator()->ConvertToOutputFormat(
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
+ std::string dllname = targetOutput;
+ std::string name_of_def_file
+ = target.GetSupportDirectory();
+ name_of_def_file += "/" + target.GetName();
+ name_of_def_file += ".def";
+ std::string cmd = cmakeCommand;
+ cmd += " -E __create_def ";
+ cmd += this->GetLocalGenerator()
+ ->ConvertToOutputFormat(name_of_def_file.c_str(),
+ cmLocalGenerator::SHELL);
+ cmd += " ";
+ cmNinjaDeps objs = this->GetObjects();
+ std::string obj_list_file = name_of_def_file;
+ obj_list_file += ".objs";
+ cmd += this->GetLocalGenerator()
+ ->ConvertToOutputFormat(obj_list_file.c_str(),
+ cmLocalGenerator::SHELL);
+ preLinkCmdLines.push_back(cmd);
+ // create a list of obj files for the -E __create_def to read
+ cmGeneratedFileStream fout(obj_list_file.c_str());
+ for(cmNinjaDeps::iterator i=objs.begin(); i != objs.end(); ++i)
+ {
+ if(cmHasLiteralSuffix(*i, ".obj"))
+ {
+ fout << *i << "\n";
+ }
+ }
+ }
+ }
// If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
// the link commands.
if (!preLinkCmdLines.empty())
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 879d6b7..a72bc72 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -22,6 +22,7 @@
#include "cmComputeLinkInformation.h"
#include "cmSourceFile.h"
#include "cmCustomCommandGenerator.h"
+#include "cmAlgorithms.h"
#include <algorithm>
@@ -56,19 +57,15 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
}
}
-cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmTarget* target)
- :
+cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
+ : cmCommonTargetGenerator(target),
MacOSXContentGenerator(0),
OSXBundleGenerator(0),
MacContentFolders(),
- Target(target),
- Makefile(target->GetMakefile()),
LocalGenerator(
- static_cast<cmLocalNinjaGenerator*>(Makefile->GetLocalGenerator())),
+ static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator())),
Objects()
{
- this->GeneratorTarget =
- this->GetGlobalGenerator()->GetGeneratorTarget(target);
MacOSXContentGenerator = new MacOSXContentGeneratorType(this);
}
@@ -92,11 +89,6 @@ cmGlobalNinjaGenerator* cmNinjaTargetGenerator::GetGlobalGenerator() const
return this->LocalGenerator->GetGlobalNinjaGenerator();
}
-std::string const& cmNinjaTargetGenerator::GetConfigName() const
-{
- return this->LocalGenerator->GetConfigName();
-}
-
std::string cmNinjaTargetGenerator::LanguageCompilerRule(
const std::string& lang) const
{
@@ -104,31 +96,6 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule(
cmGlobalNinjaGenerator::EncodeRuleName(this->Target->GetName());
}
-// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
-const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature)
-{
- return this->Target->GetFeature(feature, this->GetConfigName());
-}
-
-// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
-bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature)
-{
- return this->Target->GetFeatureAsBool(feature, this->GetConfigName());
-}
-
-// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
-void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags,
- const std::string& lang)
-{
- // Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, lang, this->GetConfigName());
-
- if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION"))
- {
- this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
- }
-}
-
std::string
cmNinjaTargetGenerator::OrderDependsTargetForTarget()
{
@@ -143,71 +110,37 @@ std::string
cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
const std::string& language)
{
- // TODO: Fortran support.
- // // Fortran-specific flags computed for this target.
- // if(*l == "Fortran")
- // {
- // this->AddFortranFlags(flags);
- // }
-
- bool hasLangCached = this->LanguageFlags.count(language) != 0;
- std::string& languageFlags = this->LanguageFlags[language];
- if(!hasLangCached)
- {
- this->AddFeatureFlags(languageFlags, language);
-
- this->GetLocalGenerator()->AddArchitectureFlags(languageFlags,
- this->GeneratorTarget,
- language,
- this->GetConfigName());
-
- // Add shared-library flags if needed.
- this->LocalGenerator->AddCMP0018Flags(languageFlags, this->Target,
- language,
- this->GetConfigName());
-
- this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target,
- language);
-
- std::vector<std::string> includes;
- this->LocalGenerator->GetIncludeDirectories(includes,
- this->GeneratorTarget,
- language,
- this->GetConfigName());
- // Add include directory flags.
- std::string includeFlags =
- this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
- language,
- language == "RC" ? true : false, // full include paths for RC
- // needed by cmcldeps
- false,
- this->GetConfigName());
- if (this->GetGlobalGenerator()->IsGCCOnWindows())
- cmSystemTools::ReplaceString(includeFlags, "\\", "/");
-
- this->LocalGenerator->AppendFlags(languageFlags, includeFlags);
-
- // Append old-style preprocessor definition flags.
- this->LocalGenerator->AppendFlags(languageFlags,
- this->Makefile->GetDefineFlags());
-
- // Add target-specific flags.
- this->LocalGenerator->AddCompileOptions(languageFlags, this->Target,
- language,
- this->GetConfigName());
- }
-
- std::string flags = languageFlags;
+ std::string flags = this->GetFlags(language);
// Add source file specific flags.
this->LocalGenerator->AppendFlags(flags,
source->GetProperty("COMPILE_FLAGS"));
- // TODO: Handle Apple frameworks.
-
return flags;
}
+void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
+ std::string const& language)
+{
+ std::vector<std::string> includes;
+ this->LocalGenerator->GetIncludeDirectories(includes,
+ this->GeneratorTarget,
+ language,
+ this->GetConfigName());
+ // Add include directory flags.
+ std::string includeFlags =
+ this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
+ language,
+ language == "RC" ? true : false, // full include paths for RC
+ // needed by cmcldeps
+ false,
+ this->GetConfigName());
+ if (this->GetGlobalGenerator()->IsGCCOnWindows())
+ cmSystemTools::ReplaceString(includeFlags, "\\", "/");
+
+ this->LocalGenerator->AppendFlags(languageFlags, includeFlags);
+}
+
bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const
{
if (lang == "C" || lang == "CXX")
@@ -230,16 +163,6 @@ cmNinjaTargetGenerator::
ComputeDefines(cmSourceFile const* source, const std::string& language)
{
std::set<std::string> defines;
-
- // Add the export symbol definition for shared library objects.
- if(const char* exportMacro = this->Target->GetExportMacro())
- {
- this->LocalGenerator->AppendDefines(defines, exportMacro);
- }
-
- // Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
- this->GetConfigName(), language);
this->LocalGenerator->AppendDefines
(defines,
source->GetProperty("COMPILE_DEFINITIONS"));
@@ -251,7 +174,7 @@ ComputeDefines(cmSourceFile const* source, const std::string& language)
source->GetProperty(defPropName));
}
- std::string definesString;
+ std::string definesString = this->GetDefines(language);
this->LocalGenerator->JoinDefines(defines, definesString,
language);
@@ -277,7 +200,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
// Add a dependency on the link definitions file, if any.
if(!this->ModuleDefinitionFile.empty())
{
- result.push_back(this->ModuleDefinitionFile);
+ result.push_back(this->ConvertToNinjaPath(this->ModuleDefinitionFile));
}
return result;
@@ -475,6 +398,25 @@ cmNinjaTargetGenerator
}
}
+ // Maybe insert a compiler launcher like ccache or distcc
+ if (!compileCmds.empty() && (lang == "C" || lang == "CXX"))
+ {
+ std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
+ const char *clauncher = this->Target->GetProperty(clauncher_prop);
+ if (clauncher && *clauncher)
+ {
+ std::vector<std::string> launcher_cmd;
+ cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true);
+ for (std::vector<std::string>::iterator i = launcher_cmd.begin(),
+ e = launcher_cmd.end(); i != e; ++i)
+ {
+ *i = this->LocalGenerator->EscapeForShell(*i);
+ }
+ std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " ";
+ compileCmds.front().insert(0, run_launcher);
+ }
+ }
+
if (!compileCmds.empty())
{
compileCmds.front().insert(0, cldeps);
@@ -588,11 +530,6 @@ cmNinjaTargetGenerator
{
this->WriteObjectBuildStatement(*si, !orderOnlyDeps.empty());
}
- std::string def = this->GeneratorTarget->GetModuleDefinitionFile(config);
- if(!def.empty())
- {
- this->ModuleDefinitionFile = this->ConvertToNinjaPath(def);
- }
this->GetBuildFileStream() << "\n";
}
@@ -742,32 +679,6 @@ cmNinjaTargetGenerator
}
}
-//----------------------------------------------------------------------------
-void
-cmNinjaTargetGenerator
-::AddModuleDefinitionFlag(std::string& flags)
-{
- if(this->ModuleDefinitionFile.empty())
- {
- return;
- }
-
- // TODO: Create a per-language flag variable.
- const char* defFileFlag =
- this->Makefile->GetDefinition("CMAKE_LINK_DEF_FILE_FLAG");
- if(!defFileFlag)
- {
- return;
- }
-
- // Append the flag and value. Use ConvertToLinkReference to help
- // vs6's "cl -link" pass it to the linker.
- std::string flag = defFileFlag;
- flag += (this->LocalGenerator->ConvertToLinkReference(
- this->ModuleDefinitionFile));
- this->LocalGenerator->AppendFlags(flags, flag);
-}
-
void
cmNinjaTargetGenerator
::EnsureDirectoryExists(const std::string& path) const
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 4e7d8b3..8912431 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -13,6 +13,8 @@
#ifndef cmNinjaTargetGenerator_h
#define cmNinjaTargetGenerator_h
+#include "cmCommonTargetGenerator.h"
+
#include "cmStandardIncludes.h"
#include "cmNinjaTypes.h"
#include "cmLocalNinjaGenerator.h"
@@ -26,14 +28,14 @@ class cmMakefile;
class cmSourceFile;
class cmCustomCommand;
-class cmNinjaTargetGenerator
+class cmNinjaTargetGenerator: public cmCommonTargetGenerator
{
public:
/// Create a cmNinjaTargetGenerator according to the @a target's type.
static cmNinjaTargetGenerator* New(cmGeneratorTarget* target);
/// Build a NinjaTargetGenerator.
- cmNinjaTargetGenerator(cmTarget* target);
+ cmNinjaTargetGenerator(cmGeneratorTarget* target);
/// Destructor.
virtual ~cmNinjaTargetGenerator();
@@ -65,14 +67,8 @@ protected:
cmMakefile* GetMakefile() const
{ return this->Makefile; }
- std::string const& GetConfigName() const;
-
std::string LanguageCompilerRule(const std::string& lang) const;
- const char* GetFeature(const std::string& feature);
- bool GetFeatureAsBool(const std::string& feature);
- void AddFeatureFlags(std::string& flags, const std::string& lang);
-
std::string OrderDependsTargetForTarget();
std::string ComputeOrderDependsForTarget();
@@ -85,6 +81,8 @@ protected:
std::string ComputeFlagsForObject(cmSourceFile const* source,
const std::string& language);
+ void AddIncludeFlags(std::string& flags, std::string const& lang);
+
std::string ComputeDefines(cmSourceFile const* source,
const std::string& language);
@@ -119,9 +117,6 @@ protected:
cmNinjaDeps GetObjects() const
{ return this->Objects; }
- // Helper to add flag for windows .def file.
- void AddModuleDefinitionFlag(std::string& flags);
-
void EnsureDirectoryExists(const std::string& dir) const;
void EnsureParentDirectoryExists(const std::string& path) const;
@@ -150,19 +145,10 @@ protected:
cmNinjaVars& vars);
private:
- cmTarget* Target;
- cmGeneratorTarget* GeneratorTarget;
- cmMakefile* Makefile;
cmLocalNinjaGenerator* LocalGenerator;
/// List of object files for this target.
cmNinjaDeps Objects;
std::vector<cmCustomCommand const*> CustomCommands;
-
- typedef std::map<std::string, std::string> LanguageFlagMap;
- LanguageFlagMap LanguageFlags;
-
- // The windows module definition source file (.def), if any.
- std::string ModuleDefinitionFile;
};
#endif // ! cmNinjaTargetGenerator_h
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 42d6b46..c3bf011 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -21,7 +21,7 @@
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
cmGeneratorTarget *target)
- : cmNinjaTargetGenerator(target->Target) {}
+ : cmNinjaTargetGenerator(target) {}
cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {}
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index a8eef82..3bc0eb7 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -22,7 +22,7 @@ cmOSXBundleGenerator(cmGeneratorTarget* target,
const std::string& configName)
: GT(target)
, Makefile(target->Target->GetMakefile())
- , LocalGenerator(Makefile->GetLocalGenerator())
+ , LocalGenerator(target->GetLocalGenerator())
, ConfigName(configName)
, MacContentFolders(0)
{
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 07c85dd..cb5a51f 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -44,8 +44,6 @@ private:
cmTarget const* Target;
std::string Purpose;
- bool Computed;
-
std::vector<std::string> OrderedDirectories;
std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries;
@@ -68,8 +66,9 @@ private:
void OrderDirectories();
void VisitDirectory(unsigned int i);
void DiagnoseCycle();
- bool CycleDiagnosed;
int WalkId;
+ bool CycleDiagnosed;
+ bool Computed;
// Adjacency-list representation of runtime path ordering graph.
// This maps from directory to those that must come *before* it.
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
new file mode 100644
index 0000000..7cd6a47
--- /dev/null
+++ b/Source/cmOutputConverter.cxx
@@ -0,0 +1,1050 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmOutputConverter.h"
+
+#include "cmAlgorithms.h"
+#include "cmake.h"
+
+#include <assert.h>
+
+#include <string.h> /* strlen */
+#include <ctype.h> /* isalpha */
+
+cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot)
+ : StateSnapshot(snapshot), LinkScriptShell(false)
+{
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmOutputConverter::ConvertToOutputForExistingCommon(const std::string& remote,
+ std::string const& result,
+ OutputFormat format) const
+{
+ // If this is a windows shell, the result has a space, and the path
+ // already exists, we can use a short-path to reference it without a
+ // space.
+ if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos &&
+ cmSystemTools::FileExists(remote.c_str()))
+ {
+ std::string tmp;
+ if(cmSystemTools::GetShortPath(remote, tmp))
+ {
+ return this->ConvertToOutputFormat(tmp, format);
+ }
+ }
+
+ // Otherwise, leave it unchanged.
+ return result;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmOutputConverter::ConvertToOutputForExisting(const std::string& remote,
+ RelativeRoot local,
+ OutputFormat format) const
+{
+ static_cast<void>(local);
+
+ // Perform standard conversion.
+ std::string result = this->ConvertToOutputFormat(remote, format);
+
+ // Consider short-path.
+ return this->ConvertToOutputForExistingCommon(remote, result, format);
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmOutputConverter::ConvertToOutputForExisting(RelativeRoot remote,
+ const std::string& local,
+ OutputFormat format) const
+{
+ // Perform standard conversion.
+ std::string result = this->Convert(remote, local, format, true);
+
+ // Consider short-path.
+ const char* remotePath = this->GetRelativeRootPath(remote);
+ return this->ConvertToOutputForExistingCommon(remotePath, result, format);
+}
+
+//----------------------------------------------------------------------------
+const char* cmOutputConverter::GetRelativeRootPath(RelativeRoot relroot) const
+{
+ switch (relroot)
+ {
+ case HOME: return this->GetState()->GetSourceDirectory();
+ case START: return this->StateSnapshot.GetCurrentSourceDirectory();
+ case HOME_OUTPUT: return this->GetState()->GetBinaryDirectory();
+ case START_OUTPUT: return this->StateSnapshot.GetCurrentBinaryDirectory();
+ default: break;
+ }
+ return 0;
+}
+
+std::string cmOutputConverter::Convert(const std::string& source,
+ RelativeRoot relative,
+ OutputFormat output) const
+{
+ // Convert the path to a relative path.
+ std::string result = source;
+
+ switch (relative)
+ {
+ case HOME:
+ result = this->ConvertToRelativePath(
+ this->GetState()->GetSourceDirectoryComponents(), result);
+ break;
+ case START:
+ result = this->ConvertToRelativePath(
+ this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
+ break;
+ case HOME_OUTPUT:
+ result = this->ConvertToRelativePath(
+ this->GetState()->GetBinaryDirectoryComponents(), result);
+ break;
+ case START_OUTPUT:
+ result = this->ConvertToRelativePath(
+ this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
+ break;
+ case FULL:
+ result = cmSystemTools::CollapseFullPath(result);
+ break;
+ case NONE:
+ break;
+ }
+ return this->ConvertToOutputFormat(result, output);
+}
+
+//----------------------------------------------------------------------------
+std::string cmOutputConverter::ConvertToOutputFormat(const std::string& source,
+ OutputFormat output) const
+{
+ std::string result = source;
+ // Convert it to an output path.
+ if (output == MAKERULE)
+ {
+ result = cmSystemTools::ConvertToOutputPath(result.c_str());
+ }
+ else if(output == SHELL || output == WATCOMQUOTE)
+ {
+ // For the MSYS shell convert drive letters to posix paths, so
+ // that c:/some/path becomes /c/some/path. This is needed to
+ // avoid problems with the shell path translation.
+ if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell)
+ {
+ if(result.size() > 2 && result[1] == ':')
+ {
+ result[1] = result[0];
+ result[0] = '/';
+ }
+ }
+ if(this->GetState()->UseWindowsShell())
+ {
+ std::replace(result.begin(), result.end(), '/', '\\');
+ }
+ result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE);
+ }
+ else if(output == RESPONSE)
+ {
+ result = this->EscapeForShell(result, false, false, false);
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+std::string cmOutputConverter::Convert(RelativeRoot remote,
+ const std::string& local,
+ OutputFormat output,
+ bool optional) const
+{
+ const char* remotePath = this->GetRelativeRootPath(remote);
+
+ // The relative root must have a path (i.e. not FULL or NONE)
+ assert(remotePath != 0);
+
+ if(!local.empty() && !optional)
+ {
+ std::vector<std::string> components;
+ cmSystemTools::SplitPath(local, components);
+ std::string result = this->ConvertToRelativePath(components, remotePath);
+ return this->ConvertToOutputFormat(result, output);
+ }
+
+ return this->ConvertToOutputFormat(remotePath, output);
+}
+
+//----------------------------------------------------------------------------
+static bool cmOutputConverterNotAbove(const char* a, const char* b)
+{
+ return (cmSystemTools::ComparePath(a, b) ||
+ cmSystemTools::IsSubDirectory(a, b));
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmOutputConverter::ConvertToRelativePath(const std::vector<std::string>& local,
+ const std::string& in_remote,
+ bool force) const
+{
+ // The path should never be quoted.
+ assert(in_remote[0] != '\"');
+
+ // The local path should never have a trailing slash.
+ assert(!local.empty() && !(local[local.size()-1] == ""));
+
+ // If the path is already relative then just return the path.
+ if(!cmSystemTools::FileIsFullPath(in_remote.c_str()))
+ {
+ return in_remote;
+ }
+
+ if(!force)
+ {
+ // Skip conversion if the path and local are not both in the source
+ // or both in the binary tree.
+ std::string local_path = cmSystemTools::JoinPath(local);
+ if(!((cmOutputConverterNotAbove(local_path.c_str(),
+ this->StateSnapshot.GetRelativePathTopBinary()) &&
+ cmOutputConverterNotAbove(in_remote.c_str(),
+ this->StateSnapshot.GetRelativePathTopBinary())) ||
+ (cmOutputConverterNotAbove(local_path.c_str(),
+ this->StateSnapshot.GetRelativePathTopSource()) &&
+ cmOutputConverterNotAbove(in_remote.c_str(),
+ this->StateSnapshot.GetRelativePathTopSource()))))
+ {
+ return in_remote;
+ }
+ }
+
+ // Identify the longest shared path component between the remote
+ // path and the local path.
+ std::vector<std::string> remote;
+ cmSystemTools::SplitPath(in_remote, remote);
+ unsigned int common=0;
+ while(common < remote.size() &&
+ common < local.size() &&
+ cmSystemTools::ComparePath(remote[common],
+ local[common]))
+ {
+ ++common;
+ }
+
+ // If no part of the path is in common then return the full path.
+ if(common == 0)
+ {
+ return in_remote;
+ }
+
+ // If the entire path is in common then just return a ".".
+ if(common == remote.size() &&
+ common == local.size())
+ {
+ return ".";
+ }
+
+ // If the entire path is in common except for a trailing slash then
+ // just return a "./".
+ if(common+1 == remote.size() &&
+ remote[common].empty() &&
+ common == local.size())
+ {
+ return "./";
+ }
+
+ // Construct the relative path.
+ std::string relative;
+
+ // First add enough ../ to get up to the level of the shared portion
+ // of the path. Leave off the trailing slash. Note that the last
+ // component of local will never be empty because local should never
+ // have a trailing slash.
+ for(unsigned int i=common; i < local.size(); ++i)
+ {
+ relative += "..";
+ if(i < local.size()-1)
+ {
+ relative += "/";
+ }
+ }
+
+ // Now add the portion of the destination path that is not included
+ // in the shared portion of the path. Add a slash the first time
+ // only if there was already something in the path. If there was a
+ // trailing slash in the input then the last iteration of the loop
+ // will add a slash followed by an empty string which will preserve
+ // the trailing slash in the output.
+
+ if(!relative.empty() && !remote.empty())
+ {
+ relative += "/";
+ }
+ relative += cmJoin(cmRange(remote).advance(common), "/");
+
+ // Finally return the path.
+ return relative;
+}
+
+//----------------------------------------------------------------------------
+static bool cmOutputConverterIsShellOperator(const std::string& str)
+{
+ static std::set<std::string> shellOperators;
+ if(shellOperators.empty())
+ {
+ shellOperators.insert("<");
+ shellOperators.insert(">");
+ shellOperators.insert("<<");
+ shellOperators.insert(">>");
+ shellOperators.insert("|");
+ shellOperators.insert("||");
+ shellOperators.insert("&&");
+ shellOperators.insert("&>");
+ shellOperators.insert("1>");
+ shellOperators.insert("2>");
+ shellOperators.insert("2>&1");
+ shellOperators.insert("1>&2");
+ }
+ return shellOperators.count(str) > 0;
+}
+
+//----------------------------------------------------------------------------
+std::string cmOutputConverter::EscapeForShell(const std::string& str,
+ bool makeVars,
+ bool forEcho,
+ bool useWatcomQuote) const
+{
+ // Do not escape shell operators.
+ if(cmOutputConverterIsShellOperator(str))
+ {
+ return str;
+ }
+
+ // Compute the flags for the target shell environment.
+ int flags = 0;
+ if(this->GetState()->UseWindowsVSIDE())
+ {
+ flags |= Shell_Flag_VSIDE;
+ }
+ else if(!this->LinkScriptShell)
+ {
+ flags |= Shell_Flag_Make;
+ }
+ if(makeVars)
+ {
+ flags |= Shell_Flag_AllowMakeVariables;
+ }
+ if(forEcho)
+ {
+ flags |= Shell_Flag_EchoWindows;
+ }
+ if(useWatcomQuote)
+ {
+ flags |= Shell_Flag_WatcomQuote;
+ }
+ if(this->GetState()->UseWatcomWMake())
+ {
+ flags |= Shell_Flag_WatcomWMake;
+ }
+ if(this->GetState()->UseMinGWMake())
+ {
+ flags |= Shell_Flag_MinGWMake;
+ }
+ if(this->GetState()->UseNMake())
+ {
+ flags |= Shell_Flag_NMake;
+ }
+
+ // Compute the buffer size needed.
+ int size = (this->GetState()->UseWindowsShell() ?
+ Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
+ Shell_GetArgumentSizeForUnix(str.c_str(), flags));
+
+ // Compute the shell argument itself.
+ std::vector<char> arg(size);
+ if(this->GetState()->UseWindowsShell())
+ {
+ Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
+ }
+ else
+ {
+ Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags);
+ }
+ return std::string(&arg[0]);
+}
+
+//----------------------------------------------------------------------------
+std::string cmOutputConverter::EscapeForCMake(const std::string& str)
+{
+ // Always double-quote the argument to take care of most escapes.
+ std::string result = "\"";
+ for(const char* c = str.c_str(); *c; ++c)
+ {
+ if(*c == '"')
+ {
+ // Escape the double quote to avoid ending the argument.
+ result += "\\\"";
+ }
+ else if(*c == '$')
+ {
+ // Escape the dollar to avoid expanding variables.
+ result += "\\$";
+ }
+ else if(*c == '\\')
+ {
+ // Escape the backslash to avoid other escapes.
+ result += "\\\\";
+ }
+ else
+ {
+ // Other characters will be parsed correctly.
+ result += *c;
+ }
+ }
+ result += "\"";
+ return result;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags)
+{
+ char local_buffer[1024];
+ char* buffer = local_buffer;
+ int size = Shell_GetArgumentSizeForWindows(arg, shell_flags);
+ if(size > 1024)
+ {
+ buffer = new char[size];
+ }
+ Shell_GetArgumentForWindows(arg, buffer, shell_flags);
+ std::string result(buffer);
+ if(buffer != local_buffer)
+ {
+ delete [] buffer;
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+cmOutputConverter::FortranFormat
+cmOutputConverter::GetFortranFormat(const char* value)
+{
+ FortranFormat format = FortranFormatNone;
+ if(value && *value)
+ {
+ std::vector<std::string> fmt;
+ cmSystemTools::ExpandListArgument(value, fmt);
+ for(std::vector<std::string>::iterator fi = fmt.begin();
+ fi != fmt.end(); ++fi)
+ {
+ if(*fi == "FIXED")
+ {
+ format = FortranFormatFixed;
+ }
+ if(*fi == "FREE")
+ {
+ format = FortranFormatFree;
+ }
+ }
+ }
+ return format;
+}
+
+void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell)
+{
+ this->LinkScriptShell = linkScriptShell;
+}
+
+cmState* cmOutputConverter::GetState() const
+{
+ return this->StateSnapshot.GetState();
+}
+
+//----------------------------------------------------------------------------
+/*
+
+Notes:
+
+Make variable replacements open a can of worms. Sometimes they should
+be quoted and sometimes not. Sometimes their replacement values are
+already quoted.
+
+VS variables cause problems. In order to pass the referenced value
+with spaces the reference must be quoted. If the variable value ends
+in a backslash then it will escape the ending quote! In order to make
+the ending backslash appear we need this:
+
+ "$(InputDir)\"
+
+However if there is not a trailing backslash then this will put a
+quote in the value so we need:
+
+ "$(InputDir)"
+
+Make variable references are platform specific so we should probably
+just NOT quote them and let the listfile author deal with it.
+
+*/
+
+/*
+TODO: For windows echo:
+
+To display a pipe (|) or redirection character (< or >) when using the
+echo command, use a caret character immediately before the pipe or
+redirection character (for example, ^>, ^<, or ^| ). If you need to
+use the caret character itself (^), use two in a row (^^).
+*/
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__CharIsWhitespace(char c)
+{
+ return ((c == ' ') || (c == '\t'));
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__CharNeedsQuotesOnUnix(char c)
+{
+ return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
+ (c == '&') || (c == '$') || (c == '(') || (c == ')') ||
+ (c == '~') || (c == '<') || (c == '>') || (c == '|') ||
+ (c == '*') || (c == '^') || (c == '\\'));
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__CharNeedsQuotesOnWindows(char c)
+{
+ return ((c == '\'') || (c == '#') || (c == '&') ||
+ (c == '<') || (c == '>') || (c == '|') || (c == '^'));
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__CharNeedsQuotes(char c, int isUnix, int flags)
+{
+ /* On Windows the built-in command shell echo never needs quotes. */
+ if(!isUnix && (flags & Shell_Flag_EchoWindows))
+ {
+ return 0;
+ }
+
+ /* On all platforms quotes are needed to preserve whitespace. */
+ if(Shell__CharIsWhitespace(c))
+ {
+ return 1;
+ }
+
+ if(isUnix)
+ {
+ /* On UNIX several special characters need quotes to preserve them. */
+ if(Shell__CharNeedsQuotesOnUnix(c))
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ /* On Windows several special characters need quotes to preserve them. */
+ if(Shell__CharNeedsQuotesOnWindows(c))
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__CharIsMakeVariableName(char c)
+{
+ return c && (c == '_' || isalpha(((int)c)));
+}
+
+/*--------------------------------------------------------------------------*/
+const char* cmOutputConverter::Shell__SkipMakeVariables(const char* c)
+{
+ while(*c == '$' && *(c+1) == '(')
+ {
+ const char* skip = c+2;
+ while(Shell__CharIsMakeVariableName(*skip))
+ {
+ ++skip;
+ }
+ if(*skip == ')')
+ {
+ c = skip+1;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return c;
+}
+
+/*
+Allowing make variable replacements opens a can of worms. Sometimes
+they should be quoted and sometimes not. Sometimes their replacement
+values are already quoted or contain escapes.
+
+Some Visual Studio variables cause problems. In order to pass the
+referenced value with spaces the reference must be quoted. If the
+variable value ends in a backslash then it will escape the ending
+quote! In order to make the ending backslash appear we need this:
+
+ "$(InputDir)\"
+
+However if there is not a trailing backslash then this will put a
+quote in the value so we need:
+
+ "$(InputDir)"
+
+This macro decides whether we quote an argument just because it
+contains a make variable reference. This should be replaced with a
+flag later when we understand applications of this better.
+*/
+#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__ArgumentNeedsQuotes(const char* in,
+ int isUnix, int flags)
+{
+ /* The empty string needs quotes. */
+ if(!*in)
+ {
+ return 1;
+ }
+
+ /* Scan the string for characters that require quoting. */
+ {
+ const char* c;
+ for(c=in; *c; ++c)
+ {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if(flags & Shell_Flag_AllowMakeVariables)
+ {
+#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES
+ const char* skip = Shell__SkipMakeVariables(c);
+ if(skip != c)
+ {
+ /* We need to quote make variable references to preserve the
+ string with contents substituted in its place. */
+ return 1;
+ }
+#else
+ /* Skip over the make variable references if any are present. */
+ c = Shell__SkipMakeVariables(c);
+
+ /* Stop if we have reached the end of the string. */
+ if(!*c)
+ {
+ break;
+ }
+#endif
+ }
+
+ /* Check whether this character needs quotes. */
+ if(Shell__CharNeedsQuotes(*c, isUnix, flags))
+ {
+ return 1;
+ }
+ }
+ }
+
+ /* On Windows some single character arguments need quotes. */
+ if(!isUnix && *in && !*(in+1))
+ {
+ char c = *in;
+ if((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#'))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell__GetArgumentSize(const char* in,
+ int isUnix, int flags)
+{
+ /* Start with the length of the original argument, plus one for
+ either a terminating null or a separating space. */
+ int size = (int)strlen(in) + 1;
+
+ /* String iterator. */
+ const char* c;
+
+ /* Keep track of how many backslashes have been encountered in a row. */
+ int windows_backslashes = 0;
+
+ /* Scan the string for characters that require escaping or quoting. */
+ for(c=in; *c; ++c)
+ {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if(flags & Shell_Flag_AllowMakeVariables)
+ {
+ /* Skip over the make variable references if any are present. */
+ c = Shell__SkipMakeVariables(c);
+
+ /* Stop if we have reached the end of the string. */
+ if(!*c)
+ {
+ break;
+ }
+ }
+
+ /* Check whether this character needs escaping for the shell. */
+ if(isUnix)
+ {
+ /* On Unix a few special characters need escaping even inside a
+ quoted argument. */
+ if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
+ {
+ /* This character needs a backslash to escape it. */
+ ++size;
+ }
+ }
+ else if(flags & Shell_Flag_EchoWindows)
+ {
+ /* On Windows the built-in command shell echo never needs escaping. */
+ }
+ else
+ {
+ /* On Windows only backslashes and double-quotes need escaping. */
+ if(*c == '\\')
+ {
+ /* Found a backslash. It may need to be escaped later. */
+ ++windows_backslashes;
+ }
+ else if(*c == '"')
+ {
+ /* Found a double-quote. We need to escape it and all
+ immediately preceding backslashes. */
+ size += windows_backslashes + 1;
+ windows_backslashes = 0;
+ }
+ else
+ {
+ /* Found another character. This eliminates the possibility
+ that any immediately preceding backslashes will be
+ escaped. */
+ windows_backslashes = 0;
+ }
+ }
+
+ /* Check whether this character needs escaping for a make tool. */
+ if(*c == '$')
+ {
+ if(flags & Shell_Flag_Make)
+ {
+ /* In Makefiles a dollar is written $$ so we need one extra
+ character. */
+ ++size;
+ }
+ else if(flags & Shell_Flag_VSIDE)
+ {
+ /* In a VS IDE a dollar is written "$" so we need two extra
+ characters. */
+ size += 2;
+ }
+ }
+ else if(*c == '#')
+ {
+ if((flags & Shell_Flag_Make) &&
+ (flags & Shell_Flag_WatcomWMake))
+ {
+ /* In Watcom WMake makefiles a pound is written $# so we need
+ one extra character. */
+ ++size;
+ }
+ }
+ else if(*c == '%')
+ {
+ if((flags & Shell_Flag_VSIDE) ||
+ ((flags & Shell_Flag_Make) &&
+ ((flags & Shell_Flag_MinGWMake) ||
+ (flags & Shell_Flag_NMake))))
+ {
+ /* In the VS IDE, NMake, or MinGW make a percent is written %%
+ so we need one extra characters. */
+ size += 1;
+ }
+ }
+ else if(*c == ';')
+ {
+ if(flags & Shell_Flag_VSIDE)
+ {
+ /* In a VS IDE a semicolon is written ";" so we need two extra
+ characters. */
+ size += 2;
+ }
+ }
+ }
+
+ /* Check whether the argument needs surrounding quotes. */
+ if(Shell__ArgumentNeedsQuotes(in, isUnix, flags))
+ {
+ /* Surrounding quotes are needed. Allocate space for them. */
+ if((flags & Shell_Flag_WatcomQuote) && (isUnix))
+ {
+ size += 2;
+ }
+ size += 2;
+
+ /* We must escape all ending backslashes when quoting on windows. */
+ size += windows_backslashes;
+ }
+
+ return size;
+}
+
+/*--------------------------------------------------------------------------*/
+char* cmOutputConverter::Shell__GetArgument(const char* in, char* out,
+ int isUnix, int flags)
+{
+ /* String iterator. */
+ const char* c;
+
+ /* Keep track of how many backslashes have been encountered in a row. */
+ int windows_backslashes = 0;
+
+ /* Whether the argument must be quoted. */
+ int needQuotes = Shell__ArgumentNeedsQuotes(in, isUnix, flags);
+ if(needQuotes)
+ {
+ /* Add the opening quote for this argument. */
+ if(flags & Shell_Flag_WatcomQuote)
+ {
+ if(isUnix)
+ {
+ *out++ = '"';
+ }
+ *out++ = '\'';
+ }
+ else
+ {
+ *out++ = '"';
+ }
+ }
+
+ /* Scan the string for characters that require escaping or quoting. */
+ for(c=in; *c; ++c)
+ {
+ /* Look for $(MAKEVAR) syntax if requested. */
+ if(flags & Shell_Flag_AllowMakeVariables)
+ {
+ const char* skip = Shell__SkipMakeVariables(c);
+ if(skip != c)
+ {
+ /* Copy to the end of the make variable references. */
+ while(c != skip)
+ {
+ *out++ = *c++;
+ }
+
+ /* The make variable reference eliminates any escaping needed
+ for preceding backslashes. */
+ windows_backslashes = 0;
+
+ /* Stop if we have reached the end of the string. */
+ if(!*c)
+ {
+ break;
+ }
+ }
+ }
+
+ /* Check whether this character needs escaping for the shell. */
+ if(isUnix)
+ {
+ /* On Unix a few special characters need escaping even inside a
+ quoted argument. */
+ if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
+ {
+ /* This character needs a backslash to escape it. */
+ *out++ = '\\';
+ }
+ }
+ else if(flags & Shell_Flag_EchoWindows)
+ {
+ /* On Windows the built-in command shell echo never needs escaping. */
+ }
+ else
+ {
+ /* On Windows only backslashes and double-quotes need escaping. */
+ if(*c == '\\')
+ {
+ /* Found a backslash. It may need to be escaped later. */
+ ++windows_backslashes;
+ }
+ else if(*c == '"')
+ {
+ /* Found a double-quote. Escape all immediately preceding
+ backslashes. */
+ while(windows_backslashes > 0)
+ {
+ --windows_backslashes;
+ *out++ = '\\';
+ }
+
+ /* Add the backslash to escape the double-quote. */
+ *out++ = '\\';
+ }
+ else
+ {
+ /* We encountered a normal character. This eliminates any
+ escaping needed for preceding backslashes. */
+ windows_backslashes = 0;
+ }
+ }
+
+ /* Check whether this character needs escaping for a make tool. */
+ if(*c == '$')
+ {
+ if(flags & Shell_Flag_Make)
+ {
+ /* In Makefiles a dollar is written $$. The make tool will
+ replace it with just $ before passing it to the shell. */
+ *out++ = '$';
+ *out++ = '$';
+ }
+ else if(flags & Shell_Flag_VSIDE)
+ {
+ /* In a VS IDE a dollar is written "$". If this is written in
+ an un-quoted argument it starts a quoted segment, inserts
+ the $ and ends the segment. If it is written in a quoted
+ argument it ends quoting, inserts the $ and restarts
+ quoting. Either way the $ is isolated from surrounding
+ text to avoid looking like a variable reference. */
+ *out++ = '"';
+ *out++ = '$';
+ *out++ = '"';
+ }
+ else
+ {
+ /* Otherwise a dollar is written just $. */
+ *out++ = '$';
+ }
+ }
+ else if(*c == '#')
+ {
+ if((flags & Shell_Flag_Make) &&
+ (flags & Shell_Flag_WatcomWMake))
+ {
+ /* In Watcom WMake makefiles a pound is written $#. The make
+ tool will replace it with just # before passing it to the
+ shell. */
+ *out++ = '$';
+ *out++ = '#';
+ }
+ else
+ {
+ /* Otherwise a pound is written just #. */
+ *out++ = '#';
+ }
+ }
+ else if(*c == '%')
+ {
+ if((flags & Shell_Flag_VSIDE) ||
+ ((flags & Shell_Flag_Make) &&
+ ((flags & Shell_Flag_MinGWMake) ||
+ (flags & Shell_Flag_NMake))))
+ {
+ /* In the VS IDE, NMake, or MinGW make a percent is written %%. */
+ *out++ = '%';
+ *out++ = '%';
+ }
+ else
+ {
+ /* Otherwise a percent is written just %. */
+ *out++ = '%';
+ }
+ }
+ else if(*c == ';')
+ {
+ if(flags & Shell_Flag_VSIDE)
+ {
+ /* In a VS IDE a semicolon is written ";". If this is written
+ in an un-quoted argument it starts a quoted segment,
+ inserts the ; and ends the segment. If it is written in a
+ quoted argument it ends quoting, inserts the ; and restarts
+ quoting. Either way the ; is isolated. */
+ *out++ = '"';
+ *out++ = ';';
+ *out++ = '"';
+ }
+ else
+ {
+ /* Otherwise a semicolon is written just ;. */
+ *out++ = ';';
+ }
+ }
+ else
+ {
+ /* Store this character. */
+ *out++ = *c;
+ }
+ }
+
+ if(needQuotes)
+ {
+ /* Add enough backslashes to escape any trailing ones. */
+ while(windows_backslashes > 0)
+ {
+ --windows_backslashes;
+ *out++ = '\\';
+ }
+
+ /* Add the closing quote for this argument. */
+ if(flags & Shell_Flag_WatcomQuote)
+ {
+ *out++ = '\'';
+ if(isUnix)
+ {
+ *out++ = '"';
+ }
+ }
+ else
+ {
+ *out++ = '"';
+ }
+ }
+
+ /* Store a terminating null without incrementing. */
+ *out = 0;
+
+ return out;
+}
+
+/*--------------------------------------------------------------------------*/
+char* cmOutputConverter::Shell_GetArgumentForWindows(const char* in,
+ char* out, int flags)
+{
+ return Shell__GetArgument(in, out, 0, flags);
+}
+
+/*--------------------------------------------------------------------------*/
+char* cmOutputConverter::Shell_GetArgumentForUnix(const char* in,
+ char* out, int flags)
+{
+ return Shell__GetArgument(in, out, 1, flags);
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell_GetArgumentSizeForWindows(const char* in,
+ int flags)
+{
+ return Shell__GetArgumentSize(in, 0, flags);
+}
+
+/*--------------------------------------------------------------------------*/
+int cmOutputConverter::Shell_GetArgumentSizeForUnix(const char* in,
+ int flags)
+{
+ return Shell__GetArgumentSize(in, 1, flags);
+}
diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h
new file mode 100644
index 0000000..ed7739e
--- /dev/null
+++ b/Source/cmOutputConverter.h
@@ -0,0 +1,181 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmOutputConverter_h
+#define cmOutputConverter_h
+
+#include "cmStandardIncludes.h"
+
+#include "cmGlobalGenerator.h"
+#include "cmState.h"
+
+class cmOutputConverter
+{
+public:
+ cmOutputConverter(cmState::Snapshot snapshot);
+
+ /**
+ * Convert something to something else. This is a centralized conversion
+ * routine used by the generators to handle relative paths and the like.
+ * The flags determine what is actually done.
+ *
+ * relative: treat the argument as a directory and convert it to make it
+ * relative or full or unchanged. If relative (HOME, START etc) then that
+ * specifies what it should be relative to.
+ *
+ * output: make the result suitable for output to a...
+ *
+ * optional: should any relative path operation be controlled by the rel
+ * path setting
+ */
+ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
+ enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE };
+ std::string ConvertToOutputFormat(const std::string& source,
+ OutputFormat output) const;
+ std::string Convert(const std::string& remote, RelativeRoot local,
+ OutputFormat output = UNCHANGED) const;
+ std::string Convert(RelativeRoot remote, const std::string& local,
+ OutputFormat output = UNCHANGED,
+ bool optional = false) const;
+
+ /**
+ * Get path for the specified relative root.
+ */
+ const char* GetRelativeRootPath(RelativeRoot relroot) const;
+
+ ///! for existing files convert to output path and short path if spaces
+ std::string ConvertToOutputForExisting(const std::string& remote,
+ RelativeRoot local = START_OUTPUT,
+ OutputFormat format = SHELL) const;
+
+ /** For existing path identified by RelativeRoot convert to output
+ path and short path if spaces. */
+ std::string ConvertToOutputForExisting(RelativeRoot remote,
+ const std::string& local = "",
+ OutputFormat format = SHELL) const;
+
+ void SetLinkScriptShell(bool linkScriptShell);
+
+ /**
+ * Flags to pass to Shell_GetArgumentForWindows or
+ * Shell_GetArgumentForUnix. These modify the generated
+ * quoting and escape sequences to work under alternative
+ * environments.
+ */
+ enum Shell_Flag_e
+ {
+ /** The target shell is in a makefile. */
+ Shell_Flag_Make = (1<<0),
+
+ /** The target shell is in a VS project file. Do not use with
+ Shell_Flag_Make. */
+ Shell_Flag_VSIDE = (1<<1),
+
+ /** In a windows shell the argument is being passed to "echo". */
+ Shell_Flag_EchoWindows = (1<<2),
+
+ /** The target shell is in a Watcom WMake makefile. */
+ Shell_Flag_WatcomWMake = (1<<3),
+
+ /** The target shell is in a MinGW Make makefile. */
+ Shell_Flag_MinGWMake = (1<<4),
+
+ /** The target shell is in a NMake makefile. */
+ Shell_Flag_NMake = (1<<5),
+
+ /** Make variable reference syntax $(MAKEVAR) should not be escaped
+ to allow a build tool to replace it. Replacement values
+ containing spaces, quotes, backslashes, or other
+ non-alphanumeric characters that have significance to some makes
+ or shells produce undefined behavior. */
+ Shell_Flag_AllowMakeVariables = (1<<6),
+
+ /** The target shell quoting uses extra single Quotes for Watcom tools. */
+ Shell_Flag_WatcomQuote = (1<<7)
+ };
+
+ /**
+ * Transform the given command line argument for use in a Windows or
+ * Unix shell. Returns a pointer to the end of the command line
+ * argument in the provided output buffer. Flags may be passed to
+ * modify the generated quoting and escape sequences to work under
+ * alternative environments.
+ */
+ static char* Shell_GetArgumentForWindows(const char* in, char* out,
+ int flags);
+ static char* Shell_GetArgumentForUnix(const char* in, char* out, int flags);
+
+ /**
+ * Compute the size of the buffer required to store the output from
+ * Shell_GetArgumentForWindows or Shell_GetArgumentForUnix. The flags
+ * passed must be identical between the two calls.
+ */
+ static int Shell_GetArgumentSizeForWindows(const char* in, int flags);
+ static int Shell_GetArgumentSizeForUnix(const char* in, int flags);
+
+ std::string EscapeForShell(const std::string& str,
+ bool makeVars = false,
+ bool forEcho = false,
+ bool useWatcomQuote = false) const;
+
+ static std::string EscapeForCMake(const std::string& str);
+
+ /** Compute an escaped version of the given argument for use in a
+ windows shell. */
+ static std::string EscapeWindowsShellArgument(const char* arg,
+ int shell_flags);
+
+ enum FortranFormat
+ {
+ FortranFormatNone,
+ FortranFormatFixed,
+ FortranFormatFree
+ };
+ static FortranFormat GetFortranFormat(const char* value);
+
+ /**
+ * Convert the given remote path to a relative path with respect to
+ * the given local path. The local path must be given in component
+ * form (see SystemTools::SplitPath) without a trailing slash. The
+ * remote path must use forward slashes and not already be escaped
+ * or quoted.
+ */
+ std::string ConvertToRelativePath(const std::vector<std::string>& local,
+ const std::string& in_remote,
+ bool force = false) const;
+
+private:
+ cmState* GetState() const;
+
+ std::string ConvertToOutputForExistingCommon(const std::string& remote,
+ std::string const& result,
+ OutputFormat format) const;
+
+ static int Shell__CharIsWhitespace(char c);
+ static int Shell__CharNeedsQuotesOnUnix(char c);
+ static int Shell__CharNeedsQuotesOnWindows(char c);
+ static int Shell__CharNeedsQuotes(char c, int isUnix, int flags);
+ static int Shell__CharIsMakeVariableName(char c);
+ static const char* Shell__SkipMakeVariables(const char* c);
+ static int Shell__ArgumentNeedsQuotes(const char* in,
+ int isUnix, int flags);
+ static int Shell__GetArgumentSize(const char* in,
+ int isUnix, int flags);
+ static char* Shell__GetArgument(const char* in, char* out,
+ int isUnix, int flags);
+
+private:
+ cmState::Snapshot StateSnapshot;
+
+ bool LinkScriptShell;
+};
+
+#endif
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index f8d61db..5026893 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -343,29 +343,24 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
return e.str();
}
-cmPolicies::PolicyMap::PolicyMap()
-{
- this->UNDEFINED.set();
-}
-
cmPolicies::PolicyStatus
cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
{
PolicyStatus status = cmPolicies::WARN;
- if (this->OLD[id])
+ if (this->Status[(POLICY_STATUS_COUNT * id) + OLD])
{
status = cmPolicies::OLD;
}
- else if (this->NEW[id])
+ else if (this->Status[(POLICY_STATUS_COUNT * id) + NEW])
{
status = cmPolicies::NEW;
}
- else if (this->REQUIRED_ALWAYS[id])
+ else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS])
{
status = cmPolicies::REQUIRED_ALWAYS;
}
- else if (this->REQUIRED_IF_USED[id])
+ else if (this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED])
{
status = cmPolicies::REQUIRED_IF_USED;
}
@@ -375,19 +370,25 @@ cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
cmPolicies::PolicyStatus status)
{
- this->UNDEFINED.reset(id);
- this->OLD[id] = (status == cmPolicies::OLD);
- this->NEW[id] = (status == cmPolicies::NEW);
- this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS);
- this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED);
+ this->Status[(POLICY_STATUS_COUNT * id) + OLD] = (status == OLD);
+ this->Status[(POLICY_STATUS_COUNT * id) + WARN] = (status == WARN);
+ this->Status[(POLICY_STATUS_COUNT * id) + NEW] = (status == NEW);
+ this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS] =
+ (status == REQUIRED_ALWAYS);
+ this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED] =
+ (status == REQUIRED_IF_USED);
}
bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
{
- return !this->UNDEFINED[id];
+ return this->Status[(POLICY_STATUS_COUNT * id) + OLD]
+ || this->Status[(POLICY_STATUS_COUNT * id) + WARN]
+ || this->Status[(POLICY_STATUS_COUNT * id) + NEW]
+ || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_ALWAYS]
+ || this->Status[(POLICY_STATUS_COUNT * id) + REQUIRED_IF_USED];
}
bool cmPolicies::PolicyMap::IsEmpty() const
{
- return !this->UNDEFINED.none();
+ return this->Status.none();
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 00d857a..8a3c27d 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -244,6 +244,7 @@ public:
REQUIRED_IF_USED,
REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
};
+#define POLICY_STATUS_COUNT 5
/// Policy identifiers
enum PolicyID
@@ -281,18 +282,13 @@ public:
/** Represent a set of policy values. */
struct PolicyMap
{
- PolicyMap();
PolicyStatus Get(PolicyID id) const;
void Set(PolicyID id, PolicyStatus status);
bool IsDefined(PolicyID id) const;
bool IsEmpty() const;
private:
- std::bitset<cmPolicies::CMPCOUNT> UNDEFINED;
- std::bitset<cmPolicies::CMPCOUNT> OLD;
- std::bitset<cmPolicies::CMPCOUNT> NEW;
- std::bitset<cmPolicies::CMPCOUNT> REQUIRED_IF_USED;
- std::bitset<cmPolicies::CMPCOUNT> REQUIRED_ALWAYS;
+ std::bitset<cmPolicies::CMPCOUNT * POLICY_STATUS_COUNT> Status;
};
};
diff --git a/Source/cmProcessTools.cxx b/Source/cmProcessTools.cxx
index d2f7bf3..15d9ed0 100644
--- a/Source/cmProcessTools.cxx
+++ b/Source/cmProcessTools.cxx
@@ -44,7 +44,7 @@ void cmProcessTools::RunProcess(struct cmsysProcess_s* cp,
//----------------------------------------------------------------------------
cmProcessTools::LineParser::LineParser(char sep, bool ignoreCR):
- Separator(sep), IgnoreCR(ignoreCR), Log(0), Prefix(0), LineEnd('\0')
+ Log(0), Prefix(0), Separator(sep), LineEnd('\0'), IgnoreCR(ignoreCR)
{
}
diff --git a/Source/cmProcessTools.h b/Source/cmProcessTools.h
index 439726d..23833ca 100644
--- a/Source/cmProcessTools.h
+++ b/Source/cmProcessTools.h
@@ -51,12 +51,12 @@ public:
/** Configure logging of lines as they are extracted. */
void SetLog(std::ostream* log, const char* prefix);
protected:
- char Separator;
- bool IgnoreCR;
std::ostream* Log;
const char* Prefix;
- char LineEnd;
std::string Line;
+ char Separator;
+ char LineEnd;
+ bool IgnoreCR;
virtual bool ProcessChunk(const char* data, int length);
/** Implement in a subclass to process one line of input. It
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 176cb0d..46d7e01 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -53,7 +53,7 @@ bool cmProjectCommand
// CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build
// will work.
if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME")
- || (this->Makefile->GetLocalGenerator()->IsRootMakefile()))
+ || (this->Makefile->IsRootMakefile()))
{
this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
this->Makefile->AddCacheDefinition
@@ -233,7 +233,6 @@ bool cmProjectCommand
const char* include = this->Makefile->GetDefinition(extraInclude);
if(include)
{
- std::string fullFilePath;
bool readit =
this->Makefile->ReadDependentFile(include);
if(!readit && !cmSystemTools::GetFatalErrorOccured())
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx
index 40976db..ef57068 100644
--- a/Source/cmProperty.cxx
+++ b/Source/cmProperty.cxx
@@ -12,17 +12,14 @@
#include "cmProperty.h"
#include "cmSystemTools.h"
-void cmProperty::Set(const std::string& name, const char *value)
+void cmProperty::Set(const char *value)
{
- this->Name = name;
this->Value = value;
this->ValueHasBeenSet = true;
}
-void cmProperty::Append(const std::string& name, const char *value,
- bool asString)
+void cmProperty::Append(const char *value, bool asString)
{
- this->Name = name;
if(!this->Value.empty() && *value && !asString)
{
this->Value += ";";
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 659c4c3..e026372 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -21,11 +21,10 @@ public:
TEST, VARIABLE, CACHED_VARIABLE, INSTALL };
// set this property
- void Set(const std::string& name, const char *value);
+ void Set(const char *value);
// append to this property
- void Append(const std::string& name, const char *value,
- bool asString = false);
+ void Append(const char *value, bool asString = false);
// get the value
const char *GetValue() const;
@@ -34,7 +33,6 @@ public:
cmProperty() { this->ValueHasBeenSet = false; }
protected:
- std::string Name;
std::string Value;
bool ValueHasBeenSet;
};
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index 3875318..776fad1 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -29,9 +29,9 @@ void cmPropertyDefinitionMap
}
}
-bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name)
+bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
{
- cmPropertyDefinitionMap::iterator it = this->find(name);
+ cmPropertyDefinitionMap::const_iterator it = this->find(name);
if (it == this->end())
{
return false;
@@ -40,9 +40,9 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name)
return true;
}
-bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name)
+bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
{
- cmPropertyDefinitionMap::iterator it = this->find(name);
+ cmPropertyDefinitionMap::const_iterator it = this->find(name);
if (it == this->end())
{
return false;
diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h
index 00c7328..f95c721 100644
--- a/Source/cmPropertyDefinitionMap.h
+++ b/Source/cmPropertyDefinitionMap.h
@@ -27,10 +27,10 @@ public:
bool chain);
// has a named property been defined
- bool IsPropertyDefined(const std::string& name);
+ bool IsPropertyDefined(const std::string& name) const;
// is a named property set to chain
- bool IsPropertyChained(const std::string& name);
+ bool IsPropertyChained(const std::string& name) const;
};
#endif
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index 070f6f1..ef09dbc 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -14,6 +14,8 @@
#include "cmake.h"
#include "cmState.h"
+#include <assert.h>
+
cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
{
cmPropertyMap::iterator it = this->find(name);
@@ -29,54 +31,39 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
return prop;
}
-void cmPropertyMap::SetProperty(const std::string& name, const char *value,
- cmProperty::ScopeType scope)
+void cmPropertyMap::SetProperty(const std::string& name, const char *value)
{
if(!value)
{
this->erase(name);
return;
}
- (void)scope;
cmProperty *prop = this->GetOrCreateProperty(name);
- prop->Set(name,value);
+ prop->Set(value);
}
void cmPropertyMap::AppendProperty(const std::string& name, const char* value,
- cmProperty::ScopeType scope, bool asString)
+ bool asString)
{
// Skip if nothing to append.
if(!value || !*value)
{
return;
}
- (void)scope;
cmProperty *prop = this->GetOrCreateProperty(name);
- prop->Append(name,value,asString);
+ prop->Append(value,asString);
}
const char *cmPropertyMap
-::GetPropertyValue(const std::string& name,
- cmProperty::ScopeType scope,
- bool &chain) const
+::GetPropertyValue(const std::string& name) const
{
- chain = false;
- if (name.empty())
- {
- return 0;
- }
+ assert(!name.empty());
cmPropertyMap::const_iterator it = this->find(name);
if (it == this->end())
{
- // should we chain up?
- if (this->CMakeInstance)
- {
- chain = this->CMakeInstance->GetState()->
- IsPropertyChained(name,scope);
- }
return 0;
}
return it->second.GetValue();
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 02d4235..a9062db 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -14,29 +14,17 @@
#include "cmProperty.h"
-class cmake;
-
class cmPropertyMap : public std::map<std::string,cmProperty>
{
public:
cmProperty *GetOrCreateProperty(const std::string& name);
- void SetProperty(const std::string& name, const char *value,
- cmProperty::ScopeType scope);
+ void SetProperty(const std::string& name, const char *value);
void AppendProperty(const std::string& name, const char* value,
- cmProperty::ScopeType scope, bool asString=false);
-
- const char *GetPropertyValue(const std::string& name,
- cmProperty::ScopeType scope,
- bool &chain) const;
-
- void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; }
-
- cmPropertyMap() { this->CMakeInstance = 0;}
+ bool asString=false);
-private:
- cmake *CMakeInstance;
+ const char *GetPropertyValue(const std::string& name) const;
};
#endif
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index cbb06cd..58f4bf4 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -190,7 +190,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
std::vector<std::string> command;
command.push_back(rccCommand);
- command.push_back("--list");
+ command.push_back("-list");
std::string absFile = cmsys::SystemTools::GetRealPath(
sf->GetFullPath());
@@ -368,8 +368,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
#if defined(_WIN32) && !defined(__CYGWIN__)
bool usePRE_BUILD = false;
- cmLocalGenerator* localGen = makefile->GetLocalGenerator();
- cmGlobalGenerator* gg = localGen->GetGlobalGenerator();
+ cmGlobalGenerator* gg = makefile->GetGlobalGenerator();
if(gg->GetName().find("Visual Studio") != std::string::npos)
{
cmGlobalVisualStudioGenerator* vsgg =
@@ -440,6 +439,9 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
this->ListQt4RccInputs(sf, depends);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
+ // Cannot use PRE_BUILD because the resource files themselves
+ // may not be sources within the target so VS may not know the
+ // target needs to re-build at all.
usePRE_BUILD = false;
#endif
}
@@ -466,31 +468,11 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
else
#endif
{
- cmTarget* autogenTarget = 0;
- if (!rcc_output.empty() && !isNinja)
- {
- std::vector<std::string> no_byproducts;
- makefile->AddCustomCommandToOutput(rcc_output, no_byproducts,
- depends, "",
- commandLines, 0,
- workingDirectory.c_str(),
- false, false);
-
- cmCustomCommandLines no_commands;
- autogenTarget = makefile->AddUtilityCommand(
- autogenTargetName, true,
- workingDirectory.c_str(), rcc_output,
- no_commands, false, autogenComment.c_str());
-
- }
- else
- {
- autogenTarget = makefile->AddUtilityCommand(
+ cmTarget* autogenTarget = makefile->AddUtilityCommand(
autogenTargetName, true,
workingDirectory.c_str(),
/*byproducts=*/rcc_output, depends,
commandLines, false, autogenComment.c_str());
- }
// Set target folder
const char* autogenFolder = makefile->GetState()
@@ -522,10 +504,10 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
std::string &defs)
{
cmMakefile* makefile = target->GetMakefile();
- cmLocalGenerator* localGen = makefile->GetLocalGenerator();
+ cmGlobalGenerator* globalGen = makefile->GetGlobalGenerator();
std::vector<std::string> includeDirs;
- cmGeneratorTarget *gtgt = localGen->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
+ cmGeneratorTarget *gtgt = globalGen->GetGeneratorTarget(target);
+ cmLocalGenerator *localGen = gtgt->GetLocalGenerator();
// 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);
@@ -550,9 +532,9 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
std::string autogenTargetName = getAutogenTargetName(target);
makefile->AddDefinition("_moc_target_name",
- cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str());
+ cmOutputConverter::EscapeForCMake(autogenTargetName).c_str());
makefile->AddDefinition("_origin_target_name",
- cmLocalGenerator::EscapeForCMake(target->GetName()).c_str());
+ cmOutputConverter::EscapeForCMake(target->GetName()).c_str());
std::string targetDir = getAutogenTargetDir(target);
@@ -582,7 +564,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
this->SetupSourceFiles(target);
}
makefile->AddDefinition("_cpp_files",
- cmLocalGenerator::EscapeForCMake(this->Sources).c_str());
+ cmOutputConverter::EscapeForCMake(this->Sources).c_str());
if (target->GetPropertyAsBool("AUTOMOC"))
{
this->SetupAutoMocTarget(target, autogenTargetName,
@@ -609,7 +591,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
// Ensure we have write permission in case .in was read-only.
mode_t perm = 0;
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
mode_t mode_write = S_IWRITE;
#else
mode_t mode_write = S_IWUSR;
@@ -764,11 +746,11 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
std::string _moc_options = (tmp!=0 ? tmp : "");
makefile->AddDefinition("_moc_options",
- cmLocalGenerator::EscapeForCMake(_moc_options).c_str());
+ cmOutputConverter::EscapeForCMake(_moc_options).c_str());
makefile->AddDefinition("_skip_moc",
- cmLocalGenerator::EscapeForCMake(this->SkipMoc).c_str());
+ cmOutputConverter::EscapeForCMake(this->SkipMoc).c_str());
makefile->AddDefinition("_moc_headers",
- cmLocalGenerator::EscapeForCMake(this->Headers).c_str());
+ cmOutputConverter::EscapeForCMake(this->Headers).c_str());
bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE");
makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
@@ -780,9 +762,9 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
_moc_incs, _moc_compile_defs);
makefile->AddDefinition("_moc_incs",
- cmLocalGenerator::EscapeForCMake(_moc_incs).c_str());
+ cmOutputConverter::EscapeForCMake(_moc_incs).c_str());
makefile->AddDefinition("_moc_compile_defs",
- cmLocalGenerator::EscapeForCMake(_moc_compile_defs).c_str());
+ cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str());
for (std::vector<std::string>::const_iterator li = configs.begin();
li != configs.end(); ++li)
@@ -795,7 +777,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
if (config_moc_incs != _moc_incs)
{
configIncludes[*li] =
- cmLocalGenerator::EscapeForCMake(config_moc_incs);
+ cmOutputConverter::EscapeForCMake(config_moc_incs);
if(_moc_incs.empty())
{
_moc_incs = config_moc_incs;
@@ -804,7 +786,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
if (config_moc_compile_defs != _moc_compile_defs)
{
configDefines[*li] =
- cmLocalGenerator::EscapeForCMake(config_moc_compile_defs);
+ cmOutputConverter::EscapeForCMake(config_moc_compile_defs);
if(_moc_compile_defs.empty())
{
_moc_compile_defs = config_moc_compile_defs;
@@ -906,7 +888,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
skipped.insert(skipVec.begin(), skipVec.end());
makefile->AddDefinition("_skip_uic",
- cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str());
+ cmOutputConverter::EscapeForCMake(this->SkipUic).c_str());
std::vector<cmSourceFile*> uiFilesWithOptions
= makefile->GetQtUiFilesWithOptions();
@@ -920,7 +902,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
if (!_uic_opts.empty())
{
- _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts);
+ _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts);
makefile->AddDefinition("_uic_target_options", _uic_opts.c_str());
}
for (std::vector<std::string>::const_iterator li = configs.begin();
@@ -931,7 +913,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
if (config_uic_opts != _uic_opts)
{
configUicOptions[*li] =
- cmLocalGenerator::EscapeForCMake(config_uic_opts);
+ cmOutputConverter::EscapeForCMake(config_uic_opts);
if(_uic_opts.empty())
{
_uic_opts = config_uic_opts;
@@ -966,9 +948,9 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
}
makefile->AddDefinition("_qt_uic_options_files",
- cmLocalGenerator::EscapeForCMake(uiFileFiles).c_str());
+ cmOutputConverter::EscapeForCMake(uiFileFiles).c_str());
makefile->AddDefinition("_qt_uic_options_options",
- cmLocalGenerator::EscapeForCMake(uiFileOptions).c_str());
+ cmOutputConverter::EscapeForCMake(uiFileOptions).c_str());
std::string targetName = target->GetName();
if (strcmp(qtVersion, "5") == 0)
@@ -1141,15 +1123,15 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
}
}
makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(),
- cmLocalGenerator::EscapeForCMake(qrcInputs).c_str());
+ cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
makefile->AddDefinition("_rcc_files",
- cmLocalGenerator::EscapeForCMake(_rcc_files).c_str());
+ cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
makefile->AddDefinition("_qt_rcc_options_files",
- cmLocalGenerator::EscapeForCMake(rccFileFiles).c_str());
+ cmOutputConverter::EscapeForCMake(rccFileFiles).c_str());
makefile->AddDefinition("_qt_rcc_options_options",
- cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str());
+ cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
makefile->AddDefinition("_qt_rcc_executable",
this->GetRccExecutable(target).c_str());
@@ -1215,7 +1197,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cmLocalGenerator* lg = gg.MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
- gg.SetCurrentLocalGenerator(lg);
+ gg.SetCurrentMakefile(lg->GetMakefile());
this->ReadAutogenInfoFile(lg->GetMakefile(), targetDirectory, config);
this->ReadOldMocDefinitionsFile(lg->GetMakefile(), targetDirectory);
@@ -1434,7 +1416,7 @@ cmQtAutoGenerators::WriteOldMocDefinitionsFile(
outfile.open(filename.c_str(),
std::ios::trunc);
outfile << "set(AM_OLD_COMPILE_SETTINGS "
- << cmLocalGenerator::EscapeForCMake(
+ << cmOutputConverter::EscapeForCMake(
this->CurrentCompileSettingsStr) << ")\n";
outfile.close();
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index f74e3c5..4c0fcbc 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -105,7 +105,6 @@ private:
std::string SkipMoc;
std::string SkipUic;
std::string Headers;
- bool IncludeProjectDirsBefore;
std::string Srcdir;
std::string Builddir;
std::string MocExecutable;
@@ -131,6 +130,7 @@ private:
std::map<std::string, std::string> RccOptions;
std::map<std::string, std::vector<std::string> > RccInputs;
+ bool IncludeProjectDirsBefore;
bool Verbose;
bool ColorOutput;
bool RunMocFailed;
@@ -138,7 +138,6 @@ private:
bool RunRccFailed;
bool GenerateAll;
bool RelaxedMode;
-
};
#endif
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index e9cfacc..53dc5a8 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -85,8 +85,10 @@ bool cmSetTestsPropertiesCommand
unsigned int k;
for (k = 0; k < propertyPairs.size(); k = k + 2)
{
- test->SetProperty(propertyPairs[k],
- propertyPairs[k+1].c_str());
+ if (!propertyPairs[k].empty())
+ {
+ test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str());
+ }
}
}
else
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 724ab39..86f0a7a 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -22,7 +22,6 @@ cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name):
Location(mf, name)
{
this->CustomCommand = 0;
- this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
this->FindFullPathFailed = false;
this->IsUiFile = (".ui" ==
cmSystemTools::GetFilenameLastExtension(this->Location.GetName()));
@@ -299,7 +298,7 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc)
//----------------------------------------------------------------------------
void cmSourceFile::SetProperty(const std::string& prop, const char* value)
{
- this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE);
+ this->Properties.SetProperty(prop, value);
if (this->IsUiFile)
{
@@ -315,8 +314,7 @@ void cmSourceFile::SetProperty(const std::string& prop, const char* value)
void cmSourceFile::AppendProperty(const std::string& prop, const char* value,
bool asString)
{
- this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE,
- asString);
+ this->Properties.AppendProperty(prop, value, asString);
}
//----------------------------------------------------------------------------
@@ -362,13 +360,16 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const
}
}
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal)
{
cmMakefile const* mf = this->Location.GetMakefile();
- return mf->GetProperty(prop,cmProperty::SOURCE_FILE);
+ const bool chain = mf->GetState()->
+ IsPropertyChained(prop, cmProperty::SOURCE_FILE);
+ if (chain)
+ {
+ return mf->GetProperty(prop, chain);
+ }
}
return retVal;
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index f898260..1433b54 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -107,8 +107,9 @@ private:
std::string Extension;
std::string Language;
std::string FullPath;
- bool FindFullPathFailed;
std::string ObjectLibrary;
+ std::vector<std::string> Depends;
+ bool FindFullPathFailed;
bool IsUiFile;
bool FindFullPath(std::string* error);
@@ -116,7 +117,6 @@ private:
void CheckExtension();
void CheckLanguage(std::string const& ext);
- std::vector<std::string> Depends;
static const std::string propLANGUAGE;
};
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 58885d3..d918f65 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -18,6 +18,34 @@
#include <assert.h>
+struct cmState::SnapshotDataType
+{
+ cmState::PositionType CallStackParent;
+ cmState::PositionType DirectoryParent;
+ cmState::SnapshotType SnapshotType;
+ cmLinkedTree<std::string>::iterator ExecutionListFile;
+ cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
+ BuildSystemDirectory;
+ std::string EntryPointCommand;
+ long EntryPointLine;
+};
+
+struct cmState::BuildsystemDirectoryStateType
+{
+ std::string Location;
+ std::string OutputLocation;
+
+ std::vector<std::string> CurrentSourceDirectoryComponents;
+ std::vector<std::string> CurrentBinaryDirectoryComponents;
+ // The top-most directories for relative path conversion. Both the
+ // source and destination location of a relative path conversion
+ // must be underneath one of these directories (both under source or
+ // both under binary) in order for the relative path to be evaluated
+ // safely by the build tools.
+ std::string RelativePathTopSource;
+ std::string RelativePathTopBinary;
+};
+
cmState::cmState(cmake* cm)
: CMakeInstance(cm),
IsInTryCompile(false),
@@ -195,34 +223,14 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0);
}
-void cmState::Reset()
+cmState::Snapshot cmState::Reset()
{
this->GlobalProperties.clear();
this->PropertyDefinitions.clear();
- assert(this->Locations.size() > 0);
- assert(this->OutputLocations.size() > 0);
- assert(this->ParentPositions.size() > 0);
- assert(this->CurrentSourceDirectoryComponents.size() > 0);
- assert(this->CurrentBinaryDirectoryComponents.size() > 0);
- assert(this->RelativePathTopSource.size() > 0);
- assert(this->RelativePathTopBinary.size() > 0);
-
- this->Locations.erase(this->Locations.begin() + 1, this->Locations.end());
- this->OutputLocations.erase(this->OutputLocations.begin() + 1,
- this->OutputLocations.end());
- this->ParentPositions.erase(this->ParentPositions.begin() + 1,
- this->ParentPositions.end());
- this->CurrentSourceDirectoryComponents.erase(
- this->CurrentSourceDirectoryComponents.begin() + 1,
- this->CurrentSourceDirectoryComponents.end());
- this->CurrentBinaryDirectoryComponents.erase(
- this->CurrentBinaryDirectoryComponents.begin() + 1,
- this->CurrentBinaryDirectoryComponents.end());
- this->RelativePathTopSource.erase(this->RelativePathTopSource.begin() + 1,
- this->RelativePathTopSource.end());
- this->RelativePathTopBinary.erase(this->RelativePathTopBinary.begin() + 1,
- this->RelativePathTopBinary.end());
+ this->BuildsystemDirectory.Truncate();
+ PositionType pos = this->SnapshotData.Truncate();
+ this->ExecutionListFiles.Truncate();
this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
@@ -243,6 +251,8 @@ void cmState::Reset()
this->DefineProperty
("RULE_LAUNCH_CUSTOM", cmProperty::TARGET,
"", "", true);
+
+ return Snapshot(this, pos);
}
void cmState::DefineProperty(const std::string& name,
@@ -256,27 +266,41 @@ void cmState::DefineProperty(const std::string& name,
chained);
}
-cmPropertyDefinition *cmState
+cmPropertyDefinition const* cmState
::GetPropertyDefinition(const std::string& name,
- cmProperty::ScopeType scope)
+ cmProperty::ScopeType scope) const
{
if (this->IsPropertyDefined(name,scope))
{
- return &(this->PropertyDefinitions[scope][name]);
+ cmPropertyDefinitionMap const& defs =
+ this->PropertyDefinitions.find(scope)->second;
+ return &defs.find(name)->second;
}
return 0;
}
bool cmState::IsPropertyDefined(const std::string& name,
- cmProperty::ScopeType scope)
+ cmProperty::ScopeType scope) const
{
- return this->PropertyDefinitions[scope].IsPropertyDefined(name);
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it
+ = this->PropertyDefinitions.find(scope);
+ if (it == this->PropertyDefinitions.end())
+ {
+ return false;
+ }
+ return it->second.IsPropertyDefined(name);
}
bool cmState::IsPropertyChained(const std::string& name,
- cmProperty::ScopeType scope)
+ cmProperty::ScopeType scope) const
{
- return this->PropertyDefinitions[scope].IsPropertyChained(name);
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it
+ = this->PropertyDefinitions.find(scope);
+ if (it == this->PropertyDefinitions.end())
+ {
+ return false;
+ }
+ return it->second.IsPropertyChained(name);
}
void cmState::SetLanguageEnabled(std::string const& l)
@@ -424,14 +448,13 @@ void cmState::RemoveUserDefinedCommands()
void cmState::SetGlobalProperty(const std::string& prop, const char* value)
{
- this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL);
+ this->GlobalProperties.SetProperty(prop, value);
}
void cmState::AppendGlobalProperty(const std::string& prop,
const char* value, bool asString)
{
- this->GlobalProperties.AppendProperty(prop, value,
- cmProperty::GLOBAL, asString);
+ this->GlobalProperties.AppendProperty(prop, value, asString);
}
const char *cmState::GetGlobalProperty(const std::string& prop)
@@ -469,9 +492,7 @@ const char *cmState::GetGlobalProperty(const std::string& prop)
return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1;
}
#undef STRING_LIST_ELEMENT
- bool dummy = false;
- return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL,
- dummy);
+ return this->GlobalProperties.GetPropertyValue(prop);
}
bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
@@ -590,7 +611,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource()
snapshots.push_back(snapshot);
while (true)
{
- snapshot = snapshot.GetParent();
+ snapshot = snapshot.GetBuildsystemDirectoryParent();
if (snapshot.IsValid())
{
snapshots.push_back(snapshot);
@@ -612,7 +633,7 @@ void cmState::Snapshot::ComputeRelativePathTopSource()
result = currentSource;
}
}
- this->State->RelativePathTopSource[this->Position] = result;
+ this->Position->BuildSystemDirectory->RelativePathTopSource = result;
}
void cmState::Snapshot::ComputeRelativePathTopBinary()
@@ -622,7 +643,7 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
snapshots.push_back(snapshot);
while (true)
{
- snapshot = snapshot.GetParent();
+ snapshot = snapshot.GetBuildsystemDirectoryParent();
if (snapshot.IsValid())
{
snapshots.push_back(snapshot);
@@ -651,31 +672,126 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
// is a network path.
if(result.size() < 2 || result.substr(0, 2) != "//")
{
- this->State->RelativePathTopBinary[this->Position] = result;
+ this->Position->BuildSystemDirectory->RelativePathTopBinary = result;
}
else
{
- this->State->RelativePathTopBinary[this->Position] = "";
+ this->Position->BuildSystemDirectory->RelativePathTopBinary = "";
}
}
-cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
+cmState::Snapshot cmState::CreateBaseSnapshot()
+{
+ PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root());
+ pos->DirectoryParent = this->SnapshotData.Root();
+ pos->SnapshotType = BuildsystemDirectoryType;
+ pos->BuildSystemDirectory =
+ this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
+ pos->ExecutionListFile =
+ this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
+ return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
+cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine)
+{
+ assert(originSnapshot.IsValid());
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position);
+ pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
+ pos->DirectoryParent = originSnapshot.Position;
+ pos->SnapshotType = BuildsystemDirectoryType;
+ pos->BuildSystemDirectory =
+ this->BuildsystemDirectory.Extend(
+ originSnapshot.Position->BuildSystemDirectory);
+ pos->ExecutionListFile =
+ this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile);
+ return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
+cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName)
+{
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+ *originSnapshot.Position);
+ pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
+ pos->SnapshotType = FunctionCallType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
+ return cmState::Snapshot(this, pos);
+}
+
+
+cmState::Snapshot
+cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName)
{
- if (!originSnapshot.IsValid())
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+ *originSnapshot.Position);
+ pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
+ pos->SnapshotType = MacroCallType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
+ return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
+cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
+ const std::string& entryPointCommand,
+ long entryPointLine,
+ const std::string& fileName)
+{
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+ *originSnapshot.Position);
+ pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
+ pos->SnapshotType = CallStackType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
+ return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
+cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
+ const std::string& entryPointCommand,
+ long entryPointLine,
+ const std::string& fileName)
+{
+ PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+ *originSnapshot.Position);
+ pos->CallStackParent = originSnapshot.Position;
+ pos->EntryPointLine = entryPointLine;
+ pos->EntryPointCommand = entryPointCommand;
+ pos->SnapshotType = InlineListFileType;
+ pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+ originSnapshot.Position->ExecutionListFile, fileName);
+ return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
+{
+ PositionType pos = originSnapshot.Position;
+ PositionType prevPos = pos;
+ ++prevPos;
+ if (prevPos == this->SnapshotData.Root())
{
- originSnapshot.State = this;
+ return Snapshot(this, prevPos);
}
- PositionType pos = this->ParentPositions.size();
- this->ParentPositions.push_back(originSnapshot.Position);
- this->Locations.resize(this->Locations.size() + 1);
- this->OutputLocations.resize(this->OutputLocations.size() + 1);
- this->CurrentSourceDirectoryComponents.resize(
- this->CurrentSourceDirectoryComponents.size() + 1);
- this->CurrentBinaryDirectoryComponents.resize(
- this->CurrentBinaryDirectoryComponents.size() + 1);
- this->RelativePathTopSource.resize(this->RelativePathTopSource.size() + 1);
- this->RelativePathTopBinary.resize(this->RelativePathTopBinary.size() + 1);
- return cmState::Snapshot(this, pos);
+ return Snapshot(this, originSnapshot.Position->CallStackParent);
}
cmState::Snapshot::Snapshot(cmState* state, PositionType position)
@@ -687,92 +803,141 @@ cmState::Snapshot::Snapshot(cmState* state, PositionType position)
const char* cmState::Snapshot::GetCurrentSourceDirectory() const
{
- return this->State->Locations[this->Position].c_str();
+ return this->Position->BuildSystemDirectory->Location.c_str();
}
void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir)
{
assert(this->State);
- assert(this->State->Locations.size() > this->Position);
- this->State->Locations[this->Position] = dir;
- cmSystemTools::ConvertToUnixSlashes(
- this->State->Locations[this->Position]);
- this->State->Locations[this->Position] =
- cmSystemTools::CollapseFullPath(this->State->Locations[this->Position]);
+ std::string& loc = this->Position->BuildSystemDirectory->Location;
+ loc = dir;
+ cmSystemTools::ConvertToUnixSlashes(loc);
+ loc = cmSystemTools::CollapseFullPath(loc);
cmSystemTools::SplitPath(
- this->State->Locations[this->Position],
- this->State->CurrentSourceDirectoryComponents[this->Position]);
+ loc,
+ this->Position->BuildSystemDirectory->CurrentSourceDirectoryComponents);
this->ComputeRelativePathTopSource();
}
const char* cmState::Snapshot::GetCurrentBinaryDirectory() const
{
- return this->State->OutputLocations[this->Position].c_str();
+ return this->Position->BuildSystemDirectory->OutputLocation.c_str();
}
void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
{
- assert(this->State->OutputLocations.size() > this->Position);
- this->State->OutputLocations[this->Position] = dir;
- cmSystemTools::ConvertToUnixSlashes(
- this->State->OutputLocations[this->Position]);
- this->State->OutputLocations[this->Position] =
- cmSystemTools::CollapseFullPath(
- this->State->OutputLocations[this->Position]);
+ std::string& loc = this->Position->BuildSystemDirectory->OutputLocation;
+ loc = dir;
+ cmSystemTools::ConvertToUnixSlashes(loc);
+ loc = cmSystemTools::CollapseFullPath(loc);
cmSystemTools::SplitPath(
- this->State->OutputLocations[this->Position],
- this->State->CurrentBinaryDirectoryComponents[this->Position]);
+ loc,
+ this->Position->BuildSystemDirectory->CurrentBinaryDirectoryComponents);
this->ComputeRelativePathTopBinary();
}
+void cmState::Snapshot::SetListFile(const std::string& listfile)
+{
+ *this->Position->ExecutionListFile = listfile;
+}
+
std::vector<std::string> const&
-cmState::Snapshot::GetCurrentSourceDirectoryComponents()
+cmState::Snapshot::GetCurrentSourceDirectoryComponents() const
{
- return this->State->CurrentSourceDirectoryComponents[this->Position];
+ return this->Position->BuildSystemDirectory
+ ->CurrentSourceDirectoryComponents;
}
std::vector<std::string> const&
-cmState::Snapshot::GetCurrentBinaryDirectoryComponents()
+cmState::Snapshot::GetCurrentBinaryDirectoryComponents() const
{
- return this->State->CurrentBinaryDirectoryComponents[this->Position];
+ return this->Position->BuildSystemDirectory
+ ->CurrentBinaryDirectoryComponents;
}
const char* cmState::Snapshot::GetRelativePathTopSource() const
{
- return this->State->RelativePathTopSource[this->Position].c_str();
+ return this->Position->BuildSystemDirectory->RelativePathTopSource.c_str();
}
const char* cmState::Snapshot::GetRelativePathTopBinary() const
{
- return this->State->RelativePathTopBinary[this->Position].c_str();
+ return this->Position->BuildSystemDirectory->RelativePathTopBinary.c_str();
}
void cmState::Snapshot::SetRelativePathTopSource(const char* dir)
{
- this->State->RelativePathTopSource[this->Position] = dir;
+ this->Position->BuildSystemDirectory->RelativePathTopSource = dir;
}
void cmState::Snapshot::SetRelativePathTopBinary(const char* dir)
{
- this->State->RelativePathTopBinary[this->Position] = dir;
+ this->Position->BuildSystemDirectory->RelativePathTopBinary = dir;
+}
+
+std::string cmState::Snapshot::GetExecutionListFile() const
+{
+ return *this->Position->ExecutionListFile;
+}
+
+std::string cmState::Snapshot::GetEntryPointCommand() const
+{
+ return this->Position->EntryPointCommand;
+}
+
+long cmState::Snapshot::GetEntryPointLine() const
+{
+ return this->Position->EntryPointLine;
}
bool cmState::Snapshot::IsValid() const
{
- return this->State ? true : false;
+ return this->State && this->Position.IsValid()
+ ? this->Position != this->State->SnapshotData.Root()
+ : false;
}
-cmState::Snapshot cmState::Snapshot::GetParent() const
+cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const
{
Snapshot snapshot;
- if (!this->State || this->Position == 0)
+ if (!this->State || this->Position == this->State->SnapshotData.Root())
{
return snapshot;
}
- PositionType parentPos = this->State->ParentPositions[this->Position];
- snapshot = Snapshot(this->State, parentPos);
+ PositionType parentPos = this->Position->DirectoryParent;
+ if (parentPos != this->State->SnapshotData.Root())
+ {
+ snapshot = Snapshot(this->State, parentPos);
+ }
return snapshot;
}
+
+cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
+{
+ assert(this->State);
+ assert(this->Position != this->State->SnapshotData.Root());
+
+ Snapshot snapshot;
+ if (this->Position->SnapshotType == cmState::BuildsystemDirectoryType)
+ {
+ return snapshot;
+ }
+
+ PositionType parentPos = this->Position;
+ ++parentPos;
+ if (parentPos == this->State->SnapshotData.Root())
+ {
+ return snapshot;
+ }
+
+ snapshot = Snapshot(this->State, parentPos);
+ return snapshot;
+}
+
+cmState* cmState::Snapshot::GetState() const
+{
+ return this->State;
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index 77a066f..473a194 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -15,37 +15,59 @@
#include "cmStandardIncludes.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
+#include "cmLinkedTree.h"
class cmake;
class cmCommand;
class cmState
{
- typedef std::vector<std::string>::size_type PositionType;
+ struct SnapshotDataType;
+ typedef cmLinkedTree<SnapshotDataType>::iterator PositionType;
friend class Snapshot;
public:
cmState(cmake* cm);
~cmState();
+ enum SnapshotType
+ {
+ BuildsystemDirectoryType,
+ FunctionCallType,
+ MacroCallType,
+ CallStackType,
+ InlineListFileType
+ };
+
class Snapshot {
public:
- Snapshot(cmState* state = 0, PositionType position = 0);
+ Snapshot(cmState* state = 0, PositionType position = PositionType());
const char* GetCurrentSourceDirectory() const;
void SetCurrentSourceDirectory(std::string const& dir);
const char* GetCurrentBinaryDirectory() const;
void SetCurrentBinaryDirectory(std::string const& dir);
- std::vector<std::string> const& GetCurrentSourceDirectoryComponents();
- std::vector<std::string> const& GetCurrentBinaryDirectoryComponents();
+ void SetListFile(std::string const& listfile);
+
+ std::vector<std::string> const&
+ GetCurrentSourceDirectoryComponents() const;
+ std::vector<std::string> const&
+ GetCurrentBinaryDirectoryComponents() const;
const char* GetRelativePathTopSource() const;
const char* GetRelativePathTopBinary() const;
void SetRelativePathTopSource(const char* dir);
void SetRelativePathTopBinary(const char* dir);
+ std::string GetExecutionListFile() const;
+ std::string GetEntryPointCommand() const;
+ long GetEntryPointLine() const;
+
bool IsValid() const;
- Snapshot GetParent() const;
+ Snapshot GetBuildsystemDirectoryParent() const;
+ Snapshot GetCallStackParent() const;
+
+ cmState* GetState() const;
private:
void ComputeRelativePathTopSource();
@@ -57,7 +79,28 @@ public:
cmState::PositionType Position;
};
- Snapshot CreateSnapshot(Snapshot originSnapshot);
+ Snapshot CreateBaseSnapshot();
+ Snapshot
+ CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine);
+ Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName);
+ Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName);
+ Snapshot CreateCallStackSnapshot(Snapshot originSnapshot,
+ std::string const& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName);
+ Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot,
+ const std::string& entryPointCommand,
+ long entryPointLine,
+ std::string const& fileName);
+ Snapshot Pop(Snapshot originSnapshot);
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
UNINITIALIZED };
@@ -93,7 +136,7 @@ public:
void RemoveCacheEntryProperty(std::string const& key,
std::string const& propertyName);
- void Reset();
+ Snapshot Reset();
// Define a property
void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription,
@@ -101,12 +144,14 @@ public:
bool chain = false);
// get property definition
- cmPropertyDefinition *GetPropertyDefinition
- (const std::string& name, cmProperty::ScopeType scope);
+ cmPropertyDefinition const* GetPropertyDefinition
+ (const std::string& name, cmProperty::ScopeType scope) const;
// Is a property defined?
- bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope);
- bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope);
+ bool IsPropertyDefined(const std::string& name,
+ cmProperty::ScopeType scope) const;
+ bool IsPropertyChained(const std::string& name,
+ cmProperty::ScopeType scope) const;
void SetLanguageEnabled(std::string const& l);
bool GetLanguageEnabled(std::string const& l) const;
@@ -157,19 +202,13 @@ private:
std::map<std::string, cmCommand*> Commands;
cmPropertyMap GlobalProperties;
cmake* CMakeInstance;
- std::vector<std::string> Locations;
- std::vector<std::string> OutputLocations;
- std::vector<PositionType> ParentPositions;
-
- std::vector<std::vector<std::string> > CurrentSourceDirectoryComponents;
- std::vector<std::vector<std::string> > CurrentBinaryDirectoryComponents;
- // The top-most directories for relative path conversion. Both the
- // source and destination location of a relative path conversion
- // must be underneath one of these directories (both under source or
- // both under binary) in order for the relative path to be evaluated
- // safely by the build tools.
- std::vector<std::string> RelativePathTopSource;
- std::vector<std::string> RelativePathTopBinary;
+
+ struct BuildsystemDirectoryStateType;
+ cmLinkedTree<BuildsystemDirectoryStateType> BuildsystemDirectory;
+
+ cmLinkedTree<std::string> ExecutionListFiles;
+
+ cmLinkedTree<SnapshotDataType> SnapshotData;
std::vector<std::string> SourceDirectoryComponents;
std::vector<std::string> BinaryDirectoryComponents;
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index edc6afc..efc1f16 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -74,6 +74,10 @@ bool cmStringCommand
{
return this->HandleLengthCommand(args);
}
+ else if(subCommand == "APPEND")
+ {
+ return this->HandleAppendCommand(args);
+ }
else if(subCommand == "CONCAT")
{
return this->HandleConcatCommand(args);
@@ -730,6 +734,34 @@ bool cmStringCommand
}
//----------------------------------------------------------------------------
+bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args)
+{
+ if(args.size() < 2)
+ {
+ this->SetError("sub-command APPEND requires at least one argument.");
+ return false;
+ }
+
+ // Skip if nothing to append.
+ if(args.size() < 3)
+ {
+ return true;
+ }
+
+ const std::string& variable = args[1];
+
+ std::string value;
+ const char* oldValue = this->Makefile->GetDefinition(variable);
+ if(oldValue)
+ {
+ value = oldValue;
+ }
+ value += cmJoin(cmRange(args).advance(2), std::string());
+ this->Makefile->AddDefinition(variable, value.c_str());
+ return true;
+}
+
+//----------------------------------------------------------------------------
bool cmStringCommand
::HandleConcatCommand(std::vector<std::string> const& args)
{
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 9c75095..3ed17eb 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -67,6 +67,7 @@ protected:
bool HandleReplaceCommand(std::vector<std::string> const& args);
bool HandleLengthCommand(std::vector<std::string> const& args);
bool HandleSubstringCommand(std::vector<std::string> const& args);
+ bool HandleAppendCommand(std::vector<std::string> const& args);
bool HandleConcatCommand(std::vector<std::string> const& args);
bool HandleStripCommand(std::vector<std::string> const& args);
bool HandleRandomCommand(std::vector<std::string> const& args);
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index e2adabe..2543e68 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -556,25 +556,6 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
argv.Store(args);
}
-std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg,
- int shell_flags)
-{
- char local_buffer[1024];
- char* buffer = local_buffer;
- int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags);
- if(size > 1024)
- {
- buffer = new char[size];
- }
- cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags);
- std::string result(buffer);
- if(buffer != local_buffer)
- {
- delete [] buffer;
- }
- return result;
-}
-
std::vector<std::string> cmSystemTools::ParseArguments(const char* command)
{
std::vector<std::string> args;
@@ -2955,3 +2936,12 @@ bool cmSystemTools::StringToLong(const char* str, long* value)
*value = strtol(str, &endp, 10);
return (*endp == '\0') && (endp != str) && (errno == 0);
}
+
+//----------------------------------------------------------------------------
+bool cmSystemTools::StringToULong(const char* str, unsigned long* value)
+{
+ errno = 0;
+ char *endp;
+ *value = strtoul(str, &endp, 10);
+ return (*endp == '\0') && (endp != str) && (errno == 0);
+}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 6feb6c5..fb58307 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -256,11 +256,6 @@ public:
static void ParseUnixCommandLine(const char* command,
std::vector<std::string>& args);
- /** Compute an escaped version of the given argument for use in a
- windows shell. See kwsys/System.h.in for details. */
- static std::string EscapeWindowsShellArgument(const char* arg,
- int shell_flags);
-
static void EnableMessages() { s_DisableMessages = false; }
static void DisableMessages() { s_DisableMessages = true; }
static void DisableRunCommandOutput() {s_DisableRunCommandOutput = true; }
@@ -469,6 +464,7 @@ public:
/** Convert string to long. Expected that the whole string is an integer */
static bool StringToLong(const char* str, long* value);
+ static bool StringToULong(const char* str, unsigned long* value);
#ifdef _WIN32
struct WindowsFileRetry
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 70005b4..2b73e6f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -13,7 +13,7 @@
#include "cmake.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmGlobalGenerator.h"
#include "cmComputeLinkInformation.h"
#include "cmListFileCache.h"
@@ -94,13 +94,13 @@ class cmTargetInternals
{
public:
cmTargetInternals()
- : Backtrace(NULL)
+ : Backtrace()
{
this->PolicyWarnedCMP0022 = false;
this->UtilityItemsDone = false;
}
cmTargetInternals(cmTargetInternals const&)
- : Backtrace(NULL)
+ : Backtrace()
{
this->PolicyWarnedCMP0022 = false;
this->UtilityItemsDone = false;
@@ -239,13 +239,6 @@ cmTargetInternals::~cmTargetInternals()
//----------------------------------------------------------------------------
cmTarget::cmTarget()
{
-#define INITIALIZE_TARGET_POLICY_MEMBER(POLICY) \
- this->PolicyStatus ## POLICY = cmPolicies::WARN;
-
- CM_FOR_EACH_TARGET_POLICY(INITIALIZE_TARGET_POLICY_MEMBER)
-
-#undef INITIALIZE_TARGET_POLICY_MEMBER
-
this->Makefile = 0;
#if defined(_WIN32) && !defined(__CYGWIN__)
this->LinkLibrariesForVS6Analyzed = false;
@@ -286,9 +279,6 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Set our makefile.
this->Makefile = mf;
- // set the cmake instance of the properties
- this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
-
// Check whether this is a DLL platform.
this->DLLPlatform = (this->Makefile->IsOn("WIN32") ||
this->Makefile->IsOn("CYGWIN") ||
@@ -333,10 +323,12 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("MACOSX_BUNDLE", 0);
this->SetPropertyDefault("MACOSX_RPATH", 0);
this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
+ this->SetPropertyDefault("C_COMPILER_LAUNCHER", 0);
this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", 0);
this->SetPropertyDefault("C_STANDARD", 0);
this->SetPropertyDefault("C_STANDARD_REQUIRED", 0);
this->SetPropertyDefault("C_EXTENSIONS", 0);
+ this->SetPropertyDefault("CXX_COMPILER_LAUNCHER", 0);
this->SetPropertyDefault("CXX_INCLUDE_WHAT_YOU_USE", 0);
this->SetPropertyDefault("CXX_STANDARD", 0);
this->SetPropertyDefault("CXX_STANDARD_REQUIRED", 0);
@@ -437,26 +429,25 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
}
+ if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY)
+ {
+ this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", 0);
+ }
+
if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
{
this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
}
// Record current policies for later use.
-#define CAPTURE_TARGET_POLICY(POLICY) \
- this->PolicyStatus ## POLICY = \
- this->Makefile->GetPolicyStatus(cmPolicies::POLICY);
-
- CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY)
-
-#undef CAPTURE_TARGET_POLICY
+ this->Makefile->RecordPolicies(this->PolicyMap);
if (this->TargetTypeValue == INTERFACE_LIBRARY)
{
// This policy is checked in a few conditions. The properties relevant
// to the policy are always ignored for INTERFACE_LIBRARY targets,
// so ensure that the conditions don't lead to nonsense.
- this->PolicyStatusCMP0022 = cmPolicies::NEW;
+ this->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW);
}
if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
@@ -764,7 +755,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
"SOURCES")
!= debugProperties.end();
- if (this->Makefile->IsGeneratingBuildSystem())
+ if (this->Makefile->IsConfigured())
{
this->DebugSourcesDone = true;
}
@@ -1231,7 +1222,8 @@ static std::string targetNameGenex(const std::string& lib)
}
//----------------------------------------------------------------------------
-bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
+bool cmTarget::PushTLLCommandTrace(TLLSignature signature,
+ cmListFileContext const& lfc)
{
bool ret = true;
if (!this->TLLCommands.empty())
@@ -1241,7 +1233,6 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
ret = false;
}
}
- cmListFileContext lfc = this->Makefile->GetExecutionContext();
if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc)
{
this->TLLCommands.push_back(std::make_pair(signature, lfc));
@@ -1257,14 +1248,14 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s,
: "plain");
s << "The uses of the " << sigString << " signature are here:\n";
typedef std::vector<std::pair<TLLSignature, cmListFileContext> > Container;
- cmLocalGenerator* lg = this->GetMakefile()->GetLocalGenerator();
+ cmOutputConverter converter(this->GetMakefile()->GetStateSnapshot());
for(Container::const_iterator it = this->TLLCommands.begin();
it != this->TLLCommands.end(); ++it)
{
if (it->first == sig)
{
cmListFileContext lfc = it->second;
- lfc.FilePath = lg->Convert(lfc.FilePath, cmLocalGenerator::HOME);
+ lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
s << " * " << lfc << std::endl;
}
}
@@ -1748,9 +1739,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
else if (prop == "LINK_LIBRARIES")
{
this->Internal->LinkImplementationPropertyEntries.clear();
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+ if (value)
+ {
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+ }
}
else if (prop == "SOURCES")
{
@@ -1772,7 +1766,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
}
else
{
- this->Properties.SetProperty(prop, value, cmProperty::TARGET);
+ this->Properties.SetProperty(prop, value);
this->MaybeInvalidatePropertyCache(prop);
}
}
@@ -1834,9 +1828,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else if (prop == "LINK_LIBRARIES")
{
- cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+ if (value)
+ {
+ cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkImplementationPropertyEntries.push_back(entry);
+ }
}
else if (prop == "SOURCES")
{
@@ -1857,7 +1854,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
else
{
- this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
+ this->Properties.AppendProperty(prop, value, asString);
this->MaybeInvalidatePropertyCache(prop);
}
}
@@ -2106,7 +2103,7 @@ cmTarget::GetIncludeDirectories(const std::string& config,
"INCLUDE_DIRECTORIES")
!= debugProperties.end();
- if (this->Makefile->IsGeneratingBuildSystem())
+ if (this->Makefile->IsConfigured())
{
this->DebugIncludesDone = true;
}
@@ -2277,7 +2274,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
"COMPILE_OPTIONS")
!= debugProperties.end();
- if (this->Makefile->IsGeneratingBuildSystem())
+ if (this->Makefile->IsConfigured())
{
this->DebugCompileOptionsDone = true;
}
@@ -2348,7 +2345,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
"COMPILE_DEFINITIONS")
!= debugProperties.end();
- if (this->Makefile->IsGeneratingBuildSystem())
+ if (this->Makefile->IsConfigured())
{
this->DebugCompileDefinitionsDone = true;
}
@@ -2449,7 +2446,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result,
"COMPILE_FEATURES")
!= debugProperties.end();
- if (this->Makefile->IsGeneratingBuildSystem())
+ if (this->Makefile->IsConfigured())
{
this->DebugCompileFeaturesDone = true;
}
@@ -2814,34 +2811,6 @@ void cmTarget::GetTargetVersion(bool soversion,
}
//----------------------------------------------------------------------------
-const char* cmTarget::GetFeature(const std::string& feature,
- const std::string& config) const
-{
- if(!config.empty())
- {
- std::string featureConfig = feature;
- featureConfig += "_";
- featureConfig += cmSystemTools::UpperCase(config);
- if(const char* value = this->GetProperty(featureConfig))
- {
- return value;
- }
- }
- if(const char* value = this->GetProperty(feature))
- {
- return value;
- }
- return this->Makefile->GetFeature(feature, config);
-}
-
-//----------------------------------------------------------------------------
-bool cmTarget::GetFeatureAsBool(const std::string& feature,
- const std::string& config) const
-{
- return cmSystemTools::IsOn(this->GetFeature(feature, config));
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{
if (this->IsImported())
@@ -2938,8 +2907,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
// cannot take into account the per-configuration name of the
// target because the configuration type may not be known at
// CMake time.
- this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild(),
- cmProperty::TARGET);
+ this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild());
}
// Support "LOCATION_<CONFIG>".
@@ -2950,9 +2918,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
return 0;
}
const char* configName = prop.c_str() + 9;
- this->Properties.SetProperty(prop,
- this->GetLocation(configName),
- cmProperty::TARGET);
+ this->Properties.SetProperty(prop, this->GetLocation(configName));
}
// Support "<CONFIG>_LOCATION".
else if(cmHasLiteralSuffix(prop, "_LOCATION"))
@@ -2964,9 +2930,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
{
return 0;
}
- this->Properties.SetProperty(prop,
- this->GetLocation(configName),
- cmProperty::TARGET);
+ this->Properties.SetProperty(prop, this->GetLocation(configName));
}
}
}
@@ -3168,17 +3132,19 @@ const char *cmTarget::GetProperty(const std::string& prop,
}
}
}
- this->Properties.SetProperty("SOURCES", ss.str().c_str(),
- cmProperty::TARGET);
+ this->Properties.SetProperty("SOURCES", ss.str().c_str());
}
}
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, cmProperty::TARGET, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal)
{
- return this->Makefile->GetProperty(prop, cmProperty::TARGET);
+ const bool chain = this->GetMakefile()->GetState()->
+ IsPropertyChained(prop, cmProperty::TARGET);
+ if (chain)
+ {
+ return this->Makefile->GetProperty(prop, chain);
+ }
}
return retVal;
}
@@ -4631,15 +4597,25 @@ std::string cmTarget::GetOutputName(const std::string& config,
// OUTPUT_NAME
props.push_back("OUTPUT_NAME");
+ std::string outName;
for(std::vector<std::string>::const_iterator i = props.begin();
i != props.end(); ++i)
{
- if(const char* outName = this->GetProperty(*i))
+ if (const char* outNameProp = this->GetProperty(*i))
{
- return outName;
+ outName = outNameProp;
+ break;
}
}
- return this->GetName();
+
+ if (outName.empty())
+ {
+ outName = this->GetName();
+ }
+
+ cmGeneratorExpression ge;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
+ return cge->Evaluate(this->Makefile, config);
}
//----------------------------------------------------------------------------
@@ -4857,7 +4833,7 @@ cmTarget::ReportPropertyOrigin(const std::string &p,
p)
!= debugProperties.end();
- if (this->Makefile->IsGeneratingBuildSystem())
+ if (this->Makefile->IsConfigured())
{
this->DebugCompatiblePropertiesDone[p] = true;
}
@@ -5931,8 +5907,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
// libraries and executables that export symbols.
const char* explicitLibraries = 0;
std::string linkIfaceProp;
- if(thisTarget->PolicyStatusCMP0022 != cmPolicies::OLD &&
- thisTarget->PolicyStatusCMP0022 != cmPolicies::WARN)
+ if(thisTarget->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
+ thisTarget->GetPolicyStatusCMP0022() != cmPolicies::WARN)
{
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
@@ -5958,7 +5934,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
}
if(explicitLibraries &&
- thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
+ thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022)
{
// Compare the explicitly set old link interface properties to the
@@ -6002,8 +5978,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
iface.Libraries,
iface.HadHeadSensitiveCondition);
}
- else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN
- || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
+ else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
// If CMP0022 is NEW then the plain tll signature sets the
// INTERFACE_LINK_LIBRARIES, so if we get here then the project
// cleared the property explicitly and we should not fall back
@@ -6014,7 +5990,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
iface.Libraries.insert(iface.Libraries.end(),
impl->Libraries.begin(), impl->Libraries.end());
- if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
+ if(thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022 && !usage_requirements_only)
{
// Compare the link implementation fallback link interface to the
@@ -6106,8 +6082,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
}
}
}
- else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN
- || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
+ else if (thisTarget->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD)
{
// The link implementation is the default link interface.
cmTarget::LinkImplementationLibraries const*
@@ -6427,7 +6403,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
if(lib != item)
{
cmake* cm = this->Makefile->GetCMakeInstance();
- switch(this->PolicyStatusCMP0004)
+ switch(this->GetPolicyStatusCMP0004())
{
case cmPolicies::WARN:
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 2150b83..1920312 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -66,7 +66,7 @@ public:
class cmLinkImplItem: public cmLinkItem
{
public:
- cmLinkImplItem(): cmLinkItem(), Backtrace(0), FromGenex(false) {}
+ cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {}
cmLinkImplItem(std::string const& n,
cmTarget const* t,
cmListFileBacktrace const& bt,
@@ -144,7 +144,7 @@ public:
#define DECLARE_TARGET_POLICY(POLICY) \
cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
- { return this->PolicyStatus ## POLICY; }
+ { return this->PolicyMap.Get(cmPolicies::POLICY); }
CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
@@ -207,7 +207,8 @@ public:
KeywordTLLSignature,
PlainTLLSignature
};
- bool PushTLLCommandTrace(TLLSignature signature);
+ bool PushTLLCommandTrace(TLLSignature signature,
+ cmListFileContext const& lfc);
void GetTllSignatureTraces(std::ostringstream &s, TLLSignature sig) const;
void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname,
@@ -260,11 +261,6 @@ public:
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
- const char* GetFeature(const std::string& feature,
- const std::string& config) const;
- bool GetFeatureAsBool(const std::string& feature,
- const std::string& config) const;
-
bool IsImported() const {return this->IsImportedTarget;}
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
@@ -642,12 +638,6 @@ public:
private:
bool HandleLocationPropertyPolicy(cmMakefile* context) const;
- // The set of include directories that are marked as system include
- // directories.
- std::set<std::string> SystemIncludeDirectories;
-
- std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
-
#if defined(_WIN32) && !defined(__CYGWIN__)
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
@@ -742,40 +732,48 @@ private:
void GetSourceFiles(std::vector<std::string> &files,
const std::string& config) const;
private:
+ mutable cmPropertyMap Properties;
+ std::set<std::string> SystemIncludeDirectories;
+ std::set<std::string> LinkDirectoriesEmmitted;
+ std::set<std::string> Utilities;
+ mutable std::set<std::string> LinkImplicitNullProperties;
+ std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
+ mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
+ mutable std::map<std::string, std::string> MaxLanguageStandards;
+ cmPolicies::PolicyMap PolicyMap;
std::string Name;
+ std::string InstallPath;
+ std::string RuntimeInstallPath;
+ mutable std::string ExportMacro;
+ std::vector<std::string> LinkDirectories;
std::vector<cmCustomCommand> PreBuildCommands;
std::vector<cmCustomCommand> PreLinkCommands;
std::vector<cmCustomCommand> PostBuildCommands;
- TargetType TargetTypeValue;
+ std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
LinkLibraryVectorType PrevLinkedLibraries;
+ LinkLibraryVectorType OriginalLinkLibraries;
#if defined(_WIN32) && !defined(__CYGWIN__)
LinkLibraryVectorType LinkLibrariesForVS6;
- bool LinkLibrariesForVS6Analyzed;
#endif
- std::vector<std::string> LinkDirectories;
- std::set<std::string> LinkDirectoriesEmmitted;
+ cmMakefile* Makefile;
+ cmTargetInternalPointer Internal;
+ TargetType TargetTypeValue;
bool HaveInstallRule;
- std::string InstallPath;
- std::string RuntimeInstallPath;
- mutable std::string ExportMacro;
- std::set<std::string> Utilities;
- std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
bool RecordDependencies;
- mutable cmPropertyMap Properties;
- LinkLibraryVectorType OriginalLinkLibraries;
bool DLLPlatform;
bool IsAndroid;
bool IsApple;
bool IsImportedTarget;
+ bool BuildInterfaceIncludesAppended;
mutable bool DebugIncludesDone;
- mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
mutable bool DebugCompileOptionsDone;
mutable bool DebugCompileDefinitionsDone;
mutable bool DebugSourcesDone;
mutable bool DebugCompileFeaturesDone;
- mutable std::set<std::string> LinkImplicitNullProperties;
- mutable std::map<std::string, std::string> MaxLanguageStandards;
- bool BuildInterfaceIncludesAppended;
+ mutable bool LinkImplementationLanguageIsContextDependent;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ bool LinkLibrariesForVS6Analyzed;
+#endif
// Cache target output paths for each configuration.
struct OutputInfo;
@@ -825,23 +823,10 @@ private:
void ProcessSourceExpression(std::string const& expr);
- // The cmMakefile instance that owns this target. This should
- // always be set.
- cmMakefile* Makefile;
-
- // Policy status recorded when target was created.
-#define TARGET_POLICY_MEMBER(POLICY) \
- cmPolicies::PolicyStatus PolicyStatus ## POLICY;
-
- CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER)
-
-#undef TARGET_POLICY_MEMBER
-
// Internal representation details.
friend class cmTargetInternals;
friend class cmGeneratorTarget;
friend class cmTargetTraceDependencies;
- cmTargetInternalPointer Internal;
void ComputeVersionedName(std::string& vName,
std::string const& prefix,
@@ -849,8 +834,6 @@ private:
std::string const& suffix,
std::string const& name,
const char* version) const;
-
- mutable bool LinkImplementationLanguageIsContextDependent;
};
#ifdef CMAKE_BUILD_WITH_CMAKE
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
index 1feb072..c5059ee 100644
--- a/Source/cmTargetDepend.h
+++ b/Source/cmTargetDepend.h
@@ -14,23 +14,24 @@
#include "cmStandardIncludes.h"
-class cmTarget;
+class cmGeneratorTarget;
/** One edge in the global target dependency graph.
It may be marked as a 'link' or 'util' edge or both. */
class cmTargetDepend
{
- cmTarget const* Target;
+ cmGeneratorTarget 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 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; }
+ cmTargetDepend(cmGeneratorTarget const* t)
+ : Target(t), Link(false), Util(false) {}
+ operator cmGeneratorTarget const*() const { return this->Target; }
+ cmGeneratorTarget const* operator->() const { return this->Target; }
+ cmGeneratorTarget 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/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index df37d66..b57b921 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -368,7 +368,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
|| this->CurrentProcessingState == ProcessingKeywordPublicInterface
|| this->CurrentProcessingState == ProcessingKeywordLinkInterface)
? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature;
- if (!this->Target->PushTLLCommandTrace(sig))
+ if (!this->Target->PushTLLCommandTrace(
+ sig, this->Makefile->GetExecutionContext()))
{
std::ostringstream e;
const char *modal = 0;
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index ff5d411..6fcd0dc 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -21,7 +21,6 @@ cmTest::cmTest(cmMakefile* mf)
{
this->Makefile = mf;
this->OldStyle = true;
- this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
}
//----------------------------------------------------------------------------
@@ -50,12 +49,15 @@ void cmTest::SetCommand(std::vector<std::string> const& command)
//----------------------------------------------------------------------------
const char *cmTest::GetProperty(const std::string& prop) const
{
- bool chain = false;
- const char *retVal =
- this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain);
- if (chain)
+ const char *retVal = this->Properties.GetPropertyValue(prop);
+ if (!retVal)
{
- return this->Makefile->GetProperty(prop,cmProperty::TEST);
+ const bool chain = this->Makefile->GetState()->
+ IsPropertyChained(prop, cmProperty::TEST);
+ if (chain)
+ {
+ return this->Makefile->GetProperty(prop, chain);
+ }
}
return retVal;
}
@@ -69,12 +71,12 @@ bool cmTest::GetPropertyAsBool(const std::string& prop) const
//----------------------------------------------------------------------------
void cmTest::SetProperty(const std::string& prop, const char* value)
{
- this->Properties.SetProperty(prop, value, cmProperty::TEST);
+ this->Properties.SetProperty(prop, value);
}
//----------------------------------------------------------------------------
void cmTest::AppendProperty(const std::string& prop,
const char* value, bool asString)
{
- this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
+ this->Properties.AppendProperty(prop, value, asString);
}
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 7e11d8c..546ad71 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -12,7 +12,7 @@
#include "cmTestGenerator.h"
#include "cmGeneratorExpression.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -97,13 +97,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
std::string emulatorExe(emulatorWithArgs[0]);
cmSystemTools::ConvertToUnixSlashes(emulatorExe);
- os << cmLocalGenerator::EscapeForCMake(emulatorExe) << " ";
+ os << cmOutputConverter::EscapeForCMake(emulatorExe) << " ";
for(std::vector<std::string>::const_iterator ei =
emulatorWithArgs.begin()+1;
ei != emulatorWithArgs.end();
++ei)
{
- os << cmLocalGenerator::EscapeForCMake(*ei) << " ";
+ os << cmOutputConverter::EscapeForCMake(*ei) << " ";
}
}
}
@@ -115,11 +115,11 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
}
// Generate the command line with full escapes.
- os << cmLocalGenerator::EscapeForCMake(exe);
+ os << cmOutputConverter::EscapeForCMake(exe);
for(std::vector<std::string>::const_iterator ci = command.begin()+1;
ci != command.end(); ++ci)
{
- os << " " << cmLocalGenerator::EscapeForCMake(
+ os << " " << cmOutputConverter::EscapeForCMake(
ge.Parse(*ci)->Evaluate(mf, config));
}
@@ -136,7 +136,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
i != pm.end(); ++i)
{
os << " " << i->first
- << " " << cmLocalGenerator::EscapeForCMake(
+ << " " << cmOutputConverter::EscapeForCMake(
ge.Parse(i->second.GetValue())->Evaluate(mf, config));
}
os << ")" << std::endl;
@@ -206,7 +206,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
i != pm.end(); ++i)
{
fout << " " << i->first
- << " " << cmLocalGenerator::EscapeForCMake(i->second.GetValue());
+ << " " << cmOutputConverter::EscapeForCMake(i->second.GetValue());
}
fout << ")" << std::endl;
}
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 9473008..98a397c 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -49,30 +49,26 @@ static void cmVariableWatchCommandVariableAccessed(
newLFF.Arguments.clear();
newLFF.Arguments.push_back(
cmListFileArgument(variable, cmListFileArgument::Quoted,
- "unknown", 9999));
+ 9999));
newLFF.Arguments.push_back(
cmListFileArgument(accessString, cmListFileArgument::Quoted,
- "unknown", 9999));
+ 9999));
newLFF.Arguments.push_back(
cmListFileArgument(newValue?newValue:"", cmListFileArgument::Quoted,
- "unknown", 9999));
+ 9999));
newLFF.Arguments.push_back(
cmListFileArgument(currentListFile, cmListFileArgument::Quoted,
- "unknown", 9999));
+ 9999));
newLFF.Arguments.push_back(
cmListFileArgument(stack, cmListFileArgument::Quoted,
- "unknown", 9999));
+ 9999));
newLFF.Name = data->Command;
- newLFF.FilePath = "Some weird path";
newLFF.Line = 9999;
cmExecutionStatus status;
if(!makefile->ExecuteCommand(newLFF,status))
{
- arg.FilePath = "Unknown";
- arg.Line = 0;
std::ostringstream error;
- error << "Error in cmake code at\n"
- << arg.FilePath << ":" << arg.Line << ":\n"
+ error << "Error in cmake code at\nUnknown:0:\n"
<< "A command failed during the invocation of callback \""
<< data->Command << "\".";
cmSystemTools::Error(error.str().c_str());
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5dfdb14..a2f9bca 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -176,9 +176,8 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->Makefile->GetConfigurations(this->Configurations);
this->LocalGenerator =
(cmLocalVisualStudio7Generator*)
- this->Makefile->GetLocalGenerator();
+ this->GeneratorTarget->GetLocalGenerator();
this->Name = this->Target->GetName();
- this->GlobalGenerator->CreateGUID(this->Name.c_str());
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName();
this->NsightTegra = gg->IsNsightTegra();
@@ -923,10 +922,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path,
return forceRelative
? cmSystemTools::RelativePath(
this->Makefile->GetCurrentBinaryDirectory(), path.c_str())
- : this->LocalGenerator->Convert(path.c_str(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED,
- /* optional = */ true);
+ : path.c_str();
}
void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)
@@ -1084,7 +1080,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
(*this->BuildFileStream) << name << "\">\n";
std::string guidName = "SG_Filter_";
guidName += name;
- this->GlobalGenerator->CreateGUID(guidName.c_str());
this->WriteString("<UniqueIdentifier>", 3);
std::string guid
= this->GlobalGenerator->GetGUID(guidName.c_str());
@@ -1099,7 +1094,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
this->WriteString("<Filter Include=\"Object Libraries\">\n", 2);
std::string guidName = "SG_Filter_Object Libraries";
- this->GlobalGenerator->CreateGUID(guidName.c_str());
this->WriteString("<UniqueIdentifier>", 3);
std::string guid =
this->GlobalGenerator->GetGUID(guidName.c_str());
@@ -1112,7 +1106,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
this->WriteString("<Filter Include=\"Resource Files\">\n", 2);
std::string guidName = "SG_Filter_Resource Files";
- this->GlobalGenerator->CreateGUID(guidName.c_str());
this->WriteString("<UniqueIdentifier>", 3);
std::string guid =
this->GlobalGenerator->GetGUID(guidName.c_str());
@@ -2473,6 +2466,15 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
"%(IgnoreSpecificDefaultLibraries)");
}
+ if (this->Target->GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def");
+ }
+ }
+
this->LinkOptions[config] = pOptions.release();
return true;
}
@@ -2620,8 +2622,25 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
void
cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
{
- this->WriteEvent("PreLinkEvent",
- this->Target->GetPreLinkCommands(), configName);
+ bool addedPrelink = false;
+ if (this->Target->GetType() == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ if (this->Target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
+ {
+ addedPrelink = true;
+ std::vector<cmCustomCommand> commands =
+ this->Target->GetPreLinkCommands();
+ this->GlobalGenerator->AddSymbolExportCommand(
+ this->GeneratorTarget, commands, configName);
+ this->WriteEvent("PreLinkEvent", commands, configName);
+ }
+ }
+ if (!addedPrelink)
+ {
+ this->WriteEvent("PreLinkEvent",
+ this->Target->GetPreLinkCommands(), configName);
+ }
this->WriteEvent("PreBuildEvent",
this->Target->GetPreBuildCommands(), configName);
this->WriteEvent("PostBuildEvent",
@@ -2667,7 +2686,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
{
cmGlobalGenerator::TargetDependSet const& unordered
- = this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
+ = this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget);
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
OrderedTargetDependSet;
OrderedTargetDependSet depends(unordered);
@@ -2675,7 +2694,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
- cmTarget const* dt = *i;
+ cmTarget const* dt = (*i)->Target;
if(dt->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 6512fc2..abd350e 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -1,6 +1,6 @@
#include "cmVisualStudioGeneratorOptions.h"
+#include "cmOutputConverter.h"
#include "cmSystemTools.h"
-#include <cmsys/System.h>
#include "cmVisualStudio10TargetGenerator.h"
static
@@ -246,10 +246,10 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag)
// This option is not known. Store it in the output flags.
this->FlagString += " ";
this->FlagString +=
- cmSystemTools::EscapeWindowsShellArgument(
+ cmOutputConverter::EscapeWindowsShellArgument(
flag,
- cmsysSystem_Shell_Flag_AllowMakeVariables |
- cmsysSystem_Shell_Flag_VSIDE);
+ cmOutputConverter::Shell_Flag_AllowMakeVariables |
+ cmOutputConverter::Shell_Flag_VSIDE);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 5170ead..012c580 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -12,6 +12,17 @@
#include "cmWhileCommand.h"
#include "cmConditionEvaluator.h"
+cmWhileFunctionBlocker::cmWhileFunctionBlocker(cmMakefile* mf):
+ Makefile(mf), Depth(0)
+{
+ this->Makefile->PushLoopBlock();
+}
+
+cmWhileFunctionBlocker::~cmWhileFunctionBlocker()
+{
+ this->Makefile->PopLoopBlock();
+}
+
bool cmWhileFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
cmExecutionStatus &inStatus)
@@ -27,8 +38,6 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
// if this is the endwhile for this while loop then execute
if (!this->Depth)
{
- cmMakefile::LoopBlockPop loopBlockPop(&mf);
-
// Remove the function blocker for this scope or bail.
cmsys::auto_ptr<cmFunctionBlocker>
fb(mf.RemoveFunctionBlocker(this, lff));
@@ -140,12 +149,10 @@ bool cmWhileCommand
}
// create a function blocker
- cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker();
+ cmWhileFunctionBlocker *f = new cmWhileFunctionBlocker(this->Makefile);
f->Args = args;
this->Makefile->AddFunctionBlocker(f);
- this->Makefile->PushLoopBlock();
-
return true;
}
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 9fafffc..85a0bd3 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -19,8 +19,8 @@
class cmWhileFunctionBlocker : public cmFunctionBlocker
{
public:
- cmWhileFunctionBlocker() {this->Depth=0;}
- virtual ~cmWhileFunctionBlocker() {}
+ cmWhileFunctionBlocker(cmMakefile* mf);
+ ~cmWhileFunctionBlocker();
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefile &mf,
cmExecutionStatus &);
@@ -29,6 +29,7 @@ public:
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;
private:
+ cmMakefile* Makefile;
int Depth;
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 23803ef..7bf3832 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -134,7 +134,7 @@ cmake::cmake()
this->Policies = new cmPolicies();
this->State = new cmState(this);
- this->CurrentSnapshot = this->State->CreateSnapshot(cmState::Snapshot());
+ this->CurrentSnapshot = this->State->CreateBaseSnapshot();
#ifdef __APPLE__
struct rlimit rlp;
@@ -186,7 +186,7 @@ cmake::~cmake()
void cmake::CleanupCommandsAndMacros()
{
- this->State->Reset();
+ this->CurrentSnapshot = this->State->Reset();
this->State->RemoveUserDefinedCommands();
}
@@ -370,6 +370,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
// read in the list file to fill the cache
if(path)
{
+ this->CurrentSnapshot = this->State->Reset();
std::string homeDir = this->GetHomeDirectory();
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
@@ -482,7 +483,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath;
std::string flags;
std::string linkFlags;
- gg->CreateGeneratorTargets(mf);
+ gg->CreateGeneratorTargets(lg.get());
cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt);
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
gtgt, false);
@@ -1437,33 +1438,6 @@ int cmake::ActualConfigure()
cmState::PATH);
}
}
- if(!this->State
- ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
- {
- this->State->AddCacheEntry
- ("CMAKE_USE_RELATIVE_PATHS", "OFF",
- "If true, cmake will use relative paths in makefiles and projects.",
- cmState::BOOL);
- if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
- "ADVANCED"))
- {
- this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
- "ADVANCED", "1");
- }
- }
-
- if(cmSystemTools::GetFatalErrorOccured())
- {
- const char* makeProgram =
- this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM");
- if (!makeProgram || cmSystemTools::IsOff(makeProgram))
- {
- // We must have a bad generator selection. Wipe the cache entry so the
- // user can select another.
- this->State->RemoveCacheEntry("CMAKE_GENERATOR");
- this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
- }
- }
cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
if (mf->IsOn("CTEST_USE_LAUNCHERS")
@@ -2519,7 +2493,6 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& bt)
{
cmListFileBacktrace backtrace = bt;
- backtrace.MakeRelative();
std::ostringstream msg;
if (!this->PrintMessagePreamble(t, msg))
diff --git a/Source/cmake.h b/Source/cmake.h
index 12b7e68..f0f9411 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -222,9 +222,6 @@ class cmake
///! this is called by generators to update the progress
void UpdateProgress(const char *msg, float prog);
- ///! get the cmake policies instance
- cmPolicies *GetPolicies() {return this->Policies;}
-
///! Get the variable watch object
cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
@@ -301,7 +298,7 @@ class cmake
/** Display a message to the user. */
void IssueMessage(cmake::MessageType t, std::string const& text,
- cmListFileBacktrace const& backtrace = cmListFileBacktrace(NULL));
+ cmListFileBacktrace const& backtrace = cmListFileBacktrace());
void IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileContext const& lfc);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index e5f4700..c94ffec 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -113,12 +113,7 @@ static cmMakefile* cmakemainGetMakefile(void *clientdata)
cmGlobalGenerator* gg=cm->GetGlobalGenerator();
if (gg)
{
- cmLocalGenerator* lg=gg->GetCurrentLocalGenerator();
- if (lg)
- {
- cmMakefile* mf = lg->GetMakefile();
- return mf;
- }
+ return gg->GetCurrentMakefile();
}
}
return 0;
@@ -425,7 +420,7 @@ static int do_build(int ac, char const* const* av)
switch (doing)
{
case DoingDir:
- dir = av[i];
+ dir = cmSystemTools::CollapseFullPath(av[i]);
doing = DoingNone;
break;
case DoingTarget:
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 3ea2186..63838b4 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -34,6 +34,10 @@
#include <time.h>
#include <stdlib.h> // required for atoi
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+// defined in binexplib.cxx
+bool DumpFile(const char* filename, FILE *fout);
+#endif
void CMakeCommandUsage(const char* program)
{
@@ -211,6 +215,41 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
return 0;
}
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+ else if(args[1] == "__create_def")
+ {
+ if(args.size() < 4)
+ {
+ std::cerr <<
+ "__create_def Usage: -E __create_def outfile.def objlistfile\n";
+ return 1;
+ }
+ FILE* fout = cmsys::SystemTools::Fopen(args[2].c_str(), "w+");
+ if(!fout)
+ {
+ std::cerr << "could not open output .def file: " << args[2].c_str()
+ << "\n";
+ return 1;
+ }
+ cmsys::ifstream fin(args[3].c_str(),
+ std::ios::in | std::ios::binary);
+ if(!fin)
+ {
+ std::cerr << "could not open object list file: " << args[3].c_str()
+ << "\n";
+ return 1;
+ }
+ std::string objfile;
+ while(cmSystemTools::GetLineFromStream(fin, objfile))
+ {
+ if (!DumpFile(objfile.c_str(), fout))
+ {
+ return 1;
+ }
+ }
+ return 0;
+ }
+#endif
// run include what you use command and then run the compile
// command. This is an internal undocumented option and should
// only be used by CMake itself when running iwyu.
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index e784759..afcbd61 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -98,6 +98,7 @@ static const char * cmDocumentationOptions[][2] =
{"--test-command", "The test to run with the --build-and-test option."},
{"--test-timeout", "The time limit in seconds, internal use only."},
+ {"--test-load", "CPU load threshold for starting new parallel tests."},
{"--tomorrow-tag", "Nightly or experimental starts with next day tag."},
{"--ctest-config", "The configuration file used to initialize CTest state "
"when submitting dashboards."},
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index c88e888..7eb678b 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -786,6 +786,15 @@ IF(KWSYS_USE_SystemInformation)
SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
ENDIF()
+
+ IF(UNIX AND NOT CYGWIN)
+ KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_GETLOADAVG
+ "Checking whether CXX compiler has getloadavg" DIRECT)
+ IF(KWSYS_CXX_HAS_GETLOADAVG)
+ SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+ COMPILE_DEFINITIONS KWSYS_CXX_HAS_GETLOADAVG=1)
+ ENDIF()
+ ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
diff --git a/Source/kwsys/CONTRIBUTING.rst b/Source/kwsys/CONTRIBUTING.rst
index e097b76..960eea4 100644
--- a/Source/kwsys/CONTRIBUTING.rst
+++ b/Source/kwsys/CONTRIBUTING.rst
@@ -29,7 +29,7 @@ License
We do not require any formal copyright assignment or contributor license
agreement. Any contributions intentionally sent upstream are presumed
-to be offerred under terms of the OSI-approved BSD 3-clause License.
+to be offered under terms of the OSI-approved BSD 3-clause License.
See `Copyright.txt`_ for details.
.. _`Copyright.txt`: Copyright.txt
diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c
index f630171..a7dd2ca 100644
--- a/Source/kwsys/ProcessWin32.c
+++ b/Source/kwsys/ProcessWin32.c
@@ -11,14 +11,12 @@
============================================================================*/
#include "kwsysPrivate.h"
#include KWSYS_HEADER(Process.h)
-#include KWSYS_HEADER(System.h)
#include KWSYS_HEADER(Encoding.h)
/* Work-around CMake dependency scanning limitation. This must
duplicate the above list of headers. */
#if 0
# include "Process.h.in"
-# include "System.h.in"
# include "Encoding_c.h.in"
#endif
@@ -120,11 +118,6 @@ static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle);
static void kwsysProcessCleanupHandle(PHANDLE h);
static void kwsysProcessCleanup(kwsysProcess* cp, int error);
static void kwsysProcessCleanErrorMessage(kwsysProcess* cp);
-static int kwsysProcessComputeCommandLength(kwsysProcess* cp,
- char const* const* command);
-static void kwsysProcessComputeCommandLine(kwsysProcess* cp,
- char const* const* command,
- char* cmd);
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
kwsysProcessTime* timeoutTime);
static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
@@ -602,37 +595,69 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
}
}
- /* We need to construct a single string representing the command
- and its arguments. We will surround each argument containing
- spaces with double-quotes. Inside a double-quoted argument, we
- need to escape double-quotes and all backslashes before them.
- We also need to escape backslashes at the end of an argument
- because they come before the closing double-quote for the
- argument. */
- {
- /* First determine the length of the final string. */
- int length = kwsysProcessComputeCommandLength(cp, command);
-
- /* Allocate enough space for the command. We do not need an extra
- byte for the terminating null because we allocated a space for
- the first argument that we will not use. */
- char* new_cmd = malloc(length);
- if(!new_cmd)
+ if (cp->Verbatim)
{
- /* Out of memory. */
+ /* Copy the verbatim command line into the buffer. */
+ newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(*command);
+ }
+ else
+ {
+ /* Encode the arguments so CommandLineToArgvW can decode
+ them from the command line string in the child. */
+ char buffer[32768]; /* CreateProcess max command-line length. */
+ char* end = buffer + sizeof(buffer);
+ char* out = buffer;
+ char const* const* a;
+ for (a = command; *a; ++a)
+ {
+ int quote = !**a; /* Quote the empty string. */
+ int slashes = 0;
+ char const* c;
+ if (a != command && out != end) { *out++ = ' '; }
+ for (c = *a; !quote && *c; ++c)
+ { quote = (*c == ' ' || *c == '\t'); }
+ if (quote && out != end) { *out++ = '"'; }
+ for (c = *a; *c; ++c)
+ {
+ if (*c == '\\')
+ {
+ ++slashes;
+ }
+ else
+ {
+ if (*c == '"')
+ {
+ // Add n+1 backslashes to total 2n+1 before internal '"'.
+ while(slashes-- >= 0 && out != end) { *out++ = '\\'; }
+ }
+ slashes = 0;
+ }
+ if (out != end) { *out++ = *c; }
+ }
+ if (quote)
+ {
+ // Add n backslashes to total 2n before ending '"'.
+ while (slashes-- > 0 && out != end) { *out++ = '\\'; }
+ if (out != end) { *out++ = '"'; }
+ }
+ }
+ if(out != end)
+ {
+ *out = '\0';
+ newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(buffer);
+ }
+ else
+ {
+ newCommands[cp->NumberOfCommands] = 0;
+ }
+ }
+ if (!newCommands[cp->NumberOfCommands])
+ {
+ /* Out of memory or command line too long. */
free(newCommands);
return 0;
}
- /* Construct the command line in the allocated buffer. */
- kwsysProcessComputeCommandLine(cp, command,
- new_cmd);
-
- newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(new_cmd);
- free(new_cmd);
- }
-
-
/* Save the new array of commands. */
free(cp->Commands);
cp->Commands = newCommands;
@@ -1962,66 +1987,6 @@ void kwsysProcessCleanErrorMessage(kwsysProcess* cp)
}
/*--------------------------------------------------------------------------*/
-int kwsysProcessComputeCommandLength(kwsysProcess* cp,
- char const* const* command)
-{
- int length = 0;
- if(cp->Verbatim)
- {
- /* Treat the first argument as a verbatim command line. Use its
- length directly and add space for the null-terminator. */
- length = (int)strlen(*command)+1;
- }
- else
- {
- /* Compute the length of the command line when it is converted to
- a single string. Space for the null-terminator is allocated by
- the whitespace character allocated for the first argument that
- will not be used. */
- char const* const* arg;
- for(arg = command; *arg; ++arg)
- {
- /* Add the length of this argument. It already includes room
- for a separating space or terminating null. */
- length += kwsysSystem_Shell_GetArgumentSizeForWindows(*arg, 0);
- }
- }
-
- return length;
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysProcessComputeCommandLine(kwsysProcess* cp,
- char const* const* command,
- char* cmd)
-{
- if(cp->Verbatim)
- {
- /* Copy the verbatim command line into the buffer. */
- strcpy(cmd, *command);
- }
- else
- {
- /* Construct the command line in the allocated buffer. */
- char const* const* arg;
- for(arg = command; *arg; ++arg)
- {
- /* Add the separating space if this is not the first argument. */
- if(arg != command)
- {
- *cmd++ = ' ';
- }
-
- /* Add the current argument. */
- cmd = kwsysSystem_Shell_GetArgumentForWindows(*arg, cmd, 0);
- }
-
- /* Add the terminating null character to the command line. */
- *cmd = 0;
- }
-}
-
-/*--------------------------------------------------------------------------*/
/* Get the time at which either the process or user timeout will
expire. Returns 1 if the user timeout is first, and 0 otherwise. */
int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index 1ee26fa..ccc7e81 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -20,8 +20,8 @@
#include <stddef.h> /* ptrdiff_t */
#include <stdlib.h> /* malloc, free */
-#include <string.h> /* strlen */
-#include <ctype.h> /* isalpha */
+#include <string.h> /* memcpy */
+#include <ctype.h> /* isspace */
#include <stdio.h>
@@ -31,587 +31,6 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t;
typedef int kwsysSystem_ptrdiff_t;
#endif
-/*
-
-Notes:
-
-Make variable replacements open a can of worms. Sometimes they should
-be quoted and sometimes not. Sometimes their replacement values are
-already quoted.
-
-VS variables cause problems. In order to pass the referenced value
-with spaces the reference must be quoted. If the variable value ends
-in a backslash then it will escape the ending quote! In order to make
-the ending backslash appear we need this:
-
- "$(InputDir)\"
-
-However if there is not a trailing backslash then this will put a
-quote in the value so we need:
-
- "$(InputDir)"
-
-Make variable references are platform specific so we should probably
-just NOT quote them and let the listfile author deal with it.
-
-*/
-
-/*
-TODO: For windows echo:
-
-To display a pipe (|) or redirection character (< or >) when using the
-echo command, use a caret character immediately before the pipe or
-redirection character (for example, ^>, ^<, or ^| ). If you need to
-use the caret character itself (^), use two in a row (^^).
-*/
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharIsWhitespace(char c)
-{
- return ((c == ' ') || (c == '\t'));
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
-{
- return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
- (c == '&') || (c == '$') || (c == '(') || (c == ')') ||
- (c == '~') || (c == '<') || (c == '>') || (c == '|') ||
- (c == '*') || (c == '^') || (c == '\\'));
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c)
-{
- return ((c == '\'') || (c == '#') || (c == '&') ||
- (c == '<') || (c == '>') || (c == '|') || (c == '^'));
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
-{
- /* On Windows the built-in command shell echo never needs quotes. */
- if(!isUnix && (flags & kwsysSystem_Shell_Flag_EchoWindows))
- {
- return 0;
- }
-
- /* On all platforms quotes are needed to preserve whitespace. */
- if(kwsysSystem_Shell__CharIsWhitespace(c))
- {
- return 1;
- }
-
- if(isUnix)
- {
- /* On UNIX several special characters need quotes to preserve them. */
- if(kwsysSystem_Shell__CharNeedsQuotesOnUnix(c))
- {
- return 1;
- }
- }
- else
- {
- /* On Windows several special characters need quotes to preserve them. */
- if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c))
- {
- return 1;
- }
- }
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharIsMakeVariableName(char c)
-{
- return c && (c == '_' || isalpha(((int)c)));
-}
-
-/*--------------------------------------------------------------------------*/
-static const char* kwsysSystem_Shell__SkipMakeVariables(const char* c)
-{
- while(*c == '$' && *(c+1) == '(')
- {
- const char* skip = c+2;
- while(kwsysSystem_Shell__CharIsMakeVariableName(*skip))
- {
- ++skip;
- }
- if(*skip == ')')
- {
- c = skip+1;
- }
- else
- {
- break;
- }
- }
- return c;
-}
-
-/*
-Allowing make variable replacements opens a can of worms. Sometimes
-they should be quoted and sometimes not. Sometimes their replacement
-values are already quoted or contain escapes.
-
-Some Visual Studio variables cause problems. In order to pass the
-referenced value with spaces the reference must be quoted. If the
-variable value ends in a backslash then it will escape the ending
-quote! In order to make the ending backslash appear we need this:
-
- "$(InputDir)\"
-
-However if there is not a trailing backslash then this will put a
-quote in the value so we need:
-
- "$(InputDir)"
-
-This macro decides whether we quote an argument just because it
-contains a make variable reference. This should be replaced with a
-flag later when we understand applications of this better.
-*/
-#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
- int flags)
-{
- /* The empty string needs quotes. */
- if(!*in)
- {
- return 1;
- }
-
- /* Scan the string for characters that require quoting. */
- {
- const char* c;
- for(c=in; *c; ++c)
- {
- /* Look for $(MAKEVAR) syntax if requested. */
- if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
- {
-#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES
- const char* skip = kwsysSystem_Shell__SkipMakeVariables(c);
- if(skip != c)
- {
- /* We need to quote make variable references to preserve the
- string with contents substituted in its place. */
- return 1;
- }
-#else
- /* Skip over the make variable references if any are present. */
- c = kwsysSystem_Shell__SkipMakeVariables(c);
-
- /* Stop if we have reached the end of the string. */
- if(!*c)
- {
- break;
- }
-#endif
- }
-
- /* Check whether this character needs quotes. */
- if(kwsysSystem_Shell__CharNeedsQuotes(*c, isUnix, flags))
- {
- return 1;
- }
- }
- }
-
- /* On Windows some single character arguments need quotes. */
- if(!isUnix && *in && !*(in+1))
- {
- char c = *in;
- if((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#'))
- {
- return 1;
- }
- }
-
- return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__GetArgumentSize(const char* in,
- int isUnix, int flags)
-{
- /* Start with the length of the original argument, plus one for
- either a terminating null or a separating space. */
- int size = (int)strlen(in) + 1;
-
- /* String iterator. */
- const char* c;
-
- /* Keep track of how many backslashes have been encountered in a row. */
- int windows_backslashes = 0;
-
- /* Scan the string for characters that require escaping or quoting. */
- for(c=in; *c; ++c)
- {
- /* Look for $(MAKEVAR) syntax if requested. */
- if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
- {
- /* Skip over the make variable references if any are present. */
- c = kwsysSystem_Shell__SkipMakeVariables(c);
-
- /* Stop if we have reached the end of the string. */
- if(!*c)
- {
- break;
- }
- }
-
- /* Check whether this character needs escaping for the shell. */
- if(isUnix)
- {
- /* On Unix a few special characters need escaping even inside a
- quoted argument. */
- if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
- {
- /* This character needs a backslash to escape it. */
- ++size;
- }
- }
- else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
- {
- /* On Windows the built-in command shell echo never needs escaping. */
- }
- else
- {
- /* On Windows only backslashes and double-quotes need escaping. */
- if(*c == '\\')
- {
- /* Found a backslash. It may need to be escaped later. */
- ++windows_backslashes;
- }
- else if(*c == '"')
- {
- /* Found a double-quote. We need to escape it and all
- immediately preceding backslashes. */
- size += windows_backslashes + 1;
- windows_backslashes = 0;
- }
- else
- {
- /* Found another character. This eliminates the possibility
- that any immediately preceding backslashes will be
- escaped. */
- windows_backslashes = 0;
- }
- }
-
- /* Check whether this character needs escaping for a make tool. */
- if(*c == '$')
- {
- if(flags & kwsysSystem_Shell_Flag_Make)
- {
- /* In Makefiles a dollar is written $$ so we need one extra
- character. */
- ++size;
- }
- else if(flags & kwsysSystem_Shell_Flag_VSIDE)
- {
- /* In a VS IDE a dollar is written "$" so we need two extra
- characters. */
- size += 2;
- }
- }
- else if(*c == '#')
- {
- if((flags & kwsysSystem_Shell_Flag_Make) &&
- (flags & kwsysSystem_Shell_Flag_WatcomWMake))
- {
- /* In Watcom WMake makefiles a pound is written $# so we need
- one extra character. */
- ++size;
- }
- }
- else if(*c == '%')
- {
- if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
- ((flags & kwsysSystem_Shell_Flag_Make) &&
- ((flags & kwsysSystem_Shell_Flag_MinGWMake) ||
- (flags & kwsysSystem_Shell_Flag_NMake))))
- {
- /* In the VS IDE, NMake, or MinGW make a percent is written %%
- so we need one extra characters. */
- size += 1;
- }
- }
- else if(*c == ';')
- {
- if(flags & kwsysSystem_Shell_Flag_VSIDE)
- {
- /* In a VS IDE a semicolon is written ";" so we need two extra
- characters. */
- size += 2;
- }
- }
- }
-
- /* Check whether the argument needs surrounding quotes. */
- if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags))
- {
- /* Surrounding quotes are needed. Allocate space for them. */
- if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix))
- {
- size += 2;
- }
- size += 2;
-
- /* We must escape all ending backslashes when quoting on windows. */
- size += windows_backslashes;
- }
-
- return size;
-}
-
-/*--------------------------------------------------------------------------*/
-static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
- int isUnix, int flags)
-{
- /* String iterator. */
- const char* c;
-
- /* Keep track of how many backslashes have been encountered in a row. */
- int windows_backslashes = 0;
-
- /* Whether the argument must be quoted. */
- int needQuotes = kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags);
- if(needQuotes)
- {
- /* Add the opening quote for this argument. */
- if(flags & kwsysSystem_Shell_Flag_WatcomQuote)
- {
- if(isUnix)
- {
- *out++ = '"';
- }
- *out++ = '\'';
- }
- else
- {
- *out++ = '"';
- }
- }
-
- /* Scan the string for characters that require escaping or quoting. */
- for(c=in; *c; ++c)
- {
- /* Look for $(MAKEVAR) syntax if requested. */
- if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
- {
- const char* skip = kwsysSystem_Shell__SkipMakeVariables(c);
- if(skip != c)
- {
- /* Copy to the end of the make variable references. */
- while(c != skip)
- {
- *out++ = *c++;
- }
-
- /* The make variable reference eliminates any escaping needed
- for preceding backslashes. */
- windows_backslashes = 0;
-
- /* Stop if we have reached the end of the string. */
- if(!*c)
- {
- break;
- }
- }
- }
-
- /* Check whether this character needs escaping for the shell. */
- if(isUnix)
- {
- /* On Unix a few special characters need escaping even inside a
- quoted argument. */
- if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
- {
- /* This character needs a backslash to escape it. */
- *out++ = '\\';
- }
- }
- else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
- {
- /* On Windows the built-in command shell echo never needs escaping. */
- }
- else
- {
- /* On Windows only backslashes and double-quotes need escaping. */
- if(*c == '\\')
- {
- /* Found a backslash. It may need to be escaped later. */
- ++windows_backslashes;
- }
- else if(*c == '"')
- {
- /* Found a double-quote. Escape all immediately preceding
- backslashes. */
- while(windows_backslashes > 0)
- {
- --windows_backslashes;
- *out++ = '\\';
- }
-
- /* Add the backslash to escape the double-quote. */
- *out++ = '\\';
- }
- else
- {
- /* We encountered a normal character. This eliminates any
- escaping needed for preceding backslashes. */
- windows_backslashes = 0;
- }
- }
-
- /* Check whether this character needs escaping for a make tool. */
- if(*c == '$')
- {
- if(flags & kwsysSystem_Shell_Flag_Make)
- {
- /* In Makefiles a dollar is written $$. The make tool will
- replace it with just $ before passing it to the shell. */
- *out++ = '$';
- *out++ = '$';
- }
- else if(flags & kwsysSystem_Shell_Flag_VSIDE)
- {
- /* In a VS IDE a dollar is written "$". If this is written in
- an un-quoted argument it starts a quoted segment, inserts
- the $ and ends the segment. If it is written in a quoted
- argument it ends quoting, inserts the $ and restarts
- quoting. Either way the $ is isolated from surrounding
- text to avoid looking like a variable reference. */
- *out++ = '"';
- *out++ = '$';
- *out++ = '"';
- }
- else
- {
- /* Otherwise a dollar is written just $. */
- *out++ = '$';
- }
- }
- else if(*c == '#')
- {
- if((flags & kwsysSystem_Shell_Flag_Make) &&
- (flags & kwsysSystem_Shell_Flag_WatcomWMake))
- {
- /* In Watcom WMake makefiles a pound is written $#. The make
- tool will replace it with just # before passing it to the
- shell. */
- *out++ = '$';
- *out++ = '#';
- }
- else
- {
- /* Otherwise a pound is written just #. */
- *out++ = '#';
- }
- }
- else if(*c == '%')
- {
- if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
- ((flags & kwsysSystem_Shell_Flag_Make) &&
- ((flags & kwsysSystem_Shell_Flag_MinGWMake) ||
- (flags & kwsysSystem_Shell_Flag_NMake))))
- {
- /* In the VS IDE, NMake, or MinGW make a percent is written %%. */
- *out++ = '%';
- *out++ = '%';
- }
- else
- {
- /* Otherwise a percent is written just %. */
- *out++ = '%';
- }
- }
- else if(*c == ';')
- {
- if(flags & kwsysSystem_Shell_Flag_VSIDE)
- {
- /* In a VS IDE a semicolon is written ";". If this is written
- in an un-quoted argument it starts a quoted segment,
- inserts the ; and ends the segment. If it is written in a
- quoted argument it ends quoting, inserts the ; and restarts
- quoting. Either way the ; is isolated. */
- *out++ = '"';
- *out++ = ';';
- *out++ = '"';
- }
- else
- {
- /* Otherwise a semicolon is written just ;. */
- *out++ = ';';
- }
- }
- else
- {
- /* Store this character. */
- *out++ = *c;
- }
- }
-
- if(needQuotes)
- {
- /* Add enough backslashes to escape any trailing ones. */
- while(windows_backslashes > 0)
- {
- --windows_backslashes;
- *out++ = '\\';
- }
-
- /* Add the closing quote for this argument. */
- if(flags & kwsysSystem_Shell_Flag_WatcomQuote)
- {
- *out++ = '\'';
- if(isUnix)
- {
- *out++ = '"';
- }
- }
- else
- {
- *out++ = '"';
- }
- }
-
- /* Store a terminating null without incrementing. */
- *out = 0;
-
- return out;
-}
-
-/*--------------------------------------------------------------------------*/
-char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
- char* out,
- int flags)
-{
- return kwsysSystem_Shell__GetArgument(in, out, 0, flags);
-}
-
-/*--------------------------------------------------------------------------*/
-char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
- char* out,
- int flags)
-{
- return kwsysSystem_Shell__GetArgument(in, out, 1, flags);
-}
-
-/*--------------------------------------------------------------------------*/
-int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, int flags)
-{
- return kwsysSystem_Shell__GetArgumentSize(in, 0, flags);
-}
-
-/*--------------------------------------------------------------------------*/
-int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, int flags)
-{
- return kwsysSystem_Shell__GetArgumentSize(in, 1, flags);
-}
-
/*--------------------------------------------------------------------------*/
static int kwsysSystem__AppendByte(char* local,
char** begin, char** end,
diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in
index f21bf0d..3f3d3f4 100644
--- a/Source/kwsys/System.h.in
+++ b/Source/kwsys/System.h.in
@@ -24,28 +24,6 @@
#endif
#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsysSystem_Parse_CommandForUnix kwsys_ns(System_Parse_CommandForUnix)
-# define kwsysSystem_Shell_GetArgumentForWindows kwsys_ns(System_Shell_GetArgumentForWindows)
-# define kwsysSystem_Shell_GetArgumentForUnix kwsys_ns(System_Shell_GetArgumentForUnix)
-# define kwsysSystem_Shell_GetArgumentSizeForWindows kwsys_ns(System_Shell_GetArgumentSizeForWindows)
-# define kwsysSystem_Shell_GetArgumentSizeForUnix kwsys_ns(System_Shell_GetArgumentSizeForUnix)
-# define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e)
-# define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
-# define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
-# define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
-# define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
-# define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake)
-# define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake)
-# define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
-# define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote)
-#endif
-
-#ifdef __VMS
-#define @KWSYS_NAMESPACE@System_Shell_GetArgumentForUnix \
- @KWSYS_NAMESPACE@System_Shell_UnixGA
-#define @KWSYS_NAMESPACE@System_Shell_GetArgumentSizeForUnix \
- @KWSYS_NAMESPACE@System_Shell_UnixGAS
-#define @KWSYS_NAMESPACE@System_Shell_GetArgumentForWindows \
- @KWSYS_NAMESPACE@System_Shell_WindowsGA
#endif
#if defined(__cplusplus)
@@ -54,69 +32,6 @@ extern "C"
#endif
/**
- * Transform the given command line argument for use in a Windows or
- * Unix shell. Returns a pointer to the end of the command line
- * argument in the provided output buffer. Flags may be passed to
- * modify the generated quoting and escape sequences to work under
- * alternative environments.
- */
-kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
- char* out,
- int flags);
-kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
- char* out,
- int flags);
-
-/**
- * Compute the size of the buffer required to store the output from
- * kwsysSystem_Shell_GetArgumentForWindows or
- * kwsysSystem_Shell_GetArgumentForUnix. The flags passed must be
- * identical between the two calls.
- */
-kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in,
- int flags);
-kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in,
- int flags);
-
-/**
- * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or
- * kwsysSystem_Shell_GetArgumentForUnix. These modify the generated
- * quoting and escape sequences to work under alternative
- * environments.
- */
-enum kwsysSystem_Shell_Flag_e
-{
- /** The target shell is in a makefile. */
- kwsysSystem_Shell_Flag_Make = (1<<0),
-
- /** The target shell is in a VS project file. Do not use with
- Shell_Flag_Make. */
- kwsysSystem_Shell_Flag_VSIDE = (1<<1),
-
- /** In a windows shell the argument is being passed to "echo". */
- kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
-
- /** The target shell is in a Watcom WMake makefile. */
- kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
-
- /** The target shell is in a MinGW Make makefile. */
- kwsysSystem_Shell_Flag_MinGWMake = (1<<4),
-
- /** The target shell is in a NMake makefile. */
- kwsysSystem_Shell_Flag_NMake = (1<<5),
-
- /** Make variable reference syntax $(MAKEVAR) should not be escaped
- to allow a build tool to replace it. Replacement values
- containing spaces, quotes, backslashes, or other
- non-alphanumeric characters that have significance to some makes
- or shells produce undefined behavior. */
- kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6),
-
- /** The target shell quoting uses extra single Quotes for Watcom tools. */
- kwsysSystem_Shell_Flag_WatcomQuote = (1<<7)
-};
-
-/**
* Parse a unix-style command line string into separate arguments.
*
* On success, returns a pointer to an array of pointers to individual
@@ -148,19 +63,6 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command,
# undef kwsysEXPORT
# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsysSystem_Parse_CommandForUnix
-# undef kwsysSystem_Shell_GetArgumentForWindows
-# undef kwsysSystem_Shell_GetArgumentForUnix
-# undef kwsysSystem_Shell_GetArgumentSizeForWindows
-# undef kwsysSystem_Shell_GetArgumentSizeForUnix
-# undef kwsysSystem_Shell_Flag_e
-# undef kwsysSystem_Shell_Flag_Make
-# undef kwsysSystem_Shell_Flag_VSIDE
-# undef kwsysSystem_Shell_Flag_EchoWindows
-# undef kwsysSystem_Shell_Flag_WatcomWMake
-# undef kwsysSystem_Shell_Flag_MinGWMake
-# undef kwsysSystem_Shell_Flag_NMake
-# undef kwsysSystem_Shell_Flag_AllowMakeVariables
-# undef kwsysSystem_Shell_Flag_WatcomQuote
# endif
#endif
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index b0434f4..6e81b0b 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -81,6 +81,11 @@ typedef int siginfo_t;
# include <errno.h> // extern int errno;
#endif
+#if defined (__CYGWIN__) && !defined(_WIN32)
+# include <windows.h>
+# undef _WIN32
+#endif
+
#ifdef __FreeBSD__
# include <sys/sysctl.h>
# include <fenv.h>
@@ -366,6 +371,8 @@ public:
const char *procLimitEnvVarName);
LongLong GetProcMemoryUsed();
+ double GetLoadAverage();
+
// enable/disable stack trace signal handler.
static
void SetStackTraceOnError(int enable);
@@ -820,6 +827,11 @@ SystemInformation::LongLong SystemInformation::GetProcMemoryUsed()
return this->Implementation->GetProcMemoryUsed();
}
+double SystemInformation::GetLoadAverage()
+{
+ return this->Implementation->GetLoadAverage();
+}
+
SystemInformation::LongLong SystemInformation::GetProcessId()
{
return this->Implementation->GetProcessId();
@@ -1490,6 +1502,60 @@ void SymbolProperties::Initialize(void *address)
}
#endif // don't define this class if we're not using it
+// --------------------------------------------------------------------------
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes
+#endif
+#if defined(_MSC_VER) && _MSC_VER < 1310
+# undef KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes
+#endif
+#if defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes)
+double calculateCPULoad(unsigned __int64 idleTicks,
+ unsigned __int64 totalTicks)
+{
+ static double previousLoad = -0.0;
+ static unsigned __int64 previousIdleTicks = 0;
+ static unsigned __int64 previousTotalTicks = 0;
+
+ unsigned __int64 const idleTicksSinceLastTime =
+ idleTicks - previousIdleTicks;
+ unsigned __int64 const totalTicksSinceLastTime =
+ totalTicks - previousTotalTicks;
+
+ double load;
+ if (previousTotalTicks == 0 || totalTicksSinceLastTime == 0)
+ {
+ // No new information. Use previous result.
+ load = previousLoad;
+ }
+ else
+ {
+ // Calculate load since last time.
+ load = 1.0 - double(idleTicksSinceLastTime) / totalTicksSinceLastTime;
+
+ // Smooth if possible.
+ if (previousLoad > 0)
+ {
+ load = 0.25 * load + 0.75 * previousLoad;
+ }
+ }
+
+ previousLoad = load;
+ previousIdleTicks = idleTicks;
+ previousTotalTicks = totalTicks;
+
+ return load;
+}
+
+unsigned __int64 fileTimeToUInt64(FILETIME const& ft)
+{
+ LARGE_INTEGER out;
+ out.HighPart = ft.dwHighDateTime;
+ out.LowPart = ft.dwLowDateTime;
+ return out.QuadPart;
+}
+#endif
+
} // anonymous namespace
@@ -3612,6 +3678,38 @@ SystemInformationImplementation::GetProcMemoryUsed()
#endif
}
+double SystemInformationImplementation::GetLoadAverage()
+{
+#if defined(KWSYS_CXX_HAS_GETLOADAVG)
+ double loadavg[3] = { 0.0, 0.0, 0.0 };
+ if (getloadavg(loadavg, 3) > 0)
+ {
+ return loadavg[0];
+ }
+ return -0.0;
+#elif defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes)
+ // Old windows.h headers do not provide GetSystemTimes.
+ typedef BOOL (WINAPI *GetSystemTimesType)(LPFILETIME, LPFILETIME,
+ LPFILETIME);
+ static GetSystemTimesType pGetSystemTimes =
+ (GetSystemTimesType)GetProcAddress(GetModuleHandleW(L"kernel32"),
+ "GetSystemTimes");
+ FILETIME idleTime, kernelTime, userTime;
+ if (pGetSystemTimes && pGetSystemTimes(&idleTime, &kernelTime, &userTime))
+ {
+ unsigned __int64 const idleTicks =
+ fileTimeToUInt64(idleTime);
+ unsigned __int64 const totalTicks =
+ fileTimeToUInt64(kernelTime) + fileTimeToUInt64(userTime);
+ return calculateCPULoad(idleTicks, totalTicks) * GetNumberOfPhysicalCPU();
+ }
+ return -0.0;
+#else
+ // Not implemented on this platform.
+ return -0.0;
+#endif
+}
+
/**
Get the process id of the running process.
*/
diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in
index a9fd05d..4acdc4f 100644
--- a/Source/kwsys/SystemInformation.hxx.in
+++ b/Source/kwsys/SystemInformation.hxx.in
@@ -130,6 +130,10 @@ public:
// Get system RAM used by this process id in units of KiB.
LongLong GetProcMemoryUsed();
+ // Return the load average of the machine or -0.0 if it cannot
+ // be determined.
+ double GetLoadAverage();
+
// enable/disable stack trace signal handler. In order to
// produce an informative stack trace the application should
// be dynamically linked and compiled with debug symbols.
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index c834e34..fed1c9c 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4408,7 +4408,7 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& shortPath)
{
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__)
const int size = int(path.size()) +1; // size of return
char *tempPath = new char[size]; // create a buffer
DWORD ret;
diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx
index 82620da..1596fe4 100644
--- a/Source/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx
@@ -452,6 +452,19 @@ int main()
}
#endif
+#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
+// Match feature definitions from SystemInformation.cxx
+#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
+# define _GNU_SOURCE
+#endif
+#include <stdlib.h>
+int main()
+{
+ double loadavg[3] = { 0.0, 0.0, 0.0 };
+ return getloadavg(loadavg, 3);
+}
+#endif
+
#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
# if defined(KWSYS_HAS_LFS)
# define _LARGEFILE_SOURCE
diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx
index 53d51ac..fc8ea55 100644
--- a/Source/kwsys/testSystemInformation.cxx
+++ b/Source/kwsys/testSystemInformation.cxx
@@ -87,6 +87,7 @@ int testSystemInformation(int, char*[])
printMethod3(info, GetProcMemoryAvailable("KWSHL","KWSPL"), "KiB");
printMethod3(info, GetHostMemoryUsed(), "KiB");
printMethod3(info, GetProcMemoryUsed(), "KiB");
+ printMethod(info, GetLoadAverage);
for (long int i = 0; i <= 31; i++)
{
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8865063..8de1c79 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -260,6 +260,12 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
set_tests_properties(MissingSourceFile PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c")
+ if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 6.1)
+ if(CMAKE_GENERATOR STREQUAL "Xcode")
+ ADD_TEST_MACRO(SwiftMix SwiftMix)
+ ADD_TEST_MACRO(SwiftOnly SwiftOnly)
+ endif()
+ endif()
if(CMAKE_Fortran_COMPILER)
ADD_TEST_MACRO(FortranOnly FortranOnly)
endif()
diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
index e205330..9be69f1 100644
--- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
+++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt
@@ -56,3 +56,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
else()
message("Unhandled Platform")
endif()
+
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+ check_cxx_compiler_flag("-x c++" HAVE_X_CXX)
+ if(NOT HAVE_X_CXX)
+ message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
+ endif()
+endif()
diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in
index 1699c3f..277b3a6 100644
--- a/Tests/CTestUpdateCVS.cmake.in
+++ b/Tests/CTestUpdateCVS.cmake.in
@@ -170,3 +170,22 @@ set(CTEST_CHECKOUT_COMMAND
# Run the dashboard script with CTest.
run_dashboard_script(dash-binary)
+
+#-----------------------------------------------------------------------------
+# Test ctest_update(RETURN_VALUE) on failure
+message("Running CTest Dashboard Script (fail to update)...")
+
+set(ctest_update_check [[
+if(NOT ret LESS 0)
+ message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}")
+endif()
+]])
+create_dashboard_script(dash-binary-fail
+ "set(CTEST_CVS_COMMAND \"update-command-does-not-exist\")
+")
+unset(ctest_update_check)
+
+# Run the dashboard script with CTest.
+set(FAIL_UPDATE 1)
+run_dashboard_script(dash-binary-fail)
+unset(FAIL_UPDATE)
diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake
index 77b3398..458e427 100644
--- a/Tests/CTestUpdateCommon.cmake
+++ b/Tests/CTestUpdateCommon.cmake
@@ -182,6 +182,14 @@ endfunction()
#-----------------------------------------------------------------------------
# Function to write the dashboard test script.
function(create_dashboard_script bin_dir custom_text)
+ if (NOT ctest_update_check)
+ set(ctest_update_check [[
+if(ret LESS 0)
+ message(FATAL_ERROR "ctest_update failed with ${ret}")
+endif()
+]])
+ endif()
+
# Write the dashboard script.
file(WRITE ${TOP}/${bin_dir}.cmake
"# CTest Dashboard Script
@@ -193,8 +201,8 @@ set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir})
${custom_text}
# Start a dashboard and run the update step
ctest_start(Experimental)
-ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY})
-")
+ctest_update(SOURCE \${CTEST_SOURCE_DIRECTORY} RETURN_VALUE ret ${ctest_update_args})
+${ctest_update_check}")
endfunction()
#-----------------------------------------------------------------------------
@@ -250,6 +258,24 @@ function(check_no_update bin_dir)
endif()
endfunction()
+#-----------------------------------------------------------------------------
+# Function to find the Update.xml file and make sure
+# it only has the UpdateReturnStatus failure message and no updates.
+function(check_fail_update bin_dir)
+ set(PATTERN ${TOP}/${bin_dir}/Testing/*/Update.xml)
+ file(GLOB UPDATE_XML_FILE RELATIVE ${TOP} ${PATTERN})
+ string(REGEX REPLACE "//Update.xml$" "/Update.xml"
+ UPDATE_XML_FILE "${UPDATE_XML_FILE}")
+ message(" found ${UPDATE_XML_FILE}")
+ file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_STATUS
+ REGEX "^\t<UpdateReturnStatus>[^<\n]+"
+ )
+ if(UPDATE_XML_STATUS MATCHES "Update command failed")
+ message(" correctly found 'Update command failed'")
+ else()
+ message(FATAL_ERROR " missing 'Update command failed'")
+ endif()
+endfunction()
#-----------------------------------------------------------------------------
# Function to run the dashboard through a script
@@ -263,6 +289,8 @@ function(run_dashboard_script bin_dir)
list(APPEND UPDATE_MAYBE Updated{subdir} Updated{CTestConfig.cmake})
if(NO_UPDATE)
check_no_update(${bin_dir})
+ elseif(FAIL_UPDATE)
+ check_fail_update(${bin_dir})
else()
check_updates(${bin_dir}
Updated{foo.txt}
diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in
index 5987a30..6488a1f 100644
--- a/Tests/CTestUpdateGIT.cmake.in
+++ b/Tests/CTestUpdateGIT.cmake.in
@@ -334,31 +334,22 @@ set(CTEST_UPDATE_VERSION_ONLY TRUE)
# Run the dashboard script with CTest.
set(NO_UPDATE 1)
run_dashboard_script(dash-binary-no-update)
+unset(NO_UPDATE)
rewind_source(dash-source)
#-----------------------------------------------------------------------------
# Test ctest_update(QUIET)
-set(NO_UPDATE 0)
message("Running CTest Dashboard Script (update quietly)...")
+set(ctest_update_args QUIET)
create_dashboard_script(dash-binary-quiet
"# git command configuration
set(CTEST_GIT_COMMAND \"${GIT}\")
set(CTEST_GIT_UPDATE_OPTIONS)
set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master)
")
-
-# We need to modify the created dashboard script to include our "QUIET"
-# option.
-set(filename "${TOP}/dash-binary-quiet.cmake")
-file(READ "${filename}" contents)
-string(REPLACE
- [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})]=]
- [=[ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY} QUIET)]=]
- contents
- "${contents}")
-file(WRITE "${filename}" "${contents}")
+unset(ctest_update_args)
# Run the dashboard script with CTest.
run_dashboard_script(dash-binary-quiet)
@@ -367,3 +358,23 @@ run_dashboard_script(dash-binary-quiet)
if("${OUTPUT}" MATCHES "Updating the repository")
message(FATAL_ERROR "Found 'Updating the repository' in quiet output")
endif()
+
+#-----------------------------------------------------------------------------
+# Test ctest_update(RETURN_VALUE) on failure
+message("Running CTest Dashboard Script (fail to update)...")
+
+set(ctest_update_check [[
+
+if(NOT ret LESS 0)
+ message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}")
+endif()
+]])
+create_dashboard_script(dash-binary-fail
+ "set(CTEST_GIT_COMMAND \"update-command-does-not-exist\")
+")
+unset(ctest_update_check)
+
+# Run the dashboard script with CTest.
+set(FAIL_UPDATE 1)
+run_dashboard_script(dash-binary-fail)
+unset(FAIL_UPDATE)
diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in
index c5440f9..c76bf91 100644
--- a/Tests/CTestUpdateHG.cmake.in
+++ b/Tests/CTestUpdateHG.cmake.in
@@ -164,3 +164,22 @@ execute_process(
# Run the dashboard script with CTest.
run_dashboard_script(dash-binary)
+
+#-----------------------------------------------------------------------------
+# Test ctest_update(RETURN_VALUE) on failure
+message("Running CTest Dashboard Script (fail to update)...")
+
+set(ctest_update_check [[
+if(NOT ret LESS 0)
+ message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}")
+endif()
+]])
+create_dashboard_script(dash-binary-fail
+ "set(CTEST_HG_COMMAND \"update-command-does-not-exist\")
+")
+unset(ctest_update_check)
+
+# Run the dashboard script with CTest.
+set(FAIL_UPDATE 1)
+run_dashboard_script(dash-binary-fail)
+unset(FAIL_UPDATE)
diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in
index b5728fd..b757a44 100644
--- a/Tests/CTestUpdateSVN.cmake.in
+++ b/Tests/CTestUpdateSVN.cmake.in
@@ -147,3 +147,22 @@ set(CTEST_CHECKOUT_COMMAND
# Run the dashboard script with CTest.
run_dashboard_script(dash-binary)
+
+#-----------------------------------------------------------------------------
+# Test ctest_update(RETURN_VALUE) on failure
+message("Running CTest Dashboard Script (fail to update)...")
+
+set(ctest_update_check [[
+if(NOT ret LESS 0)
+ message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}")
+endif()
+]])
+create_dashboard_script(dash-binary-fail
+ "set(CTEST_SVN_COMMAND \"update-command-does-not-exist\")
+")
+unset(ctest_update_check)
+
+# Run the dashboard script with CTest.
+set(FAIL_UPDATE 1)
+run_dashboard_script(dash-binary-fail)
+unset(FAIL_UPDATE)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 0df42d9..df3f178 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -73,6 +73,12 @@ install(TARGETS testLibPerConfigDest EXPORT exp
DESTINATION lib/$<$<BOOL:$<CONFIG>>:$<CONFIG>>$<$<NOT:$<BOOL:$<CONFIG>>>:NoConfig>
)
+# Test OUTPUT_NAME properties with generator expressions
+add_library(testLib7 STATIC testLib7.c)
+set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_DEBUG testLib7D-$<CONFIG>)
+set_property(TARGET testLib7 PROPERTY OUTPUT_NAME_RELEASE testLib7R-$<CONFIG>)
+set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$<CONFIG>)
+
# Work-around: Visual Studio 6 does not support per-target object files.
set(VS6)
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
@@ -446,7 +452,7 @@ install(
TARGETS
testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3
testExe2lib testLib4lib testLib4libdbg testLib4libopt
- testLib6
+ testLib6 testLib7
testLibCycleA testLibCycleB
cmp0022NEW cmp0022OLD
systemlib
@@ -505,7 +511,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
-export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib
+export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe2lib
testLib4lib testLib4libdbg testLib4libopt
testLibCycleA testLibCycleB
testLibPerConfigDest
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
index 00a5375..fd55c42 100644
--- a/Tests/ExportImport/Export/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -39,7 +39,11 @@ install(FILES
DESTINATION src
)
+add_library(cmakeonly INTERFACE)
+set_property(TARGET cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS [[DEF="\"\$\B"]])
+
install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target
+ cmakeonly
EXPORT expInterface
)
install(TARGETS sharedlib
diff --git a/Tests/ExportImport/Export/testLib7.c b/Tests/ExportImport/Export/testLib7.c
new file mode 100644
index 0000000..7acae9e
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib7.c
@@ -0,0 +1 @@
+int testLib7(void) { return 0; }
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 17d983a..a74bad1 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -33,6 +33,7 @@ target_link_libraries(imp_testExe1
exp_testLib4
exp_testLib5
exp_testLib6
+ exp_testLib7
exp_testLibCycleA
exp_testLibPerConfigDest
)
@@ -66,6 +67,7 @@ target_link_libraries(imp_testExe1b
bld_testLib4
bld_testLib5
bld_testLib6
+ bld_testLib7
bld_testLibCycleA
bld_testLibPerConfigDest
)
diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c
index 150fcef..56cdd2c 100644
--- a/Tests/ExportImport/Import/A/imp_testExe1.c
+++ b/Tests/ExportImport/Import/A/imp_testExe1.c
@@ -6,6 +6,7 @@ extern int testLib4();
extern int testLib4lib();
extern int testLib5();
extern int testLib6();
+extern int testLib7();
extern int testLibCycleA1();
extern int testLibPerConfigDest();
@@ -21,7 +22,7 @@ extern testLib4libcfg(void);
int main()
{
return (testLib2() + generated_by_testExe1() + testLib3() + testLib4()
- + testLib5() + testLib6() + testLibCycleA1()
+ + testLib5() + testLib6() + testLib7() + testLibCycleA1()
+ testLibPerConfigDest()
+ generated_by_testExe3() + testLib4lib() + testLib4libcfg());
}
diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt
index 51d518e..c850508 100644
--- a/Tests/ExportImport/Import/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt
@@ -99,3 +99,14 @@ add_executable(interfacetest_exp interfacetest.cpp)
target_link_libraries(interfacetest_exp exp::sharediface)
do_try_compile(exp)
+
+foreach(ns exp bld)
+ get_property(defs TARGET ${ns}::cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS)
+ if(NOT defs STREQUAL [[DEF="\"\$\B"]])
+ message(SEND_ERROR
+ "${ns}::cmakeonly property INTERFACE_COMPILE_DEFINITIONS is:\n"
+ " ${defs}\n"
+ "not\n"
+ " " [[DEF="\"\$\B"]] "\n")
+ endif()
+endforeach()
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index de62ce7..b5041c7 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -364,6 +364,66 @@ if(do_git_tests)
)
set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
+ # Unzip/untar the git repository in our source folder so that other
+ # projects below may use it to test git args of ExternalProject_Add
+ #
+ set(proj SetupLocalGITRepositoryWithSubmodules)
+ ExternalProject_Add(${proj}
+ SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT-with-submodules
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo-sub.tgz
+ BUILD_COMMAND ""
+ CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version
+ INSTALL_COMMAND ""
+ )
+ set_property(TARGET ${proj}
+ PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing")
+
+ set(local_git_repo "../../LocalRepositories/GIT-with-submodules")
+
+ set(proj TS1-GIT-no-GIT_SUBMODULES)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ -DWITH_m1:BOOL=ON
+ -DWITH_m2:BOOL=ON
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ "SetupLocalGITRepositoryWithSubmodules"
+ )
+ set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
+
+ set(proj TS1-GIT-empty-GIT_SUBMODULES)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ GIT_SUBMODULES ""
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ -DWITH_m1:BOOL=ON
+ -DWITH_m2:BOOL=ON
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ "SetupLocalGITRepositoryWithSubmodules"
+ )
+ set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
+
+ set(proj TS1-GIT-some-GIT_SUBMODULES)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY "${local_git_repo}"
+ GIT_SUBMODULES "m/m1"
+ CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ -DWITH_m1:BOOL=ON
+ -DWITH_m2:BOOL=OFF
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ DEPENDS "SetupLocalGITRepository"
+ "SetupLocalGITRepositoryWithSubmodules"
+ )
+ set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
+
endif()
set(do_hg_tests 0)
diff --git a/Tests/ExternalProject/gitrepo-sub.tgz b/Tests/ExternalProject/gitrepo-sub.tgz
new file mode 100644
index 0000000..c0b5360
--- /dev/null
+++ b/Tests/ExternalProject/gitrepo-sub.tgz
Binary files differ
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 8700c94..753ce27 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -168,7 +168,7 @@ if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
add_definitions(-DFOO -DBAR=1)
include_directories(${testf_SOURCE_DIR}/include)
- add_executable(test_preprocess test_preprocess.F90)
+ add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90)
set(TEST_MODULE_DEPENDS 1)
endif()
diff --git a/Tests/Fortran/test_preprocess.F90 b/Tests/Fortran/test_preprocess.F90
index e4f1fbe..3a09976 100644
--- a/Tests/Fortran/test_preprocess.F90
+++ b/Tests/Fortran/test_preprocess.F90
@@ -46,6 +46,8 @@ PROGRAM PPTEST
#endif
! 0 ; <empty>
+USE PPAvailable
+
#include "test_preprocess.h"
END PROGRAM
diff --git a/Tests/Fortran/test_preprocess_module.F90 b/Tests/Fortran/test_preprocess_module.F90
new file mode 100644
index 0000000..5849b62
--- /dev/null
+++ b/Tests/Fortran/test_preprocess_module.F90
@@ -0,0 +1,5 @@
+#ifdef FOO
+MODULE PPAvailable
+! no conent
+END MODULE
+#endif
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 60b44fd..ebcfc0f 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -34,8 +34,8 @@ else()
include_directories(${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Widgets)
- if(Qt5_POSITION_INDEPENDENT_CODE)
- set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+ if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
endif()
macro(qtx_wrap_cpp)
@@ -167,3 +167,26 @@ file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}")
if (NOT file1_step1 GREATER file1_before)
message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!")
endif()
+
+#-----------------------------------------------------------------------------
+try_compile(MOC_RERUN
+ "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun"
+ "${CMAKE_CURRENT_SOURCE_DIR}/automoc_rerun"
+ automoc_rerun
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(SEND_ERROR "Initial build of automoc_rerun failed. Output: ${output}")
+endif()
+
+configure_file(automoc_rerun/test1.h.in2 automoc_rerun/test1.h COPYONLY)
+
+execute_process(COMMAND "${CMAKE_COMMAND}" --build .
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun"
+ RESULT_VARIABLE automoc_rerun_result
+ )
+if (automoc_rerun_result)
+ message(SEND_ERROR "Second build of automoc_rerun failed.")
+endif()
diff --git a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
new file mode 100644
index 0000000..17bc332
--- /dev/null
+++ b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.1)
+project(automoc_rerun CXX)
+
+if (QT_TEST_VERSION STREQUAL 4)
+ find_package(Qt4 REQUIRED)
+ set(QT_CORE_TARGET Qt4::QtCore)
+else()
+ if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+ endif()
+
+ find_package(Qt5Core REQUIRED)
+ set(QT_CORE_TARGET Qt5::Core)
+endif()
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+
+configure_file(test1.h.in1 test1.h COPYONLY)
+
+add_executable(test1
+ ${CMAKE_CURRENT_BINARY_DIR}/test1.h
+ test1.cpp
+ res1.qrc
+ )
+target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries(test1 ${QT_CORE_TARGET})
diff --git a/Tests/QtAutogen/automoc_rerun/input.txt b/Tests/QtAutogen/automoc_rerun/input.txt
new file mode 100644
index 0000000..da62762
--- /dev/null
+++ b/Tests/QtAutogen/automoc_rerun/input.txt
@@ -0,0 +1 @@
+Res1 input.
diff --git a/Tests/QtAutogen/automoc_rerun/res1.qrc b/Tests/QtAutogen/automoc_rerun/res1.qrc
new file mode 100644
index 0000000..fb804b5
--- /dev/null
+++ b/Tests/QtAutogen/automoc_rerun/res1.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogen/automoc_rerun/test1.cpp b/Tests/QtAutogen/automoc_rerun/test1.cpp
new file mode 100644
index 0000000..4316a91
--- /dev/null
+++ b/Tests/QtAutogen/automoc_rerun/test1.cpp
@@ -0,0 +1,5 @@
+#include "test1.h"
+int main()
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in1 b/Tests/QtAutogen/automoc_rerun/test1.h.in1
new file mode 100644
index 0000000..fee2c09
--- /dev/null
+++ b/Tests/QtAutogen/automoc_rerun/test1.h.in1
@@ -0,0 +1,8 @@
+#include <QObject>
+class test1 : public QObject
+{
+ Q_OBJECT
+ public slots:
+ void onTst1() {}
+ void onTst2() {}
+};
diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in2 b/Tests/QtAutogen/automoc_rerun/test1.h.in2
new file mode 100644
index 0000000..6531d10
--- /dev/null
+++ b/Tests/QtAutogen/automoc_rerun/test1.h.in2
@@ -0,0 +1,7 @@
+#include <QObject>
+class test1 : public QObject
+{
+ Q_OBJECT
+ public slots:
+ void onTst1() {}
+};
diff --git a/Tests/RunCMake/AutoExportDll/AutoExport.cmake b/Tests/RunCMake/AutoExportDll/AutoExport.cmake
new file mode 100644
index 0000000..3b2b2c5
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/AutoExport.cmake
@@ -0,0 +1,7 @@
+project(autoexport)
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${autoexport_BINARY_DIR}/bin)
+add_subdirectory(sub)
+add_library(autoexport SHARED hello.cxx world.cxx foo.c)
+add_executable(say say.cxx)
+target_link_libraries(say autoexport autoexport2)
diff --git a/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt b/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt
new file mode 100644
index 0000000..d483c2c
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/AutoExportBuild-stderr.txt
@@ -0,0 +1 @@
+^.*$
diff --git a/Tests/RunCMake/AutoExportDll/CMakeLists.txt b/Tests/RunCMake/AutoExportDll/CMakeLists.txt
new file mode 100644
index 0000000..18dfd26
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake
new file mode 100644
index 0000000..3784a6a
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake
@@ -0,0 +1,26 @@
+include(RunCMake)
+set(RunCMake_TEST_NO_CLEAN TRUE)
+set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/AutoExport-build")
+# start by cleaning up because we don't clean up along the way
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+# configure the AutoExport test
+run_cmake(AutoExport)
+unset(RunCMake_TEST_OPTIONS)
+# don't run this test on VS 6 as it is not supported
+if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 6|Watcom WMake|Borland Makefiles")
+ return()
+endif()
+# we build debug so the say.exe will be found in Debug/say.exe for
+# Visual Studio generators
+if("${RunCMake_GENERATOR}" MATCHES "Visual Studio|Xcode")
+ set(INTDIR "Debug/")
+endif()
+# build AutoExport
+run_cmake_command(AutoExportBuild ${CMAKE_COMMAND} --build
+ ${RunCMake_TEST_BINARY_DIR} --config Debug --clean-first)
+# run the executable that uses symbols from the dll
+if(WIN32)
+ set(EXE_EXT ".exe")
+endif()
+run_cmake_command(AutoExportRun
+ ${RunCMake_BINARY_DIR}/AutoExport-build/bin/${INTDIR}say${EXE_EXT})
diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c
new file mode 100644
index 0000000..4b1318b
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/foo.c
@@ -0,0 +1,15 @@
+#ifdef _MSC_VER
+#include "windows.h"
+#else
+#define WINAPI
+#endif
+
+int WINAPI foo()
+{
+ return 10;
+}
+
+int bar()
+{
+ return 5;
+}
diff --git a/Tests/RunCMake/AutoExportDll/hello.cxx b/Tests/RunCMake/AutoExportDll/hello.cxx
new file mode 100644
index 0000000..3933fc1
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/hello.cxx
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include "hello.h"
+int Hello::Data = 0;
+void Hello::real()
+{
+ return;
+}
+void hello()
+{
+ printf("hello");
+}
+void Hello::operator delete[](void*) {};
+void Hello::operator delete(void*) {};
diff --git a/Tests/RunCMake/AutoExportDll/hello.h b/Tests/RunCMake/AutoExportDll/hello.h
new file mode 100644
index 0000000..3749b97
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/hello.h
@@ -0,0 +1,18 @@
+#ifndef _MSC_VER
+#define winexport
+#else
+#ifdef autoexport_EXPORTS
+#define winexport
+#else
+#define winexport __declspec(dllimport)
+#endif
+#endif
+
+class Hello
+{
+public:
+ static winexport int Data;
+ void real();
+ static void operator delete[](void*);
+ static void operator delete(void*);
+};
diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx
new file mode 100644
index 0000000..655b3c2
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/say.cxx
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include "hello.h"
+#ifdef _MSC_VER
+#include "windows.h"
+#else
+#define WINAPI
+#endif
+
+extern "C"
+{
+// test __cdecl stuff
+ int WINAPI foo();
+// test regular C
+ int bar();
+}
+
+// test c++ functions
+// forward declare hello and world
+void hello();
+void world();
+
+int main()
+{
+ // test static data (needs declspec to work)
+ Hello::Data = 120;
+ Hello h;
+ h.real();
+ hello();
+ printf(" ");
+ world();
+ printf("\n");
+ foo();
+ printf("\n");
+ bar();
+ printf("\n");
+ return 0;
+}
diff --git a/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt b/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt
new file mode 100644
index 0000000..8b70e7d
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/sub/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_library(autoexport2 SHARED sub.cxx)
+if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ # Try msvc "big" object format.
+ target_compile_options(autoexport2 PRIVATE /bigobj)
+endif()
diff --git a/Tests/RunCMake/AutoExportDll/sub/sub.cxx b/Tests/RunCMake/AutoExportDll/sub/sub.cxx
new file mode 100644
index 0000000..9766b41
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/sub/sub.cxx
@@ -0,0 +1,4 @@
+int sub()
+{
+ return 10;
+}
diff --git a/Tests/RunCMake/AutoExportDll/world.cxx b/Tests/RunCMake/AutoExportDll/world.cxx
new file mode 100644
index 0000000..3a54df3
--- /dev/null
+++ b/Tests/RunCMake/AutoExportDll/world.cxx
@@ -0,0 +1,6 @@
+#include "stdio.h"
+
+void world()
+{
+ printf("world");
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 592b5e4..b90eff6 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -26,6 +26,43 @@ macro(add_RunCMake_test test)
)
endmacro()
+function(add_RunCMake_test_group test types)
+ # create directory for common content
+ set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf")
+ file(REMOVE_RECURSE "${TEST_CONFIG_DIR}")
+ file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}")
+
+ foreach(type IN LISTS types)
+ # generate prerequirements config file in cmake as ctest doesn't have as
+ # much system information so it is easier to set programs and environment
+ # values here
+ unset(${test}_${type}_FOUND_PREREQUIREMENTS)
+ include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake")
+ get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS"
+ "${TEST_CONFIG_DIR}/${type}_config.cmake")
+
+ # only add the test if prerequirements are met
+ if(${test}_${type}_FOUND_PREREQUIREMENTS)
+ add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND}
+ -DTEST_TYPE=${type}
+ -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
+ -DRunCMake_GENERATOR=${CMAKE_GENERATOR}
+ -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
+ -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET}
+ -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
+ -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}
+ -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test}
+ -Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake
+ -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake"
+ )
+ endif()
+ endforeach()
+endfunction()
+
+if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 6.1)
+ set(Swift_ARGS -DXCODE_BELOW_6_1=1)
+endif()
+
if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3)
set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1)
endif()
@@ -95,9 +132,11 @@ add_RunCMake_test(FPHSA)
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorPlatform)
add_RunCMake_test(GeneratorToolset)
+add_RunCMake_test(GNUInstallDirs)
add_RunCMake_test(TargetPropertyGeneratorExpressions)
add_RunCMake_test(Languages)
add_RunCMake_test(ObjectLibrary)
+add_RunCMake_test(Swift)
add_RunCMake_test(TargetObjects)
add_RunCMake_test(TargetSources)
add_RunCMake_test(find_dependency)
@@ -146,6 +185,7 @@ add_RunCMake_test(list)
add_RunCMake_test(message)
add_RunCMake_test(project)
add_RunCMake_test(return)
+add_RunCMake_test(set_property)
add_RunCMake_test(string)
add_RunCMake_test(try_compile)
add_RunCMake_test(try_run)
@@ -206,10 +246,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES)
add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths)
-if(RPMBUILD_EXECUTABLE)
- add_RunCMake_test(CPackRPM)
-endif()
-
add_RunCMake_test(COMPILE_LANGUAGE-genex)
# Matlab module related tests
@@ -232,4 +268,10 @@ endif()
if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
add_executable(pseudo_iwyu pseudo_iwyu.c)
add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>)
+ add_RunCMake_test(CompilerLauncher)
endif()
+
+add_RunCMake_test_group(CPack "DEB;RPM")
+# add a test to make sure symbols are exported from a shared library
+# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
+add_RunCMake_test(AutoExportDll)
diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt
new file mode 100644
index 0000000..7905706
--- /dev/null
+++ b/Tests/RunCMake/CPack/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
+
+# include test generator specifics
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake")
+ include("${GENERATOR_TYPE}/${RunCMake_TEST}-specifics.cmake")
+endif()
+
+set(CPACK_GENERATOR "${GENERATOR_TYPE}")
+include(CPack)
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
new file mode 100644
index 0000000..7ea2a24
--- /dev/null
+++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
@@ -0,0 +1,76 @@
+cmake_policy(SET CMP0057 NEW)
+
+function(run_cpack_test TEST_NAME types build)
+ if(TEST_TYPE IN_LIST types)
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
+
+ # TODO this should be executed only once per ctest run (not per generator)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ # execute cmake
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" -DRunCMake_TEST=${TEST_NAME}
+ -DGENERATOR_TYPE=${TEST_TYPE} "${RunCMake_SOURCE_DIR}"
+ WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
+ ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt"
+ )
+
+ if(res)
+ run_cmake_command(
+ ${TEST_TYPE}/${TEST_NAME}
+ "${CMAKE_COMMAND}"
+ -DRunCMake_TEST_STEP=configure
+ -Dreturn_code=${res}
+ "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
+ -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake"
+ )
+ return()
+ endif()
+
+ # execute optional build step
+ if(build)
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" --build "${RunCMake_TEST_BINARY_DIR}"
+ RESULT_VARIABLE res
+ OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
+ ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt"
+ )
+ endif()
+
+ if(res)
+ run_cmake_command(
+ ${TEST_TYPE}/${TEST_NAME}
+ "${CMAKE_COMMAND}"
+ -DRunCMake_TEST_STEP=build
+ -Dreturn_code=${res}
+ "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
+ -P "${RunCMake_SOURCE_DIR}/PreTestError.cmake"
+ )
+ return()
+ endif()
+
+ # execute cpack
+ execute_process(
+ COMMAND "${CMAKE_CPACK_COMMAND}"
+ WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
+ OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
+ ERROR_FILE "${RunCMake_TEST_BINARY_DIR}/test_error.txt"
+ )
+
+ # verify result
+ run_cmake_command(
+ ${TEST_TYPE}/${TEST_NAME}
+ "${CMAKE_COMMAND}"
+ -DRunCMake_TEST=${TEST_NAME}
+ -DGENERATOR_TYPE=${TEST_TYPE}
+ "-Dsrc_dir=${RunCMake_SOURCE_DIR}"
+ "-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
+ "-Dconfig_file=${config_file}"
+ -P "${RunCMake_SOURCE_DIR}/VerifyResult.cmake"
+ )
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
new file mode 100644
index 0000000..4ed3fbd
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -0,0 +1,10 @@
+set(ALL_FILES_GLOB "*.deb")
+
+function(getPackageContent FILE RESULT_VAR)
+ execute_process(COMMAND ${DPKG_EXECUTABLE} -c ${FILE}
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake
new file mode 100644
index 0000000..9e4aa7c
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "minimal*.deb")
+set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
new file mode 100644
index 0000000..8821ab9
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
@@ -0,0 +1 @@
+set(CPACK_PACKAGE_CONTACT "someone")
diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
new file mode 100644
index 0000000..197b99d
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
@@ -0,0 +1,8 @@
+function(get_test_prerequirements found_var config_file)
+ find_program(DPKG_EXECUTABLE dpkg)
+
+ if(DPKG_EXECUTABLE)
+ file(WRITE "${config_file}" "set(DPKG_EXECUTABLE \"${DPKG_EXECUTABLE}\")")
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/MINIMAL.cmake b/Tests/RunCMake/CPack/MINIMAL.cmake
new file mode 100644
index 0000000..f29ad2a
--- /dev/null
+++ b/Tests/RunCMake/CPack/MINIMAL.cmake
@@ -0,0 +1,3 @@
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
+
+set(CPACK_PACKAGE_NAME "minimal")
diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake
index 31e729b..31e729b 100644
--- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake
+++ b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake
diff --git a/Tests/RunCMake/CPack/PreTestError.cmake b/Tests/RunCMake/CPack/PreTestError.cmake
new file mode 100644
index 0000000..f88f2e8
--- /dev/null
+++ b/Tests/RunCMake/CPack/PreTestError.cmake
@@ -0,0 +1,7 @@
+file(READ "${bin_dir}/test_output.txt" output)
+file(READ "${bin_dir}/test_error.txt" error)
+
+message(FATAL_ERROR "Error in pre-test phase '${RunCMake_TEST_STEP}'!\n"
+ "Return code: '${return_code}'\n"
+ "Info output: '${output}'\n"
+ "Error output: '${error}'")
diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt
new file mode 100644
index 0000000..365c737
--- /dev/null
+++ b/Tests/RunCMake/CPack/README.txt
@@ -0,0 +1,99 @@
+RunCMake.CPack is a test module that is intended for testing of package
+generators that can be validated from command line.
+
+-------------
+Adding a test
+-------------
+
+CPack test root directory: 'Tests/RunCMake/CPack'.
+
+All phases are executed separately for each generator that is bound to a test.
+Tests for each generator are subtests of test 'RunCMake.CPack_<generator_name>'.
+
+Each test must also be added to 'RunCMakeTest.cmake' script located in CPack
+test root directory.
+Line that adds a test is:
+run_cpack_test(<test_name> "<generator_name>")
+
+<generator_name> may be one generator e.g. "RPM" or multiple e.g. "RPM;DEB" and
+will be run for all listed generators.
+
+Test consists of
+- CMake execution phase
+- CPack execution phase
+- verification of generated files
+
+CMake execution phase:
+----------------------
+
+To add a new CPack test we first create a <test_name>.cmake script that contains
+CMake commands that should be used as a preparation script for generation of
+different types of packages. This script is placed into CPack test root
+directory even if it will be used for only one of the generators.
+
+If test will be used for multiple generators but some of them require some
+generator speciffic commands then those commands should be added to a separate
+file that should be located in '<generator_name>/<test_name>-specifics.cmake'
+in CPack test root directory.
+
+CPack execution phase:
+----------------------
+
+Only exececutes CPack for content that was generated during CMake execution
+phase.
+
+Verification of generated files:
+--------------------------------
+
+Verification of generated files consists of two phases
+- mandatory verification phase
+- optional verification phase
+
+Mandatory verification phase checks that expected files were generated and
+contain expected files.
+Mandatory verification phase also checks that no other unexpected package files
+were generated (this is executed even if EXPECTED_FILES_COUNT contains 0 in
+order to verify that no files were generated).
+CMake script '<generator_name>/<test_name>-ExpectedFiles.cmake' is required by
+this step and must contain
+- EXPECTED_FILES_COUNT variable that contains the number of expected files that
+ will be generated (0 or more)
+- EXPECTED_FILE_<file_number_starting_with_1> that contains globing expression
+ that uniquely defines expected file name (will be used to find expected file)
+ and should be present once for each expected file
+- EXPECTED_FILE_CONTENT_<file_number_starting_with_1> that contains regular
+ expression of files that should be present in generated file and should be
+ present once for each expected file
+
+Optional verification phase is generator specific and is optionaly executed.
+This phase is executed if '<generator_name>/<test_name>-VerifyResult.cmake'
+script exists.
+In case that the script doesn't exist VerifyResult.cmake script automatically
+prints out standard output and standard error from CPack execution phase that
+is compared with '<generator_name>/<test_name>-stdout.txt' regular expression
+and '<generator_name>/<test_name>-stderr.txt' regular expresson respectively.
+
+----------------------
+Adding a new generator
+----------------------
+
+To add a new generator we must
+- add new generator directory (e.g. RPM for RPM generator) to CPack test root
+ directory that contains 'Helpers.cmake' script. In this script a function
+ named 'getPackageContent' must exist. This function should list files that
+ are contained in a package. Function should accept two parameters
+ + FILE variable that will contain path to file for which the content should be
+ listed
+ + RESULT_VAR that will tell the function which variable in parent scope should
+ contain the result (list of files inside package file)
+- add 'Prerequirements.cmake' script to generator directory. In this script a
+ function named 'get_test_prerequirements' must exist. This function should
+ set a variable in parent scope (name of the variable is the first parameter)
+ that tells if prerequirements for test execution are met (certain programs,
+ OS specifics, ...) and create a config file (name of the variable which
+ contains file name and path is provided with the second parameter) that
+ should contain 'set' commands for variables that will later be used in tests
+ (e.g. location of dpkg program for DEB packages)
+- add tests the same way as described above
+- add generator to 'add_RunCMake_test_group' function call that is located in
+ RunCMake CMakeLists.txt file
diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake
new file mode 100644
index 0000000..98cdad8
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake
@@ -0,0 +1,10 @@
+set(ALL_FILES_GLOB "*.rpm")
+
+function(getPackageContent FILE RESULT_VAR)
+ execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE}
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake
new file mode 100644
index 0000000..800b78e
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "minimal*.rpm")
+set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt
new file mode 100644
index 0000000..7c5fb46
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt
@@ -0,0 +1 @@
+^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MINIMAL-build/_CPack_Packages/.*/RPM/SPECS/minimal.spec$
diff --git a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake
new file mode 100644
index 0000000..4e01f7b
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_1 "PARTIALLY_RELOCATABLE_WARNING-0.1.1-*.rpm")
+set(EXPECTED_FILE_CONTENT_1 "^/not_relocatable${whitespaces_}/not_relocatable/CMakeLists.txt${whitespaces_}/opt$")
diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt
index 3b63d5b..3b63d5b 100644
--- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING-stderr.txt
+++ b/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt
diff --git a/Tests/RunCMake/CPack/RPM/Prerequirements.cmake b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
new file mode 100644
index 0000000..3416205
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/Prerequirements.cmake
@@ -0,0 +1,16 @@
+function(get_test_prerequirements found_var config_file)
+ if(CMAKE_CURRENT_BINARY_DIR MATCHES " ")
+ # rpmbuild can't handle spaces in path
+ return()
+ endif()
+
+ find_program(RPM_EXECUTABLE rpm)
+ find_program(RPMBUILD_EXECUTABLE rpmbuild)
+
+ if(RPM_EXECUTABLE AND RPMBUILD_EXECUTABLE)
+ file(WRITE "${config_file}" "set(RPM_EXECUTABLE \"${RPM_EXECUTABLE}\")")
+ file(APPEND "${config_file}"
+ "\nset(RPMBUILD_EXECUTABLE \"${RPMBUILD_EXECUTABLE}\")")
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
new file mode 100644
index 0000000..308b8cc
--- /dev/null
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+include(RunCMake)
+include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
+
+# args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP
+run_cpack_test(MINIMAL "RPM;DEB" false)
+run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false)
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
new file mode 100644
index 0000000..809011b
--- /dev/null
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -0,0 +1,91 @@
+cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+
+include("${config_file}")
+include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake")
+
+file(READ "${bin_dir}/test_output.txt" output)
+file(READ "${bin_dir}/test_error.txt" error)
+file(READ "${config_file}" config_file_content)
+
+set(output_error_message
+ "\nCPack output: '${output}'\nCPack error: '${error}';\nconfig file: '${config_file_content}'")
+
+# check that expected generated files exist and contain expected content
+include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake")
+
+if(NOT EXPECTED_FILES_COUNT EQUAL 0)
+ foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT})
+ file(GLOB foundFile_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}")
+ set(foundFiles_ "${foundFiles_};${foundFile_}")
+ list(LENGTH foundFile_ foundFilesCount_)
+
+ if(foundFilesCount_ EQUAL 1)
+ unset(PACKAGE_CONTENT)
+ getPackageContent("${bin_dir}/${foundFile_}" "PACKAGE_CONTENT")
+
+ string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}"
+ expected_content_list "${PACKAGE_CONTENT}")
+
+ if(NOT expected_content_list)
+ message(FATAL_ERROR
+ "Unexpected file content for file No. '${file_no_}'!"
+ " Content: '${PACKAGE_CONTENT}'"
+ "${output_error_message}")
+ endif()
+ else()
+ message(FATAL_ERROR
+ "Found more than one file for file No. '${file_no_}'!"
+ " Found files count '${foundFilesCount_}'."
+ " Files: '${foundFile_}'"
+ "${output_error_message}")
+ endif()
+ endforeach()
+
+ # check that there were no extra files generated
+ foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB)
+ file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}")
+ set(allFoundFiles_ "${allFoundFiles_};${foundAll_}")
+ endforeach()
+
+ list(LENGTH foundFiles_ foundFilesCount_)
+ list(LENGTH allFoundFiles_ allFoundFilesCount_)
+
+ if(NOT foundFilesCount_ EQUAL allFoundFilesCount_)
+ message(FATAL_ERROR
+ "Found more files than expected! Found files: '${allFoundFiles_}'"
+ "${output_error_message}")
+ endif()
+
+ # sanity check that we didn't accidentaly list wrong files with our regular
+ # expressions
+ foreach(expected_ IN LISTS allFoundFiles_)
+ list(FIND foundFiles_ "${expected_}" found_)
+
+ if(found_ EQUAL -1)
+ message(FATAL_ERROR
+ "Expected files don't match found files! Found files:"
+ " '${allFoundFiles_}'"
+ "${output_error_message}")
+ endif()
+ endforeach()
+else()
+ # there should be no generated files present
+ foreach(missing_file_glob_ IN LISTS ALL_FILES_GLOB)
+ file(GLOB checkMissingFiles_ RELATIVE "${bin_dir}" "${missing_file_glob_}")
+
+ if(checkMissingFiles_)
+ message(FATAL_ERROR "Unexpected files found: '${checkMissingFiles_}'"
+ "${output_error_message}")
+ endif()
+ endforeach()
+endif()
+
+# handle additional result verifications
+if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake")
+ include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-VerifyResult.cmake")
+else()
+ # by default only print out output and error so that they can be compared by
+ # regex
+ message(STATUS "${output}")
+ message("${error}")
+endif()
diff --git a/Tests/RunCMake/CPackRPM/CMakeLists.txt b/Tests/RunCMake/CPackRPM/CMakeLists.txt
deleted file mode 100644
index b7d170b..0000000
--- a/Tests/RunCMake/CPackRPM/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
-project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake)
-
-set(CPACK_GENERATOR "RPM")
-include(CPack)
diff --git a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake b/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake
deleted file mode 100644
index 1935e32..0000000
--- a/Tests/RunCMake/CPackRPM/RunCMakeTest.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-include(RunCMake)
-
-function(run_cpack_rpm_test TEST_NAME)
- set(RunCMake_TEST_NO_CLEAN TRUE)
- set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
- file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
- file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
- execute_process(
- COMMAND "${CMAKE_COMMAND}" -D RunCMake_TEST=${TEST_NAME} "${RunCMake_SOURCE_DIR}"
- WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
- OUTPUT_QUIET
- ERROR_QUIET
- )
- run_cmake_command(${TEST_NAME} ${CMAKE_CPACK_COMMAND})
-endfunction()
-
-run_cpack_rpm_test(CPackRPM_PARTIALLY_RELOCATABLE_WARNING)
diff --git a/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt
new file mode 100644
index 0000000..7fe04eb
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt
@@ -0,0 +1,7 @@
+100% tests passed, 0 tests failed out of 4
++
++Label Time Summary:
++'bar' = +[0-9.]+ sec \(3 tests\)
++'foo' = +[0-9.]+ sec \(1 test\)
++
+Total Test time \(real\) = +[0-9.]+ sec
diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt
new file mode 100644
index 0000000..af7cdc5
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/MergeOutput-stdout.txt
@@ -0,0 +1,13 @@
+Test timeout computed to be: [^
+]+
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1: -- Output on stdout
+1: Output on stderr
+1/1 Test #1: MergeOutput
diff --git a/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake
new file mode 100644
index 0000000..528ac90
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/MergeOutput.cmake
@@ -0,0 +1,4 @@
+foreach(i RANGE 1 5)
+ message(STATUS "Output on stdout")
+ message("Output on stderr")
+endforeach()
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 0cb11ac..dfc1e33 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -1,4 +1,5 @@
include(RunCMake)
+set(RunCMake_TEST_TIMEOUT 60)
unset(ENV{CTEST_PARALLEL_LEVEL})
unset(ENV{CTEST_OUTPUT_ON_FAILURE})
@@ -39,3 +40,71 @@ subdirs()
run_cmake_command(BadCTestTestfile ${CMAKE_CTEST_COMMAND})
endfunction()
run_BadCTestTestfile()
+
+function(run_MergeOutput)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MergeOutput)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutput.cmake\")
+")
+
+ run_cmake_command(MergeOutput ${CMAKE_CTEST_COMMAND} -V)
+endfunction()
+run_MergeOutput()
+
+function(run_LabelCount)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LabelCount)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+add_test(test1 \"${CMAKE_COMMAND}\" -E echo \"test1\")
+set_tests_properties(test1 PROPERTIES LABELS 'bar')
+
+add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"test2\")
+set_tests_properties(test2 PROPERTIES LABELS 'bar')
+
+add_test(test3 \"${CMAKE_COMMAND}\" -E echo \"test3\")
+set_tests_properties(test3 PROPERTIES LABELS 'foo')
+
+add_test(test4 \"${CMAKE_COMMAND}\" -E echo \"test4\")
+set_tests_properties(test4 PROPERTIES LABELS 'bar')
+")
+
+ run_cmake_command(LabelCount ${CMAKE_CTEST_COMMAND} -V)
+endfunction()
+
+run_LabelCount()
+
+function(run_TestLoad name load)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+ add_test(TestLoad1 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\")
+ add_test(TestLoad2 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\")
+")
+ run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load} --test-timeout 5)
+endfunction()
+
+# Tests for the --test-load feature of ctest
+#
+# Spoof a load average value to make these tests more reliable.
+set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5)
+
+# Verify that new tests are not started when the load average exceeds
+# our threshold.
+run_TestLoad(test-load-fail 2)
+
+# Verify that warning message is displayed but tests still start when
+# an invalid argument is given.
+run_TestLoad(test-load-invalid 'two')
+
+# Verify that new tests are started when the load average falls below
+# our threshold.
+run_TestLoad(test-load-pass 10)
+
+unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING})
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt
new file mode 100644
index 0000000..eafba1c
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stderr.txt
@@ -0,0 +1 @@
+No tests were found!!!
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt
new file mode 100644
index 0000000..153da09
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test-load-fail-stdout.txt
@@ -0,0 +1,2 @@
+^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
+\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test TestLoad[1-2] requires 1\*\*\*\*\*
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt
new file mode 100644
index 0000000..caab3b9
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stderr.txt
@@ -0,0 +1 @@
+Invalid value for 'Test Load' : 'two'
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt
new file mode 100644
index 0000000..7ee3dae
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt
@@ -0,0 +1,7 @@
+^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
+ Start 1: TestLoad1
+ Start 2: TestLoad2
+1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
+2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt
new file mode 100644
index 0000000..7ee3dae
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt
@@ -0,0 +1,7 @@
+^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
+ Start 1: TestLoad1
+ Start 2: TestLoad2
+1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
+2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
diff --git a/Tests/RunCMake/CommandLine/BuildDir.cmake b/Tests/RunCMake/CommandLine/BuildDir.cmake
new file mode 100644
index 0000000..30030a7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir.cmake
@@ -0,0 +1 @@
+add_subdirectory(BuildDir)
diff --git a/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
new file mode 100644
index 0000000..20df108
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/BuildDir/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_custom_command(
+ OUTPUT output.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ )
+add_custom_target(CustomTarget ALL DEPENDS output.txt)
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 69beed9..84d4cc9 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -22,13 +22,30 @@ run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -G NoSuchGenerator)
run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P)
run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake)
+run_cmake_command(build-no-dir
+ ${CMAKE_COMMAND} --build)
run_cmake_command(build-no-cache
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
run_cmake_command(build-no-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator)
+run_cmake_command(build-bad-dir
+ ${CMAKE_COMMAND} --build dir-does-not-exist)
run_cmake_command(build-bad-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
+function(run_BuildDir)
+ # Use a single build tree for a few tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+ run_cmake(BuildDir)
+ run_cmake_command(BuildDir--build ${CMAKE_COMMAND} -E chdir ..
+ ${CMAKE_COMMAND} --build BuildDir-build --target CustomTarget)
+endfunction()
+run_BuildDir()
+
if(RunCMake_GENERATOR STREQUAL "Ninja")
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)
diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-result.txt b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-bad-dir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt
new file mode 100644
index 0000000..d3f3d9c
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-bad-dir-stderr.txt
@@ -0,0 +1,2 @@
+^Error: [^
+]+/Tests/RunCMake/CommandLine/build-bad-dir-build/dir-does-not-exist is not a directory$
diff --git a/Tests/RunCMake/CommandLine/build-no-dir-result.txt b/Tests/RunCMake/CommandLine/build-no-dir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-no-dir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt
new file mode 100644
index 0000000..8d518f6
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-no-dir-stderr.txt
@@ -0,0 +1 @@
+^Usage: cmake --build <dir> \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/C-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/C-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/C-launch.cmake b/Tests/RunCMake/CompilerLauncher/C-launch.cmake
new file mode 100644
index 0000000..e66ca20
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/C-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(C.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/C.cmake b/Tests/RunCMake/CompilerLauncher/C.cmake
new file mode 100644
index 0000000..67bf7c4
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/C.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/CompilerLauncher/CMakeLists.txt b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt
new file mode 100644
index 0000000..18dfd26
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/CXX-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt
new file mode 100644
index 0000000..3313e31
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/CXX-launch-Build-stdout.txt
@@ -0,0 +1 @@
+.*-E env USED_LAUNCHER=1.*
diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake
new file mode 100644
index 0000000..3002c9d
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/CXX-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(CXX.cmake)
diff --git a/Tests/RunCMake/CompilerLauncher/CXX.cmake b/Tests/RunCMake/CompilerLauncher/CXX.cmake
new file mode 100644
index 0000000..cdd3478
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/CXX.cmake
@@ -0,0 +1,4 @@
+enable_language(CXX)
+set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1")
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+add_executable(main main.cxx)
diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
new file mode 100644
index 0000000..5884d5c
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake
@@ -0,0 +1,23 @@
+include(RunCMake)
+
+function(run_compiler_launcher lang)
+ # Use a single build tree for tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(${lang})
+
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ if("${RunCMake_GENERATOR}" STREQUAL "Ninja")
+ set(verbose_args -- -v)
+ endif()
+ run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args})
+endfunction()
+
+run_compiler_launcher(C)
+run_compiler_launcher(CXX)
+if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
+ run_compiler_launcher(C-launch)
+ run_compiler_launcher(CXX-launch)
+endif()
diff --git a/Tests/RunCMake/CompilerLauncher/main.c b/Tests/RunCMake/CompilerLauncher/main.c
new file mode 100644
index 0000000..03b2213
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/main.c
@@ -0,0 +1,3 @@
+int main(void) {
+ return 0;
+}
diff --git a/Tests/RunCMake/CompilerLauncher/main.cxx b/Tests/RunCMake/CompilerLauncher/main.cxx
new file mode 100644
index 0000000..76e8197
--- /dev/null
+++ b/Tests/RunCMake/CompilerLauncher/main.cxx
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index e038409..47d6129 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -11,3 +11,4 @@ run_cmake(Add_StepDependencies)
run_cmake(Add_StepDependencies_iface)
run_cmake(Add_StepDependencies_iface_step)
run_cmake(Add_StepDependencies_no_target)
+run_cmake(UsesTerminal)
diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake
new file mode 100644
index 0000000..201d822
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/UsesTerminal-check.cmake
@@ -0,0 +1,97 @@
+cmake_minimum_required(VERSION 3.3)
+
+# If we are using the Ninja generator, we can check and verify that the
+# USES_TERMINAL option actually works by examining the Ninja build file.
+# This is the only way, since CMake doesn't offer a way to examine the
+# options on a custom command after it has been added. Furthermore,
+# there isn't an easy way to test for this by actually running Ninja.
+#
+# Other generators don't currently support USES_TERMINAL at this time.
+# This file can be improved to support them if they do. Until then, we
+# simply assume success for new generator types.
+#
+# For Ninja, there is a complication. If the Ninja generator detects a
+# version of Ninja < 1.5, it won't actually emit the console pool command,
+# because those Ninja versions don't yet support the console pool. In
+# that case, we also have to assume success.
+
+# Check Ninja build output to verify whether or not a target step is in the
+# console pool.
+macro(CheckNinjaStep _target _step _require)
+ if("${_build}" MATCHES
+" DESC = Performing ${_step} step for '${_target}'
+ pool = console"
+ )
+ if(NOT ${_require})
+ set(RunCMake_TEST_FAILED "${_target} ${_step} step is in console pool")
+ return()
+ endif()
+ else()
+ if(${_require})
+ set(RunCMake_TEST_FAILED "${_target} ${_step} step not in console pool")
+ return()
+ endif()
+ endif()
+endmacro()
+
+# Check Ninja build output to verify whether each target step is in the
+# console pool.
+macro(CheckNinjaTarget _target
+ _download _update _configure _build _test _install
+ )
+ CheckNinjaStep(${_target} download ${_download})
+ CheckNinjaStep(${_target} update ${_update})
+ CheckNinjaStep(${_target} configure ${_configure})
+ CheckNinjaStep(${_target} build ${_build})
+ CheckNinjaStep(${_target} test ${_test})
+ CheckNinjaStep(${_target} install ${_install})
+endmacro()
+
+# Load build/make file, depending on generator
+if(RunCMake_GENERATOR STREQUAL Ninja)
+ # Check the Ninja version. If < 1.5, console pool isn't supported and
+ # so the generator would not emit console pool usage. That would cause
+ # this test to fail.
+ execute_process(COMMAND ${RunCMake_MAKE_PROGRAM} --version
+ RESULT_VARIABLE _version_result
+ OUTPUT_VARIABLE _version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(_version_result OR _version VERSION_EQUAL "0")
+ set(RunCMake_TEST_FAILED "Failed to get Ninja version")
+ return()
+ endif()
+ if(_version VERSION_LESS "1.5")
+ return() # console pool not supported on Ninja < 1.5
+ endif()
+
+ # Read the Ninja build file
+ set(_build_file "${RunCMake_TEST_BINARY_DIR}/build.ninja")
+
+ if(NOT EXISTS "${_build_file}")
+ set(RunCMake_TEST_FAILED "Ninja build file not created")
+ return()
+ endif()
+
+ file(READ "${_build_file}" _build)
+
+ set(_target_check_macro CheckNinjaTarget)
+elseif((RunCMake_GENERATOR STREQUAL "") OR NOT DEFINED RunCMake_GENERATOR)
+ # protection in case somebody renamed RunCMake_GENERATOR
+ set(RunCMake_TEST_FAILED "Unknown generator")
+ return()
+else()
+ # We don't yet know how to test USES_TERMINAL on this generator.
+ return()
+endif()
+
+# Actual tests:
+CheckNinjaTarget(TerminalTest1
+ true true true true true true )
+CheckNinjaTarget(TerminalTest2
+ true false true false true false)
+CheckNinjaTarget(TerminalTest3
+ false true false true false true )
+CheckNinjaTarget(TerminalTest4
+ false false false false false false)
diff --git a/Tests/RunCMake/ExternalProject/UsesTerminal.cmake b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake
new file mode 100644
index 0000000..cd87403
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/UsesTerminal.cmake
@@ -0,0 +1,45 @@
+if(NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+include(ExternalProject)
+
+# Test various combinations of USES_TERMINAL with ExternalProject_Add.
+
+macro(DoTerminalTest _target)
+ ExternalProject_Add(${_target}
+ DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download"
+ UPDATE_COMMAND "${CMAKE_COMMAND}" -E echo "update"
+ CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo "configure"
+ BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build"
+ TEST_COMMAND "${CMAKE_COMMAND}" -E echo "test"
+ INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "install"
+ ${ARGN}
+ )
+endmacro()
+
+# USES_TERMINAL on all steps
+DoTerminalTest(TerminalTest1
+ USES_TERMINAL_DOWNLOAD 1
+ USES_TERMINAL_UPDATE 1
+ USES_TERMINAL_CONFIGURE 1
+ USES_TERMINAL_BUILD 1
+ USES_TERMINAL_TEST 1
+ USES_TERMINAL_INSTALL 1
+ )
+
+# USES_TERMINAL on every other step, starting with download
+DoTerminalTest(TerminalTest2
+ USES_TERMINAL_DOWNLOAD 1
+ USES_TERMINAL_CONFIGURE 1
+ USES_TERMINAL_TEST 1
+ )
+
+# USES_TERMINAL on every other step, starting with update
+DoTerminalTest(TerminalTest3
+ USES_TERMINAL_UPDATE 1
+ USES_TERMINAL_BUILD 1
+ USES_TERMINAL_INSTALL 1
+ )
+
+# USES_TERMINAL on no step
+DoTerminalTest(TerminalTest4)
diff --git a/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/GNUInstallDirs/Common.cmake b/Tests/RunCMake/GNUInstallDirs/Common.cmake
new file mode 100644
index 0000000..eff2d54
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Common.cmake
@@ -0,0 +1,28 @@
+set(CMAKE_SIZEOF_VOID_P 8)
+set(CMAKE_LIBRARY_ARCHITECTURE "arch")
+if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ set(CMAKE_SYSTEM_NAME "OpenBSD-Fake")
+endif()
+include(GNUInstallDirs)
+set(dirs
+ BINDIR
+ DATADIR
+ DATAROOTDIR
+ DOCDIR
+ INCLUDEDIR
+ INFODIR
+ LIBDIR
+ LIBEXECDIR
+ LOCALEDIR
+ LOCALSTATEDIR
+ MANDIR
+ SBINDIR
+ SHAREDSTATEDIR
+ SYSCONFDIR
+ )
+foreach(dir ${dirs})
+ message("CMAKE_INSTALL_${dir}='${CMAKE_INSTALL_${dir}}'")
+endforeach()
+foreach(dir ${dirs})
+ message("CMAKE_INSTALL_FULL_${dir}='${CMAKE_INSTALL_FULL_${dir}}'")
+endforeach()
diff --git a/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt
new file mode 100644
index 0000000..aee8552
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Opt-stderr.txt
@@ -0,0 +1,28 @@
+^CMAKE_INSTALL_BINDIR='bin'
+CMAKE_INSTALL_DATADIR='share'
+CMAKE_INSTALL_DATAROOTDIR='share'
+CMAKE_INSTALL_DOCDIR='share/doc/Opt'
+CMAKE_INSTALL_INCLUDEDIR='include'
+CMAKE_INSTALL_INFODIR='share/info'
+CMAKE_INSTALL_LIBDIR='(lib|lib64)'
+CMAKE_INSTALL_LIBEXECDIR='libexec'
+CMAKE_INSTALL_LOCALEDIR='share/locale'
+CMAKE_INSTALL_LOCALSTATEDIR='var'
+CMAKE_INSTALL_MANDIR='share/man'
+CMAKE_INSTALL_SBINDIR='sbin'
+CMAKE_INSTALL_SHAREDSTATEDIR='com'
+CMAKE_INSTALL_SYSCONFDIR='etc'
+CMAKE_INSTALL_FULL_BINDIR='/opt/Opt/bin'
+CMAKE_INSTALL_FULL_DATADIR='/opt/Opt/share'
+CMAKE_INSTALL_FULL_DATAROOTDIR='/opt/Opt/share'
+CMAKE_INSTALL_FULL_DOCDIR='/opt/Opt/share/doc/Opt'
+CMAKE_INSTALL_FULL_INCLUDEDIR='/opt/Opt/include'
+CMAKE_INSTALL_FULL_INFODIR='/opt/Opt/share/info'
+CMAKE_INSTALL_FULL_LIBDIR='/opt/Opt/(lib|lib64)'
+CMAKE_INSTALL_FULL_LIBEXECDIR='/opt/Opt/libexec'
+CMAKE_INSTALL_FULL_LOCALEDIR='/opt/Opt/share/locale'
+CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var/opt/Opt'
+CMAKE_INSTALL_FULL_MANDIR='/opt/Opt/share/man'
+CMAKE_INSTALL_FULL_SBINDIR='/opt/Opt/sbin'
+CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/opt/Opt/com'
+CMAKE_INSTALL_FULL_SYSCONFDIR='/etc/opt/Opt'$
diff --git a/Tests/RunCMake/GNUInstallDirs/Opt.cmake b/Tests/RunCMake/GNUInstallDirs/Opt.cmake
new file mode 100644
index 0000000..49eab0e
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Opt.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}")
+include(Common.cmake)
diff --git a/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt
new file mode 100644
index 0000000..a95400e
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Root-stderr.txt
@@ -0,0 +1,28 @@
+^CMAKE_INSTALL_BINDIR='usr/bin'
+CMAKE_INSTALL_DATADIR='usr/share'
+CMAKE_INSTALL_DATAROOTDIR='usr/share'
+CMAKE_INSTALL_DOCDIR='usr/share/doc/Root'
+CMAKE_INSTALL_INCLUDEDIR='usr/include'
+CMAKE_INSTALL_INFODIR='usr/share/info'
+CMAKE_INSTALL_LIBDIR='usr/(lib|lib64)'
+CMAKE_INSTALL_LIBEXECDIR='usr/libexec'
+CMAKE_INSTALL_LOCALEDIR='usr/share/locale'
+CMAKE_INSTALL_LOCALSTATEDIR='var'
+CMAKE_INSTALL_MANDIR='usr/share/man'
+CMAKE_INSTALL_SBINDIR='usr/sbin'
+CMAKE_INSTALL_SHAREDSTATEDIR='usr/com'
+CMAKE_INSTALL_SYSCONFDIR='etc'
+CMAKE_INSTALL_FULL_BINDIR='/usr/bin'
+CMAKE_INSTALL_FULL_DATADIR='/usr/share'
+CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share'
+CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Root'
+CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include'
+CMAKE_INSTALL_FULL_INFODIR='/usr/share/info'
+CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64)'
+CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
+CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
+CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
+CMAKE_INSTALL_FULL_MANDIR='/usr/share/man'
+CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin'
+CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com'
+CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$
diff --git a/Tests/RunCMake/GNUInstallDirs/Root.cmake b/Tests/RunCMake/GNUInstallDirs/Root.cmake
new file mode 100644
index 0000000..f8cc641
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Root.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_INSTALL_PREFIX "/")
+include(Common.cmake)
diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake
new file mode 100644
index 0000000..f88569a
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(Opt)
+run_cmake(Root)
+run_cmake(Usr)
+run_cmake(UsrLocal)
diff --git a/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt
new file mode 100644
index 0000000..e10c4c5
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Usr-stderr.txt
@@ -0,0 +1,28 @@
+^CMAKE_INSTALL_BINDIR='bin'
+CMAKE_INSTALL_DATADIR='share'
+CMAKE_INSTALL_DATAROOTDIR='share'
+CMAKE_INSTALL_DOCDIR='share/doc/Usr'
+CMAKE_INSTALL_INCLUDEDIR='include'
+CMAKE_INSTALL_INFODIR='share/info'
+CMAKE_INSTALL_LIBDIR='(lib|lib64|lib/arch)'
+CMAKE_INSTALL_LIBEXECDIR='libexec'
+CMAKE_INSTALL_LOCALEDIR='share/locale'
+CMAKE_INSTALL_LOCALSTATEDIR='var'
+CMAKE_INSTALL_MANDIR='share/man'
+CMAKE_INSTALL_SBINDIR='sbin'
+CMAKE_INSTALL_SHAREDSTATEDIR='com'
+CMAKE_INSTALL_SYSCONFDIR='etc'
+CMAKE_INSTALL_FULL_BINDIR='/usr/bin'
+CMAKE_INSTALL_FULL_DATADIR='/usr/share'
+CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/share'
+CMAKE_INSTALL_FULL_DOCDIR='/usr/share/doc/Usr'
+CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/include'
+CMAKE_INSTALL_FULL_INFODIR='/usr/share/info'
+CMAKE_INSTALL_FULL_LIBDIR='/usr/(lib|lib64|lib/arch)'
+CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/libexec'
+CMAKE_INSTALL_FULL_LOCALEDIR='/usr/share/locale'
+CMAKE_INSTALL_FULL_LOCALSTATEDIR='/var'
+CMAKE_INSTALL_FULL_MANDIR='/usr/share/man'
+CMAKE_INSTALL_FULL_SBINDIR='/usr/sbin'
+CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/com'
+CMAKE_INSTALL_FULL_SYSCONFDIR='/etc'$
diff --git a/Tests/RunCMake/GNUInstallDirs/Usr.cmake b/Tests/RunCMake/GNUInstallDirs/Usr.cmake
new file mode 100644
index 0000000..62b7288
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/Usr.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_INSTALL_PREFIX "/usr")
+include(Common.cmake)
diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt
new file mode 100644
index 0000000..8dcf25b
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal-stderr.txt
@@ -0,0 +1,28 @@
+^CMAKE_INSTALL_BINDIR='bin'
+CMAKE_INSTALL_DATADIR='share'
+CMAKE_INSTALL_DATAROOTDIR='share'
+CMAKE_INSTALL_DOCDIR='share/doc/UsrLocal'
+CMAKE_INSTALL_INCLUDEDIR='include'
+CMAKE_INSTALL_INFODIR='share/info'
+CMAKE_INSTALL_LIBDIR='(lib|lib64)'
+CMAKE_INSTALL_LIBEXECDIR='libexec'
+CMAKE_INSTALL_LOCALEDIR='share/locale'
+CMAKE_INSTALL_LOCALSTATEDIR='var'
+CMAKE_INSTALL_MANDIR='share/man'
+CMAKE_INSTALL_SBINDIR='sbin'
+CMAKE_INSTALL_SHAREDSTATEDIR='com'
+CMAKE_INSTALL_SYSCONFDIR='etc'
+CMAKE_INSTALL_FULL_BINDIR='/usr/local/bin'
+CMAKE_INSTALL_FULL_DATADIR='/usr/local/share'
+CMAKE_INSTALL_FULL_DATAROOTDIR='/usr/local/share'
+CMAKE_INSTALL_FULL_DOCDIR='/usr/local/share/doc/UsrLocal'
+CMAKE_INSTALL_FULL_INCLUDEDIR='/usr/local/include'
+CMAKE_INSTALL_FULL_INFODIR='/usr/local/share/info'
+CMAKE_INSTALL_FULL_LIBDIR='/usr/local/(lib|lib64)'
+CMAKE_INSTALL_FULL_LIBEXECDIR='/usr/local/libexec'
+CMAKE_INSTALL_FULL_LOCALEDIR='/usr/local/share/locale'
+CMAKE_INSTALL_FULL_LOCALSTATEDIR='/usr/local/var'
+CMAKE_INSTALL_FULL_MANDIR='/usr/local/share/man'
+CMAKE_INSTALL_FULL_SBINDIR='/usr/local/sbin'
+CMAKE_INSTALL_FULL_SHAREDSTATEDIR='/usr/local/com'
+CMAKE_INSTALL_FULL_SYSCONFDIR='/usr/local/etc'$
diff --git a/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake
new file mode 100644
index 0000000..59d9331
--- /dev/null
+++ b/Tests/RunCMake/GNUInstallDirs/UsrLocal.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_INSTALL_PREFIX "/usr/local")
+include(Common.cmake)
diff --git a/Tests/RunCMake/Languages/DetermineFail-result.txt b/Tests/RunCMake/Languages/DetermineFail-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Languages/DetermineFail-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Languages/DetermineFail-stderr.txt b/Tests/RunCMake/Languages/DetermineFail-stderr.txt
new file mode 100644
index 0000000..3b4743e
--- /dev/null
+++ b/Tests/RunCMake/Languages/DetermineFail-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at Modules/CMakeDetermineFailCompiler.cmake:[0-9]+ \(message\):
+ This language is not supported.
+Call Stack \(most recent call first\):
+ DetermineFail.cmake:[0-9]+ \(enable_language\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Languages/DetermineFail.cmake b/Tests/RunCMake/Languages/DetermineFail.cmake
new file mode 100644
index 0000000..3c8d17d
--- /dev/null
+++ b/Tests/RunCMake/Languages/DetermineFail.cmake
@@ -0,0 +1,2 @@
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
+enable_language(Fail)
diff --git a/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake
new file mode 100644
index 0000000..3b2d50a
--- /dev/null
+++ b/Tests/RunCMake/Languages/Modules/CMakeDetermineFailCompiler.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This language is not supported.")
diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake
index 6517a81..732baae 100644
--- a/Tests/RunCMake/Languages/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake
@@ -4,3 +4,5 @@ run_cmake(NoLangSHARED)
run_cmake(LINK_LANGUAGE-genex)
run_cmake(link-libraries-TARGET_FILE-genex)
run_cmake(link-libraries-TARGET_FILE-genex-ok)
+
+run_cmake(DetermineFail)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 70c0d6c..46bc494 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -66,6 +66,11 @@ function(run_cmake test)
else()
set(actual_stderr_var actual_stderr)
endif()
+ if(DEFINED RunCMake_TEST_TIMEOUT)
+ set(maybe_timeout TIMEOUT ${RunCMake_TEST_TIMEOUT})
+ else()
+ set(maybe_timeout "")
+ endif()
if(RunCMake_TEST_COMMAND)
execute_process(
COMMAND ${RunCMake_TEST_COMMAND}
@@ -73,6 +78,7 @@ function(run_cmake test)
OUTPUT_VARIABLE actual_stdout
ERROR_VARIABLE ${actual_stderr_var}
RESULT_VARIABLE actual_result
+ ${maybe_timeout}
)
else()
execute_process(
@@ -87,6 +93,7 @@ function(run_cmake test)
OUTPUT_VARIABLE actual_stdout
ERROR_VARIABLE ${actual_stderr_var}
RESULT_VARIABLE actual_result
+ ${maybe_timeout}
)
endif()
set(msg "")
diff --git a/Tests/RunCMake/Swift/CMakeLists.txt b/Tests/RunCMake/Swift/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/Swift/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Swift/Enable-stdout.txt b/Tests/RunCMake/Swift/Enable-stdout.txt
new file mode 100644
index 0000000..39e133f
--- /dev/null
+++ b/Tests/RunCMake/Swift/Enable-stdout.txt
@@ -0,0 +1 @@
+-- The Swift compiler identification is Apple
diff --git a/Tests/RunCMake/Swift/Enable.cmake b/Tests/RunCMake/Swift/Enable.cmake
new file mode 100644
index 0000000..19f297a
--- /dev/null
+++ b/Tests/RunCMake/Swift/Enable.cmake
@@ -0,0 +1 @@
+enable_language(Swift)
diff --git a/Tests/RunCMake/Swift/NotSupported-result.txt b/Tests/RunCMake/Swift/NotSupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Swift/NotSupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Swift/NotSupported-stderr.txt b/Tests/RunCMake/Swift/NotSupported-stderr.txt
new file mode 100644
index 0000000..9a9c23f
--- /dev/null
+++ b/Tests/RunCMake/Swift/NotSupported-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at .*/Modules/CMakeDetermineSwiftCompiler.cmake:[0-9]+ \(message\):
+ Swift language not supported by "[^"]*" generator
+Call Stack \(most recent call first\):
+ NotSupported.cmake:[0-9]+ \(enable_language\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Swift/NotSupported.cmake b/Tests/RunCMake/Swift/NotSupported.cmake
new file mode 100644
index 0000000..19f297a
--- /dev/null
+++ b/Tests/RunCMake/Swift/NotSupported.cmake
@@ -0,0 +1 @@
+enable_language(Swift)
diff --git a/Tests/RunCMake/Swift/RunCMakeTest.cmake b/Tests/RunCMake/Swift/RunCMakeTest.cmake
new file mode 100644
index 0000000..0a57121
--- /dev/null
+++ b/Tests/RunCMake/Swift/RunCMakeTest.cmake
@@ -0,0 +1,11 @@
+include(RunCMake)
+
+if(RunCMake_GENERATOR STREQUAL Xcode)
+ if(XCODE_BELOW_6_1)
+ run_cmake(XcodeTooOld)
+ else()
+ run_cmake(Enable)
+ endif()
+else()
+ run_cmake(NotSupported)
+endif()
diff --git a/Tests/RunCMake/Swift/XcodeTooOld-result.txt b/Tests/RunCMake/Swift/XcodeTooOld-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Swift/XcodeTooOld-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt b/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt
new file mode 100644
index 0000000..8d18f29
--- /dev/null
+++ b/Tests/RunCMake/Swift/XcodeTooOld-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at .*/Modules/CMakeDetermineSwiftCompiler.cmake:[0-9]+ \(message\):
+ Swift language not supported by Xcode [0-9.]+
+Call Stack \(most recent call first\):
+ XcodeTooOld.cmake:[0-9]+ \(enable_language\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Swift/XcodeTooOld.cmake b/Tests/RunCMake/Swift/XcodeTooOld.cmake
new file mode 100644
index 0000000..19f297a
--- /dev/null
+++ b/Tests/RunCMake/Swift/XcodeTooOld.cmake
@@ -0,0 +1 @@
+enable_language(Swift)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt
index b3f1e47..a845ffb 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-16-BE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt
index c08c902..cc4244b 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-16-LE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt
index 5dde4e3..5f851bf 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-32-BE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt
index eb054ec..d8fafd0 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-32-LE.cmake:
File
.*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake
starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt
index afd91f9..a288280 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace0.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt
index 826e511..391e11b 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace1.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt
index 23ecdcd..acaf7fe 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace2.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt
index 906d6fc..f12b2e5 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace3.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt
index a461e93..7157763 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace4.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt
index ff8bf1c..c13969d 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace5.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched-result.txt b/Tests/RunCMake/Syntax/FunctionUnmatched-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionUnmatched-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt
new file mode 100644
index 0000000..776a8f2
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionUnmatched-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(include\):
+ A logical block opening on the line
+
+ .*/Tests/RunCMake/Syntax/FunctionUnmatched.cmake:[0-9]+ \(function\)
+
+ is not closed.$
diff --git a/Tests/RunCMake/Syntax/FunctionUnmatched.cmake b/Tests/RunCMake/Syntax/FunctionUnmatched.cmake
new file mode 100644
index 0000000..515b6bf
--- /dev/null
+++ b/Tests/RunCMake/Syntax/FunctionUnmatched.cmake
@@ -0,0 +1,2 @@
+function(f)
+#endfunction() # missing
diff --git a/Tests/RunCMake/Syntax/MacroUnmatched-result.txt b/Tests/RunCMake/Syntax/MacroUnmatched-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroUnmatched-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt
new file mode 100644
index 0000000..1699c43
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroUnmatched-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(include\):
+ A logical block opening on the line
+
+ .*/Tests/RunCMake/Syntax/MacroUnmatched.cmake:[0-9]+ \(macro\)
+
+ is not closed.$
diff --git a/Tests/RunCMake/Syntax/MacroUnmatched.cmake b/Tests/RunCMake/Syntax/MacroUnmatched.cmake
new file mode 100644
index 0000000..302d96e
--- /dev/null
+++ b/Tests/RunCMake/Syntax/MacroUnmatched.cmake
@@ -0,0 +1,2 @@
+macro(m)
+#endmacro() # missing
diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
index 7ecfe11..37c5d6e 100644
--- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
@@ -1,9 +1,11 @@
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in ParenInENV.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at ParenInENV.cmake:2 \(message\):
diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt
index 64ef8b1..45b2e6a 100644
--- a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt
@@ -1,22 +1,28 @@
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in ParenNoSpace1.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in ParenNoSpace1.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in ParenNoSpace1.cmake:
Syntax Error in cmake code at
.*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index c431280..fd012b9 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -110,5 +110,7 @@ run_cmake(CMP0053-NameWithEscapedSpacesQuoted)
run_cmake(CMP0053-NameWithEscapedTabsQuoted)
# Function and macro tests.
+run_cmake(FunctionUnmatched)
run_cmake(FunctionUnmatchedForeach)
+run_cmake(MacroUnmatched)
run_cmake(MacroUnmatchedForeach)
diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
index 89c2d2a..a4ec6e7 100644
--- a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
+++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
@@ -1,17 +1,21 @@
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in StringNoSpace.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in StringNoSpace.cmake:
Syntax Warning in cmake code at
.*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31
Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
\[1 \${var} \\n 4\]
diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt
new file mode 100644
index 0000000..eafba1c
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stderr.txt
@@ -0,0 +1 @@
+No tests were found!!!
diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt
new file mode 100644
index 0000000..e203c10
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestTestLoadFail-stdout.txt
@@ -0,0 +1,2 @@
+Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadFail-build
+\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 4, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$
diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt
new file mode 100644
index 0000000..7f2d7f6
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stderr.txt
@@ -0,0 +1 @@
+^Invalid value for 'CTEST_TEST_LOAD' : ERR2
diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt
new file mode 100644
index 0000000..b54220c
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-stdout.txt
@@ -0,0 +1,7 @@
+Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadInvalid-build
+ Start 1: RunCMakeVersion
+1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 1
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt
new file mode 100644
index 0000000..c221eed
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/CTestTestLoadPass-stdout.txt
@@ -0,0 +1,7 @@
+Test project .*/Tests/RunCMake/ctest_test/CTestTestLoadPass-build
+ Start 1: RunCMakeVersion
+1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 1
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index d906290..21d0447 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -1,6 +1,8 @@
include(RunCTest)
+set(RunCMake_TEST_TIMEOUT 60)
set(CASE_CTEST_TEST_ARGS "")
+set(CASE_CTEST_TEST_LOAD "")
function(run_ctest_test CASE_NAME)
set(CASE_CTEST_TEST_ARGS "${ARGN}")
@@ -8,3 +10,42 @@ function(run_ctest_test CASE_NAME)
endfunction()
run_ctest_test(TestQuiet QUIET)
+
+# Tests for the 'Test Load' feature of ctest
+#
+# Spoof a load average value to make these tests more reliable.
+set(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING} 5)
+
+# Verify that new tests are started when the load average falls below
+# our threshold.
+run_ctest_test(TestLoadPass TEST_LOAD 6)
+
+# Verify that new tests are not started when the load average exceeds
+# our threshold.
+run_ctest_test(TestLoadFail TEST_LOAD 2)
+
+# Verify that when an invalid "TEST_LOAD" value is given, a warning
+# message is displayed and the value is ignored.
+run_ctest_test(TestLoadInvalid TEST_LOAD "ERR1")
+
+# Verify that new tests are started when the load average falls below
+# our threshold.
+set(CASE_CTEST_TEST_LOAD 7)
+run_ctest_test(CTestTestLoadPass)
+
+# Verify that new tests are not started when the load average exceeds
+# our threshold.
+set(CASE_CTEST_TEST_LOAD 4)
+run_ctest_test(CTestTestLoadFail)
+
+# Verify that when an invalid "CTEST_TEST_LOAD" value is given,
+# a warning message is displayed and the value is ignored.
+set(CASE_CTEST_TEST_LOAD "ERR2")
+run_ctest_test(CTestTestLoadInvalid)
+
+# Verify that the "TEST_LOAD" value has higher precedence than
+# the "CTEST_TEST_LOAD" value
+set(CASE_CTEST_TEST_LOAD "ERR3")
+run_ctest_test(TestLoadOrder TEST_LOAD "ERR4")
+
+unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING})
diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-result.txt b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadFail-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt
new file mode 100644
index 0000000..eafba1c
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadFail-stderr.txt
@@ -0,0 +1 @@
+No tests were found!!!
diff --git a/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt
new file mode 100644
index 0000000..4d7ce48
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadFail-stdout.txt
@@ -0,0 +1,2 @@
+Test project .*/Tests/RunCMake/ctest_test/TestLoadFail-build
+\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 2, Smallest test RunCMakeVersion requires 1\*\*\*\*\*$
diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt
new file mode 100644
index 0000000..40ddb3a
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stderr.txt
@@ -0,0 +1 @@
+^Invalid value for 'TEST_LOAD' : ERR1
diff --git a/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt
new file mode 100644
index 0000000..c4fd35b
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadInvalid-stdout.txt
@@ -0,0 +1,7 @@
+Test project .*/Tests/RunCMake/ctest_test/TestLoadInvalid-build
+ Start 1: RunCMakeVersion
+1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 1
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt
new file mode 100644
index 0000000..1de730e
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stderr.txt
@@ -0,0 +1 @@
+^Invalid value for 'TEST_LOAD' : ERR4
diff --git a/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt
new file mode 100644
index 0000000..22da092
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadOrder-stdout.txt
@@ -0,0 +1,7 @@
+Test project .*/Tests/RunCMake/ctest_test/TestLoadOrder-build
+ Start 1: RunCMakeVersion
+1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 1
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt
new file mode 100644
index 0000000..e5048f4
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestLoadPass-stdout.txt
@@ -0,0 +1,7 @@
+Test project .*/Tests/RunCMake/ctest_test/TestLoadPass-build
+ Start 1: RunCMakeVersion
+1/1 Test #1: RunCMakeVersion .................. Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 1
++
+Total Test time \(real\) = +[0-9.]+ sec$
diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in
index 1350abe..a8de6a3 100644
--- a/Tests/RunCMake/ctest_test/test.cmake.in
+++ b/Tests/RunCMake/ctest_test/test.cmake.in
@@ -8,6 +8,7 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+set(CTEST_TEST_LOAD "@CASE_CTEST_TEST_LOAD@")
set(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
ctest_start(Experimental)
diff --git a/Tests/RunCMake/set_property/CMakeLists.txt b/Tests/RunCMake/set_property/CMakeLists.txt
new file mode 100644
index 0000000..18dfd26
--- /dev/null
+++ b/Tests/RunCMake/set_property/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
new file mode 100644
index 0000000..994e874
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake
@@ -0,0 +1,7 @@
+add_custom_target(CustomTarget)
+set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES)
+set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES)
+get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES)
+if (NOT "${val}" STREQUAL "")
+ message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''")
+endif()
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
new file mode 100644
index 0000000..54e63f7
--- /dev/null
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(LINK_LIBRARIES)
diff --git a/Tests/RunCMake/string/Append.cmake b/Tests/RunCMake/string/Append.cmake
new file mode 100644
index 0000000..2634274
--- /dev/null
+++ b/Tests/RunCMake/string/Append.cmake
@@ -0,0 +1,58 @@
+set(out)
+string(APPEND out)
+if(DEFINED out)
+ message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
+endif()
+
+set(out "")
+string(APPEND out)
+if(NOT out STREQUAL "")
+ message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
+endif()
+
+set(out x)
+string(APPEND out)
+if(NOT out STREQUAL "x")
+ message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
+endif()
+
+
+set(out)
+string(APPEND out a)
+if(NOT out STREQUAL "a")
+ message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
+endif()
+
+set(out "")
+string(APPEND out a)
+if(NOT out STREQUAL "a")
+ message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
+endif()
+
+set(out x)
+string(APPEND out a)
+if(NOT out STREQUAL "xa")
+ message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
+endif()
+
+
+set(out x)
+string(APPEND out a "b")
+if(NOT out STREQUAL "xab")
+ message(FATAL_ERROR "\"string(APPEND out a \"b\")\" set out to \"${out}\"")
+endif()
+
+set(b)
+set(out x)
+string(APPEND out ${b})
+if(NOT out STREQUAL "x")
+ message(FATAL_ERROR "\"string(APPEND out \${b})\" set out to \"${out}\"")
+endif()
+
+set(b b)
+set(out x)
+string(APPEND out a "${b}" [[
+${c}]])
+if(NOT out STREQUAL "xab\${c}")
+ message(FATAL_ERROR "\"string(APPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"")
+endif()
diff --git a/Tests/RunCMake/string/AppendNoArgs-result.txt b/Tests/RunCMake/string/AppendNoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/string/AppendNoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/string/AppendNoArgs-stderr.txt b/Tests/RunCMake/string/AppendNoArgs-stderr.txt
new file mode 100644
index 0000000..75ad427
--- /dev/null
+++ b/Tests/RunCMake/string/AppendNoArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at AppendNoArgs.cmake:1 \(string\):
+ string sub-command APPEND requires at least one argument.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/string/AppendNoArgs.cmake b/Tests/RunCMake/string/AppendNoArgs.cmake
new file mode 100644
index 0000000..f54fb77
--- /dev/null
+++ b/Tests/RunCMake/string/AppendNoArgs.cmake
@@ -0,0 +1 @@
+string(APPEND)
diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake
index 89f7ea5..8067d9d 100644
--- a/Tests/RunCMake/string/RunCMakeTest.cmake
+++ b/Tests/RunCMake/string/RunCMakeTest.cmake
@@ -1,5 +1,8 @@
include(RunCMake)
+run_cmake(Append)
+run_cmake(AppendNoArgs)
+
run_cmake(Concat)
run_cmake(ConcatNoArgs)
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
index f97022e..533c6a1 100644
--- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -6,3 +6,4 @@ run_cmake(CMP0023-WARN-2)
run_cmake(CMP0023-NEW-2)
run_cmake(MixedSignature)
run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses)
+run_cmake(SubDirTarget)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
new file mode 100644
index 0000000..5cd1f23
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\):
+ Attempt to add link library "m" to target "subexe" which is not built in
+ this directory.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
new file mode 100644
index 0000000..32431ce
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_subdirectory(SubDirTarget)
+target_link_libraries(subexe m)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
new file mode 100644
index 0000000..b0b2380
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(subexe ../empty.c)
diff --git a/Tests/RunCMake/target_link_libraries/empty.c b/Tests/RunCMake/target_link_libraries/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty.c
diff --git a/Tests/SwiftMix/CMain.c b/Tests/SwiftMix/CMain.c
new file mode 100644
index 0000000..13e2f8c
--- /dev/null
+++ b/Tests/SwiftMix/CMain.c
@@ -0,0 +1,4 @@
+extern int ObjCMain(int argc, char const* const argv[]);
+int main(int argc, char* argv[]) {
+ return ObjCMain(argc, argv);
+}
diff --git a/Tests/SwiftMix/CMakeLists.txt b/Tests/SwiftMix/CMakeLists.txt
new file mode 100644
index 0000000..5e50470
--- /dev/null
+++ b/Tests/SwiftMix/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.3)
+project(SwiftMix C Swift)
+
+add_executable(SwiftMix CMain.c ObjCMain.m SwiftMain.swift ObjC-Swift.h)
+set_property(TARGET SwiftMix PROPERTY XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER "ObjC-Swift.h")
diff --git a/Tests/SwiftMix/ObjC-Swift.h b/Tests/SwiftMix/ObjC-Swift.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/SwiftMix/ObjC-Swift.h
diff --git a/Tests/SwiftMix/ObjCMain.m b/Tests/SwiftMix/ObjCMain.m
new file mode 100644
index 0000000..7fa90ae
--- /dev/null
+++ b/Tests/SwiftMix/ObjCMain.m
@@ -0,0 +1,4 @@
+#import "SwiftMix-Swift.h"
+int ObjCMain(int argc, char const* const argv[]) {
+ return [SwiftMainClass SwiftMain:argc argv:argv];
+}
diff --git a/Tests/SwiftMix/SwiftMain.swift b/Tests/SwiftMix/SwiftMain.swift
new file mode 100644
index 0000000..9af9883
--- /dev/null
+++ b/Tests/SwiftMix/SwiftMain.swift
@@ -0,0 +1,10 @@
+@objc class SwiftMainClass {
+ class func SwiftMain(argc:Int, argv:UnsafePointer<UnsafePointer<CChar>>) -> Int32 {
+ println("argc: \(argc)")
+ for (var i = 0; i < argc; ++i) {
+ var argi = String.fromCString(argv[i])
+ println("arg[\(i)]: \(argi)");
+ }
+ return 0;
+ }
+}
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
new file mode 100644
index 0000000..5cb9739
--- /dev/null
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.3)
+project(SwiftOnly Swift)
+
+add_executable(SwiftOnly main.swift)
diff --git a/Tests/SwiftOnly/main.swift b/Tests/SwiftOnly/main.swift
new file mode 100644
index 0000000..67be986
--- /dev/null
+++ b/Tests/SwiftOnly/main.swift
@@ -0,0 +1 @@
+println("SwiftOnly")
diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt
index 17eb041..3b9cfc3 100644
--- a/Tests/VSResource/CMakeLists.txt
+++ b/Tests/VSResource/CMakeLists.txt
@@ -46,7 +46,10 @@ else()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
+add_library(ResourceLib STATIC lib.cpp lib.rc)
+
add_executable(VSResource main.cpp test.rc)
+target_link_libraries(VSResource ResourceLib)
set_property(TARGET VSResource
PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val")
diff --git a/Tests/VSResource/lib.cpp b/Tests/VSResource/lib.cpp
new file mode 100644
index 0000000..006e3e4
--- /dev/null
+++ b/Tests/VSResource/lib.cpp
@@ -0,0 +1 @@
+int lib() { return 0; }
diff --git a/Tests/VSResource/lib.rc b/Tests/VSResource/lib.rc
new file mode 100644
index 0000000..1ffade6
--- /dev/null
+++ b/Tests/VSResource/lib.rc
@@ -0,0 +1,4 @@
+STRINGTABLE
+BEGIN
+ 1234 "5"
+END
diff --git a/Tests/VSResource/main.cpp b/Tests/VSResource/main.cpp
index 7ee0c74..ccf700c 100644
--- a/Tests/VSResource/main.cpp
+++ b/Tests/VSResource/main.cpp
@@ -1,6 +1,8 @@
#include <windows.h>
#include <stdio.h>
+extern int lib();
+
struct x
{
const char *txt;
@@ -76,5 +78,5 @@ int main(int argc, char** argv)
}
}
- return ret;
+ return ret + lib();
}
diff --git a/Utilities/Doxygen/doc_makeall.sh.in b/Utilities/Doxygen/doc_makeall.sh.in
index ed7b521..fceafdd 100755
--- a/Utilities/Doxygen/doc_makeall.sh.in
+++ b/Utilities/Doxygen/doc_makeall.sh.in
@@ -130,7 +130,7 @@ export RESULTING_HTML_TARZ_ARCHIVE_FILE="$DOXTEMP/$PROJECT_NAME-html.tar.gz"
if test "x@VTK_SOURCE_DIR@" != "x" ; then
if test "x$PERL_PROG" != "xNOTFOUND" ; then
- $PERL_PROG "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \
+ "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_contributors.pl" \
--authors "$SOURCE_DIR/Utilities/Doxygen/authors.txt" \
--cachedir "$DOXTEMP/cache" \
--class_group '^(cm[A-Z0-9][A-Za-z0-9]+)\.(?:c|cpp|cxx|h|fl)$' \
@@ -158,7 +158,7 @@ if test "x@VTK_SOURCE_DIR@" != "x" ; then
fi
if test "x$GNUPLOT_PROG" != "xNOTFOUND" ; then
- $GNUPLOT_PROG "$DOXTEMP/contrib/history.plt"
+ "$GNUPLOT_PROG" "$DOXTEMP/contrib/history.plt"
fi
fi
@@ -168,7 +168,7 @@ fi
if test "x$DOXYGEN_PROG" != "xNOTFOUND" ; then
if test "x$RM_PROG" != "xNOTFOUND" ; then
- $RM_PROG -fr "$OUTPUT_DIRECTORY"
+ "$RM_PROG" -fr "$OUTPUT_DIRECTORY"
fi
"$DOXYGEN_PROG" "$DOXYFILE"
@@ -182,7 +182,7 @@ fi
if test "x@VTK_SOURCE_DIR@" != "x" ; then
if test "x$PERL_PROG" != "xNOTFOUND" ; then
- $PERL_PROG "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \
+ "$PERL_PROG" "$PATH_TO_VTK_DOX_SCRIPTS/doc_rmpath.pl" \
--verbose \
--to "$INTERMEDIATE_DOX_DIR" \
--html "$OUTPUT_DIRECTORY/html"
@@ -198,7 +198,7 @@ if test "x$COMPILE_HTML_HELP" == "xON" ; then
if test "x$HHC_PROG" != "xNOTFOUND" ; then
"$HHC_PROG" index.hhp
if test "x$MV_PROG" != "xNOTFOUND" ; then
- $MV_PROG -f index.chm "$RESULTING_HTML_HELP_FILE"
+ "$MV_PROG" -f index.chm "$RESULTING_HTML_HELP_FILE"
fi
fi
fi
@@ -212,15 +212,15 @@ if test "x$CREATE_HTML_TARZ_ARCHIVE" == "xON" ; then
cd "$OUTPUT_DIRECTORY"
if test "x$TAR_PROG" != "xNOTFOUND" ; then
if test "x$RM_PROG" != "xNOTFOUND" ; then
- $RM_PROG -f html.tar
+ "$RM_PROG" -f html.tar
fi
- $TAR_PROG -cf html.tar html
+ "$TAR_PROG" -cf html.tar html
if test "x$GZIP_PROG" != "xNOTFOUND" ; then
if test "x$RM_PROG" != "xNOTFOUND" ; then
- $RM_PROG -f html.tar.gz
+ "$RM_PROG" -f html.tar.gz
fi
- $GZIP_PROG html.tar
- $MV_PROG -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE"
+ "$GZIP_PROG" html.tar
+ "$MV_PROG" -f html.tar.gz "$RESULTING_HTML_TARZ_ARCHIVE_FILE"
fi
fi
fi
@@ -230,18 +230,18 @@ fi
# Clean-up.
if test "x$RM_PROG" != "xNOTFOUND" ; then
- $RM_PROG -fr "$INTERMEDIATE_DOX_DIR"
+ "$RM_PROG" -fr "$INTERMEDIATE_DOX_DIR"
if test "x$DOWNLOAD_VTK_TAGFILE" == "xON" ; then
if test "x$VTK_TAGFILE" != "x" ; then
- $RM_PROG -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE"
+ "$RM_PROG" -f "$VTK_TAGFILE_DEST_DIR/$VTK_TAGFILE"
fi
fi
if test "x$COMPILE_HTML_HELP" == "xON" ; then
if test "x$RESULTING_HTML_HELP_FILE" != "x" ; then
if test "x$ALLOW_ERASE_OUTPUT_DIRECTORY" == "xON" ; then
- $RM_PROG -fr "$OUTPUT_DIRECTORY"
+ "$RM_PROG" -fr "$OUTPUT_DIRECTORY"
fi
fi
fi
diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake
index bc95982..b407554 100644
--- a/Utilities/Release/dashmacmini5_release.cmake
+++ b/Utilities/Release/dashmacmini5_release.cmake
@@ -20,7 +20,7 @@ CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CPACK_SYSTEM_NAME:STRING=Darwin-x86_64
BUILD_QtDialog:BOOL=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE
-QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.0/install/bin/qmake
+QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.8.6/install/bin/qmake
")
get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${path}/release_cmake.cmake)
diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake
index 513f42f..2cd5dfc 100644
--- a/Utilities/Release/linux64_release.cmake
+++ b/Utilities/Release/linux64_release.cmake
@@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a
CURSES_INCLUDE_PATH:PATH=/home/kitware/ncurses-5.9/include
FORM_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libform.a
CMAKE_USE_OPENSSL:BOOL=ON
-OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1j/lib/libcrypto.a
-OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1j/include
-OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1j/lib/libssl.a
+OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libcrypto.a
+OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2d/include
+OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libssl.a
CPACK_SYSTEM_NAME:STRING=Linux-x86_64
BUILD_QtDialog:BOOL:=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE
diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake
index 1bf75dd..b0e0a3a 100644
--- a/Utilities/Release/magrathea_release.cmake
+++ b/Utilities/Release/magrathea_release.cmake
@@ -11,9 +11,9 @@ CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a
CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses
FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a
CMAKE_USE_OPENSSL:BOOL=ON
-OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1g-install/lib/libcrypto.a
-OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1g-install/include
-OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1g-install/lib/libssl.a
+OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libcrypto.a
+OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.2d/include
+OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.2d/lib/libssl.a
CPACK_SYSTEM_NAME:STRING=Linux-i386
BUILD_QtDialog:BOOL:=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE
diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake
index 98fe3c5..ac41300 100644
--- a/Utilities/Release/upload_release.cmake
+++ b/Utilities/Release/upload_release.cmake
@@ -1,6 +1,6 @@
set(CTEST_RUN_CURRENT_SCRIPT 0)
if(NOT VERSION)
- set(VERSION 3.2)
+ set(VERSION 3.3)
endif()
if(NOT DEFINED PROJECT_PREFIX)
set(PROJECT_PREFIX cmake-${VERSION})
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index a755ca1..1baca35 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -19,6 +19,9 @@ if(NOT CMake_SOURCE_DIR)
include(${CMake_SOURCE_DIR}/Source/CMakeInstallDestinations.cmake)
unset(CMAKE_DATA_DIR)
unset(CMAKE_DATA_DIR CACHE)
+ macro(CMake_OPTIONAL_COMPONENT)
+ set(COMPONENT "")
+ endmacro()
endif()
project(CMakeHelp NONE)
@@ -153,28 +156,35 @@ if(SPHINX_MAN)
if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$")
set(name "${CMAKE_MATCH_1}")
set(sec "${CMAKE_MATCH_2}")
+ CMake_OPTIONAL_COMPONENT(sphinx-man)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec}
- DESTINATION ${CMAKE_MAN_DIR}/man${sec})
+ DESTINATION ${CMAKE_MAN_DIR}/man${sec}
+ ${COMPONENT})
endif()
endforeach()
endif()
if(SPHINX_HTML)
+ CMake_OPTIONAL_COMPONENT(sphinx-html)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${CMAKE_DOC_DIR}
+ ${COMPONENT}
PATTERN .buildinfo EXCLUDE
)
endif()
if(SPHINX_SINGLEHTML)
+ CMake_OPTIONAL_COMPONENT(sphinx-singlehtml)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml
DESTINATION ${CMAKE_DOC_DIR}
+ ${COMPONENT}
PATTERN .buildinfo EXCLUDE
)
endif()
if(SPHINX_QTHELP)
+ CMake_OPTIONAL_COMPONENT(sphinx-qthelp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch
- DESTINATION ${CMAKE_DOC_DIR}
+ DESTINATION ${CMAKE_DOC_DIR} ${COMPONENT}
)
endif()
diff --git a/bootstrap b/bootstrap
index 14046ee..d778bbe 100755
--- a/bootstrap
+++ b/bootstrap
@@ -248,6 +248,7 @@ CMAKE_CXX_SOURCES="\
cmCommandArgumentLexer \
cmCommandArgumentParser \
cmCommandArgumentParserHelper \
+ cmCommonTargetGenerator \
cmCPackPropertiesGenerator \
cmDefinitions \
cmDepends \
@@ -276,8 +277,10 @@ CMAKE_CXX_SOURCES="\
cmGeneratorExpressionNode \
cmGeneratorExpressionParser \
cmGeneratorExpression \
+ cmGlobalCommonGenerator \
cmGlobalGenerator \
cmInstallDirectoryGenerator \
+ cmLocalCommonGenerator \
cmLocalGenerator \
cmInstalledFile \
cmInstallGenerator \
@@ -299,6 +302,7 @@ CMAKE_CXX_SOURCES="\
cmMakefileLibraryTargetGenerator \
cmMakefileTargetGenerator \
cmMakefileUtilityTargetGenerator \
+ cmOutputConverter \
cmOSXBundleGenerator \
cmNewLineStyle \
cmBootstrapCommands1 \