summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/generator/Visual Studio 15 2017.rst (renamed from Help/generator/Visual Studio 15.rst)12
-rw-r--r--Help/manual/cmake-generators.7.rst2
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst13
-rw-r--r--Help/release/3.7.rst6
-rw-r--r--Help/release/dev/CUDA-language-support.rst6
-rw-r--r--Help/release/dev/try_compile-honor-CMAKE_WARN_DEPRECATED.rst6
-rw-r--r--Help/release/dev/vs-default-build-package.rst7
-rw-r--r--Help/variable/CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD.rst8
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in20
-rw-r--r--Modules/CMakeCUDACompilerABI.cu16
-rw-r--r--Modules/CMakeCUDACompilerId.cu.in39
-rw-r--r--Modules/CMakeCUDAInformation.cmake193
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake5
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake115
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake6
-rw-r--r--Modules/CMakeTestCUDACompiler.cmake71
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake24
-rw-r--r--Modules/Compiler/NVIDIA-DetermineCompiler.cmake7
-rw-r--r--Modules/FindALSA.cmake2
-rw-r--r--Modules/FindASPELL.cmake2
-rw-r--r--Modules/FindAVIFile.cmake2
-rw-r--r--Modules/FindArmadillo.cmake7
-rw-r--r--Modules/FindBISON.cmake2
-rw-r--r--Modules/FindBZip2.cmake2
-rw-r--r--Modules/FindBullet.cmake2
-rw-r--r--Modules/FindCURL.cmake2
-rw-r--r--Modules/FindCoin3D.cmake4
-rw-r--r--Modules/FindCurses.cmake2
-rw-r--r--Modules/FindDart.cmake2
-rw-r--r--Modules/FindDevIL.cmake4
-rw-r--r--Modules/FindEXPAT.cmake2
-rw-r--r--Modules/FindFLEX.cmake2
-rw-r--r--Modules/FindFreetype.cmake3
-rw-r--r--Modules/FindGIF.cmake2
-rw-r--r--Modules/FindGSL.cmake1
-rw-r--r--Modules/FindGTK2.cmake1
-rw-r--r--Modules/FindGit.cmake3
-rw-r--r--Modules/FindGnuTLS.cmake3
-rw-r--r--Modules/FindGnuplot.cmake3
-rw-r--r--Modules/FindHSPELL.cmake3
-rw-r--r--Modules/FindHg.cmake2
-rw-r--r--Modules/FindIcotool.cmake2
-rw-r--r--Modules/FindJPEG.cmake2
-rw-r--r--Modules/FindJasper.cmake2
-rw-r--r--Modules/FindJava.cmake1
-rw-r--r--Modules/FindLATEX.cmake1
-rw-r--r--Modules/FindLTTngUST.cmake2
-rw-r--r--Modules/FindLibArchive.cmake8
-rw-r--r--Modules/FindLibXml2.cmake2
-rw-r--r--Modules/FindMPEG.cmake2
-rw-r--r--Modules/FindMPEG2.cmake3
-rw-r--r--Modules/FindMPI.cmake1
-rw-r--r--Modules/FindMotif.cmake3
-rw-r--r--Modules/FindOpenAL.cmake2
-rw-r--r--Modules/FindOpenGL.cmake2
-rw-r--r--Modules/FindOpenSceneGraph.cmake1
-rw-r--r--Modules/FindPNG.cmake2
-rw-r--r--Modules/FindPerl.cmake2
-rw-r--r--Modules/FindPerlLibs.cmake2
-rw-r--r--Modules/FindPhysFS.cmake3
-rw-r--r--Modules/FindPkgConfig.cmake3
-rw-r--r--Modules/FindPythonInterp.cmake2
-rw-r--r--Modules/FindQuickTime.cmake2
-rw-r--r--Modules/FindTCL.cmake2
-rw-r--r--Modules/FindTIFF.cmake2
-rw-r--r--Modules/FindTclsh.cmake2
-rw-r--r--Modules/FindWget.cmake4
-rw-r--r--Modules/FindZLIB.cmake2
-rw-r--r--Modules/UseSWIG.cmake7
-rw-r--r--Source/CMakeLists.txt18
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx8
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx4
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx1
-rw-r--r--Source/CPack/WiX/cmWIXRichTextFormatWriter.h3
-rw-r--r--Source/CPack/cmCPackBundleGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackBundleGenerator.h4
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.h6
-rw-r--r--Source/CPack/cmCPackGenerator.cxx16
-rw-r--r--Source/CPack/cmCPackGenerator.h7
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx12
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.h2
-rw-r--r--Source/CPack/cmCPackLog.cxx5
-rw-r--r--Source/CPack/cmCPackLog.h2
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx11
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h3
-rw-r--r--Source/CPack/cmCPackPKGGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackPKGGenerator.h4
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx18
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h3
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackProductBuildGenerator.h4
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx11
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx8
-rw-r--r--Source/CPack/cpack.cxx29
-rw-r--r--Source/CTest/cmCTestGIT.cxx13
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx7
-rw-r--r--Source/CTest/cmCTestGenericHandler.h8
-rw-r--r--Source/CTest/cmCTestLaunch.cxx18
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx3
-rw-r--r--Source/CTest/cmCTestRunTest.h4
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx20
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx18
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx30
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx5
-rw-r--r--Source/CTest/cmCTestVC.h5
-rw-r--r--Source/bindexplib.cxx3
-rw-r--r--Source/bindexplib.h5
-rw-r--r--Source/cmCTest.h1
-rw-r--r--Source/cmCallVisualStudioMacro.cxx2
-rw-r--r--Source/cmCallVisualStudioMacro.h2
-rw-r--r--Source/cmCommands.cxx43
-rw-r--r--Source/cmComputeLinkInformation.h1
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmCryptoHash.h6
-rw-r--r--Source/cmElseCommand.cxx14
-rw-r--r--Source/cmElseCommand.h45
-rw-r--r--Source/cmElseIfCommand.cxx13
-rw-r--r--Source/cmElseIfCommand.h45
-rw-r--r--Source/cmEndForEachCommand.cxx15
-rw-r--r--Source/cmEndForEachCommand.h56
-rw-r--r--Source/cmEndFunctionCommand.cxx15
-rw-r--r--Source/cmEndFunctionCommand.h56
-rw-r--r--Source/cmEndIfCommand.cxx24
-rw-r--r--Source/cmEndIfCommand.h45
-rw-r--r--Source/cmEndMacroCommand.cxx15
-rw-r--r--Source/cmEndMacroCommand.h56
-rw-r--r--Source/cmEndWhileCommand.cxx22
-rw-r--r--Source/cmEndWhileCommand.h56
-rw-r--r--Source/cmFileCommand.cxx41
-rw-r--r--Source/cmGhsMultiGpj.h2
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx6
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio11Generator.h11
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h9
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx1
-rw-r--r--Source/cmGlobalVisualStudio14Generator.h9
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio15Generator.h8
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx35
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h15
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx63
-rw-r--r--Source/cmGlobalXCodeGenerator.h16
-rw-r--r--Source/cmIDEOptions.cxx7
-rw-r--r--Source/cmIDEOptions.h6
-rw-r--r--Source/cmLinkLineComputer.h6
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx74
-rw-r--r--Source/cmLinkLineDeviceComputer.h36
-rw-r--r--Source/cmLocalGenerator.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx7
-rw-r--r--Source/cmLocalVisualStudio10Generator.h7
-rw-r--r--Source/cmLocalVisualStudio7Generator.h17
-rw-r--r--Source/cmLocalVisualStudioGenerator.h16
-rw-r--r--Source/cmLocalXCodeGenerator.cxx5
-rw-r--r--Source/cmLocalXCodeGenerator.h9
-rw-r--r--Source/cmMachO.cxx6
-rw-r--r--Source/cmMachO.h5
-rw-r--r--Source/cmMakefile.cxx3
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx227
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.h4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx222
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.h6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx27
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx358
-rw-r--r--Source/cmNinjaNormalTargetGenerator.h10
-rw-r--r--Source/cmNinjaTargetGenerator.cxx18
-rw-r--r--Source/cmProcessOutput.h1
-rw-r--r--Source/cmTarget.cxx4
-rw-r--r--Source/cmUnexpectedCommand.cxx22
-rw-r--r--Source/cmUnexpectedCommand.h40
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h19
-rw-r--r--Source/cmVisualStudio10ToolsetOptions.h4
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx1
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h10
-rw-r--r--Source/cmVisualStudioSlnData.h4
-rw-r--r--Source/cmVisualStudioSlnParser.h6
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.h5
-rw-r--r--Source/cmXCode21Object.cxx3
-rw-r--r--Source/cmXCode21Object.h5
-rw-r--r--Source/cmXCodeObject.cxx5
-rw-r--r--Source/cmXCodeObject.h9
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmakexbuild.cxx9
-rw-r--r--Source/kwsys/CMakeLists.txt15
-rw-r--r--Source/kwsys/ConsoleBuf.hxx.in71
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx4
-rw-r--r--Tests/CMakeLib/testFindPackageCommand.cxx6
-rw-r--r--Tests/CMakeLib/testSystemTools.cxx7
-rw-r--r--Tests/CMakeLib/testXMLSafe.cxx5
-rw-r--r--Tests/CMakeLists.txt7
-rw-r--r--Tests/Cuda/CMakeLists.txt4
-rw-r--r--Tests/Cuda/Complex/CMakeLists.txt40
-rw-r--r--Tests/Cuda/Complex/dynamic.cpp5
-rw-r--r--Tests/Cuda/Complex/dynamic.cu29
-rw-r--r--Tests/Cuda/Complex/file1.cu10
-rw-r--r--Tests/Cuda/Complex/file1.h7
-rw-r--r--Tests/Cuda/Complex/file2.cu20
-rw-r--r--Tests/Cuda/Complex/file2.h10
-rw-r--r--Tests/Cuda/Complex/file3.cu25
-rw-r--r--Tests/Cuda/Complex/main.cpp14
-rw-r--r--Tests/Cuda/Complex/mixed.cpp14
-rw-r--r--Tests/Cuda/Complex/mixed.cu25
-rw-r--r--Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt17
-rw-r--r--Tests/Cuda/ConsumeCompileFeatures/main.cu18
-rw-r--r--Tests/Cuda/ConsumeCompileFeatures/static.cpp10
-rw-r--r--Tests/Cuda/ConsumeCompileFeatures/static.cu9
-rw-r--r--Tests/Cuda/ObjectLibrary/CMakeLists.txt12
-rw-r--r--Tests/Cuda/ObjectLibrary/main.cpp20
-rw-r--r--Tests/Cuda/ObjectLibrary/static.cpp6
-rw-r--r--Tests/Cuda/ObjectLibrary/static.cu21
-rw-r--r--Tests/CudaOnly/CMakeLists.txt4
-rw-r--r--Tests/CudaOnly/EnableStandard/CMakeLists.txt15
-rw-r--r--Tests/CudaOnly/EnableStandard/main.cu17
-rw-r--r--Tests/CudaOnly/EnableStandard/shared.cu9
-rw-r--r--Tests/CudaOnly/EnableStandard/static.cu9
-rw-r--r--Tests/CudaOnly/SeparateCompilation/CMakeLists.txt33
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file1.cu10
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file1.h7
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file2.cu20
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file2.h10
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file3.cu25
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file4.cu25
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file5.cu25
-rw-r--r--Tests/CudaOnly/SeparateCompilation/main.cu15
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt31
-rw-r--r--Tests/CudaOnly/WithDefs/main.notcu46
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt4
-rw-r--r--Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt15
-rw-r--r--Tests/RunCMake/CPack/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake5
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake47
-rw-r--r--Tests/RunCMake/CPack/CUSTOM_NAMES.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake6
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake14
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake34
-rw-r--r--Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake23
-rw-r--r--Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake43
-rw-r--r--Tests/RunCMake/CPack/DEB/LONG_FILENAMES-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/LONG_FILENAMES-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/LONG_FILENAMES-specifics.cmake3
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake2
-rw-r--r--Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake18
-rw-r--r--Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/DEB/packaging_COMPONENT_default.cmake (renamed from Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake)3
-rw-r--r--Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake1
-rw-r--r--Tests/RunCMake/CPack/DEPENDENCIES.cmake20
-rw-r--r--Tests/RunCMake/CPack/EMPTY_DIR.cmake4
-rw-r--r--Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake5
-rw-r--r--Tests/RunCMake/CPack/README.txt168
-rw-r--r--Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/DEBUGINFO-ExpectedFiles.cmake14
-rw-r--r--Tests/RunCMake/CPack/RPM/DEBUGINFO-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/DEPENDENCIES-ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/RPM/DEPENDENCIES-VerifyResult.cmake45
-rw-r--r--Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake22
-rw-r--r--Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/Helpers.cmake53
-rw-r--r--Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake7
-rw-r--r--Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake19
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake13
-rw-r--r--Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt3
-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/PER_COMPONENT_FIELDS-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake18
-rw-r--r--Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt3
-rw-r--r--Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/RPM/default_expected_stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake1
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake39
-rw-r--r--Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/TGZ/Helpers.cmake52
-rw-r--r--Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake9
-rw-r--r--Tests/RunCMake/CPack/TGZ/packaging_COMPONENT_default.cmake (renamed from Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake)0
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake65
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake12
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake14
-rw-r--r--Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake16
-rw-r--r--Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake (renamed from Tests/RunCMake/CPack/DEBUGINFO.cmake)4
-rw-r--r--Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake18
-rw-r--r--Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake82
-rw-r--r--Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake60
-rw-r--r--Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/RPM/RPM_DIST-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/DIST/test.cmake (renamed from Tests/RunCMake/CPack/RPM_DIST.cmake)1
-rw-r--r--Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake14
-rw-r--r--Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake8
-rw-r--r--Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/EXTRA/test.cmake (renamed from Tests/RunCMake/CPack/DEB_EXTRA.cmake)4
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/ExpectedFiles.cmake (renamed from Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake (renamed from Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake)4
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake (renamed from Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake (renamed from Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake)4
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake5
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake (renamed from Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake)22
-rw-r--r--Tests/RunCMake/CPack/tests/LONG_FILENAMES/DEB-Prerequirements.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/LONG_FILENAMES/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/DEB/LONG_FILENAMES-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake (renamed from Tests/RunCMake/CPack/LONG_FILENAMES.cmake)7
-rw-r--r--Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake11
-rw-r--r--Tests/RunCMake/CPack/tests/MAIN_COMPONENT/RPM-invalid-stderr.txt (renamed from Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt)0
-rw-r--r--Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake (renamed from Tests/RunCMake/CPack/MAIN_COMPONENT.cmake)4
-rw-r--r--Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/MINIMAL/test.cmake (renamed from Tests/RunCMake/CPack/MINIMAL.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake6
-rw-r--r--Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/TGZ-invalid-stderr.txt (renamed from Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt)0
-rw-r--r--Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake (renamed from Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake)1
-rw-r--r--Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/RPM-stderr.txt (renamed from Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt)0
-rw-r--r--Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake (renamed from Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake8
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake26
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake18
-rw-r--r--Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake (renamed from Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake)14
-rw-r--r--Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/RPM-no_main_component-stderr.txt (renamed from Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt)0
-rw-r--r--Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake (renamed from Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-VerifyResult.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake (renamed from Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake)2
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake (renamed from Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake)0
-rw-r--r--Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake (renamed from Tests/RunCMake/CPack/RPM_SUGGESTS.cmake)1
-rw-r--r--Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake29
-rw-r--r--Tests/RunCMake/VSSolution/AddPackageToDefault.cmake2
-rw-r--r--Tests/RunCMake/VSSolution/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/try_compile/WarnDeprecated.cmake19
-rw-r--r--Tests/RunCMake/while/EndAlone-stderr.txt2
-rw-r--r--Utilities/cmlibarchive/libarchive/CMakeLists.txt2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_cryptor.c9
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_cryptor_private.h4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_digest.c74
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_digest_private.h14
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_hmac.c14
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_hmac_private.h4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h51
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h52
-rw-r--r--Utilities/cmlibrhash/librhash/sha256.c4
-rwxr-xr-xbootstrap7
383 files changed, 3840 insertions, 1636 deletions
diff --git a/Help/generator/Visual Studio 15.rst b/Help/generator/Visual Studio 15 2017.rst
index 2eb9052..a88f8bc 100644
--- a/Help/generator/Visual Studio 15.rst
+++ b/Help/generator/Visual Studio 15 2017.rst
@@ -1,7 +1,7 @@
-Visual Studio 15
-----------------
+Visual Studio 15 2017
+---------------------
-Generates Visual Studio 15 project files.
+Generates Visual Studio 15 (VS 2017) project files.
The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
to specify a target platform name (architecture).
@@ -9,16 +9,16 @@ to specify a target platform name (architecture).
For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name:
-``Visual Studio 15 Win64``
+``Visual Studio 15 2017 Win64``
Specify target platform ``x64``.
-``Visual Studio 15 ARM``
+``Visual Studio 15 2017 ARM``
Specify target platform ``ARM``.
Toolset Selection
^^^^^^^^^^^^^^^^^
-The ``v141`` toolset that comes with Visual Studio 15 is selected by
+The ``v141`` toolset that comes with Visual Studio 15 2017 is selected by
default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
via the :manual:`cmake(1)` ``-T`` option, to specify another toolset.
diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst
index 3df3a81..a37c65b 100644
--- a/Help/manual/cmake-generators.7.rst
+++ b/Help/manual/cmake-generators.7.rst
@@ -82,7 +82,7 @@ Visual Studio Generators
/generator/Visual Studio 11 2012
/generator/Visual Studio 12 2013
/generator/Visual Studio 14 2015
- /generator/Visual Studio 15
+ /generator/Visual Studio 15 2017
Other Generators
^^^^^^^^^^^^^^^^
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 82d5588..5da00ed 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -143,6 +143,7 @@ Properties on Targets
/prop_tgt/CONFIG_OUTPUT_NAME
/prop_tgt/CONFIG_POSTFIX
/prop_tgt/CROSSCOMPILING_EMULATOR
+ /prop_tgt/CUDA_SEPARABLE_COMPILATION
/prop_tgt/CXX_EXTENSIONS
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_STANDARD_REQUIRED
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 460c0b5..8533f36 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -329,6 +329,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_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD
/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
/variable/CMAKE_WIN32_EXECUTABLE
/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute
diff --git a/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst b/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst
new file mode 100644
index 0000000..1c7dd80
--- /dev/null
+++ b/Help/prop_tgt/CUDA_SEPARABLE_COMPILATION.rst
@@ -0,0 +1,13 @@
+CUDA_SEPARABLE_COMPILATION
+--------------------------
+
+CUDA only: Enables separate compilation of device code
+
+If set this will enable separable compilation for all CUDA files for
+the given target.
+
+For instance:
+
+.. code-block:: cmake
+
+ set_property(TARGET myexe PROPERTY CUDA_SEPARABLE_COMPILATION ON)
diff --git a/Help/release/3.7.rst b/Help/release/3.7.rst
index 3b8ade6..4c51af4 100644
--- a/Help/release/3.7.rst
+++ b/Help/release/3.7.rst
@@ -31,9 +31,9 @@ Generators
This is equivalent to ``cd sub/dir; make {test,install,package}``
with :ref:`Makefile Generators`.
-* The :generator:`Visual Studio 15` generator was added. This is
- experimental and based on Preview 5 because this version of VS
- has not been released.
+* The :generator:`Visual Studio 15 2017` generator was added. This is
+ experimental and based on "Visual Studio 2017 RC" because this version
+ of VS has not been released.
* :ref:`Visual Studio Generators` for VS 2010 and above learned to
place ``.natvis`` source files into VS project files properly.
diff --git a/Help/release/dev/CUDA-language-support.rst b/Help/release/dev/CUDA-language-support.rst
new file mode 100644
index 0000000..7df45bf
--- /dev/null
+++ b/Help/release/dev/CUDA-language-support.rst
@@ -0,0 +1,6 @@
+CUDA-language-support
+---------------------
+
+* CMake learned to support CUDA as a first-class language.
+ It is supported by the :ref:`Makefile Generators` and the
+ :generator:`Ninja` generator.
diff --git a/Help/release/dev/try_compile-honor-CMAKE_WARN_DEPRECATED.rst b/Help/release/dev/try_compile-honor-CMAKE_WARN_DEPRECATED.rst
new file mode 100644
index 0000000..9e13575
--- /dev/null
+++ b/Help/release/dev/try_compile-honor-CMAKE_WARN_DEPRECATED.rst
@@ -0,0 +1,6 @@
+try_compile-honor-CMAKE_WARN_DEPRECATED
+---------------------------------------
+
+* The :command:`try_compile` command source file signature now
+ honors the :variable:`CMAKE_WARN_DEPRECATED` variable value
+ in the generated test project.
diff --git a/Help/release/dev/vs-default-build-package.rst b/Help/release/dev/vs-default-build-package.rst
new file mode 100644
index 0000000..62c66e0
--- /dev/null
+++ b/Help/release/dev/vs-default-build-package.rst
@@ -0,0 +1,7 @@
+vs-default-build-package
+------------------------
+
+* The :ref:`Visual Studio Generators` for VS 2010 and above now support
+ adding the PACKAGE target to the targets which are built by default.
+ The behavior is similar to :variable:`CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD`
+ and can be toggled using :variable:`CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD`.
diff --git a/Help/variable/CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD.rst b/Help/variable/CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD.rst
new file mode 100644
index 0000000..693ba45
--- /dev/null
+++ b/Help/variable/CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD.rst
@@ -0,0 +1,8 @@
+CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD
+-----------------------------------------
+
+Include ``PACKAGE`` target to default build.
+
+In Visual Studio solution, by default the ``PACKAGE`` target will not be part
+of the default build. Setting this variable will enable the ``PACKAGE`` target
+to be part of the default build.
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
new file mode 100644
index 0000000..8a6c0bc
--- /dev/null
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -0,0 +1,20 @@
+set(CMAKE_CUDA_COMPILER "@CMAKE_CUDA_COMPILER@")
+set(CMAKE_CUDA_HOST_COMPILER "@CMAKE_CUDA_HOST_COMPILER@")
+set(CMAKE_CUDA_HOST_LINK_LAUNCHER "@CMAKE_CUDA_HOST_LINK_LAUNCHER@")
+set(CMAKE_CUDA_COMPILER_ID "@CMAKE_CUDA_COMPILER_ID@")
+set(CMAKE_CUDA_COMPILER_VERSION "@CMAKE_CUDA_COMPILER_VERSION@")
+set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@")
+
+set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
+set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
+
+set(CMAKE_CUDA_COMPILER_ID_RUN 1)
+set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu)
+
+set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@")
+set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
+
+set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES@")
+set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
new file mode 100644
index 0000000..5aa1b8a
--- /dev/null
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -0,0 +1,16 @@
+#ifndef __CUDACC__
+# error "A C or C++ compiler has been selected for CUDA"
+#endif
+
+#include "CMakeCompilerABI.h"
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_sizeof_dptr[argc];
+#if defined(ABI_ID)
+ require += info_abi[argc];
+#endif
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in
new file mode 100644
index 0000000..5fa85da
--- /dev/null
+++ b/Modules/CMakeCUDACompilerId.cu.in
@@ -0,0 +1,39 @@
+#ifndef __CUDACC__
+# error "A C or C++ compiler has been selected for CUDA"
+#endif
+
+@CMAKE_CUDA_COMPILER_ID_CONTENT@
+
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+
+@CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@
+@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if __cplusplus >= 201402L
+ "14"
+#elif __cplusplus >= 201103L
+ "11"
+#else
+ "98"
+#endif
+"]";
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_compiler[argc];
+ require += info_platform[argc];
+#ifdef COMPILER_VERSION_MAJOR
+ require += info_version[argc];
+#endif
+ require += info_language_dialect_default[argc];
+ (void)argv;
+ return require;
+}
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
new file mode 100644
index 0000000..202a7a6
--- /dev/null
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -0,0 +1,193 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+set(CMAKE_CUDA_OUTPUT_EXTENSION .o)
+set(CMAKE_INCLUDE_FLAG_CUDA "-I")
+
+# Load compiler-specific information.
+if(CMAKE_CUDA_COMPILER_ID)
+ include(Compiler/${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
+endif()
+
+# load the system- and compiler specific files
+if(CMAKE_CUDA_COMPILER_ID)
+ # load a hardware specific file, mostly useful for embedded compilers
+ if(CMAKE_SYSTEM_PROCESSOR)
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_ID}-CUDA-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
+ endif()
+ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
+endif()
+
+
+if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG)
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
+endif()
+
+if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP)
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+endif()
+
+if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG)
+ set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+endif()
+
+if(NOT DEFINED CMAKE_EXE_EXPORTS_CUDA_FLAG)
+ set(CMAKE_EXE_EXPORTS_CUDA_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
+endif()
+
+if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CUDA_FLAG)
+ set(CMAKE_SHARED_LIBRARY_SONAME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
+endif()
+
+if(NOT CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG)
+ set(CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG})
+endif()
+
+if(NOT CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG_SEP)
+ set(CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP})
+endif()
+
+if(NOT CMAKE_EXECUTABLE_RPATH_LINK_CUDA_FLAG)
+ set(CMAKE_EXECUTABLE_RPATH_LINK_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG})
+endif()
+
+if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CUDA_WITH_RUNTIME_PATH)
+ set(CMAKE_SHARED_LIBRARY_LINK_CUDA_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
+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_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CUDA_FLAGS})
+ set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS})
+endif()
+
+# add the flags to the cache based
+# on the initial values computed in the platform/*.cmake files
+# use _INIT variables so that this only happens the first time
+# and you can set these flags in the cmake cache
+set(CMAKE_CUDA_FLAGS_INIT "$ENV{CUDAFLAGS} ${CMAKE_CUDA_FLAGS_INIT}")
+
+foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
+ string(STRIP "${CMAKE_CUDA_FLAGS${c}_INIT}" CMAKE_CUDA_FLAGS${c}_INIT)
+endforeach()
+
+set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS_INIT}" CACHE STRING
+ "Flags used by the compiler during all build types.")
+
+if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+ set (CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG_INIT}" CACHE STRING
+ "Flags used by the compiler during debug builds.")
+ set (CMAKE_CUDA_FLAGS_MINSIZEREL "${CMAKE_CUDA_FLAGS_MINSIZEREL_INIT}" CACHE STRING
+ "Flags used by the compiler during release builds for minimum size.")
+ set (CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE_INIT}" CACHE STRING
+ "Flags used by the compiler during release builds.")
+ set (CMAKE_CUDA_FLAGS_RELWITHDEBINFO "${CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+ "Flags used by the compiler during release builds with debug info.")
+
+endif()
+
+include(CMakeCommonLanguageInclude)
+
+# now define the following rules:
+# CMAKE_CUDA_CREATE_SHARED_LIBRARY
+# CMAKE_CUDA_CREATE_SHARED_MODULE
+# CMAKE_CUDA_COMPILE_OBJECT
+# CMAKE_CUDA_LINK_EXECUTABLE
+
+if(CMAKE_CUDA_HOST_COMPILER)
+ set(CMAKE_CUDA_HOST_FLAGS "-ccbin=<CMAKE_CUDA_HOST_COMPILER>")
+else()
+ set(CMAKE_CUDA_HOST_FLAGS "")
+endif()
+
+set(__IMPLICT_LINKS )
+foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
+ string(APPEND __IMPLICT_LINKS " -L\"${dir}\"")
+endforeach()
+foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
+ if(${lib} MATCHES "/")
+ string(APPEND __IMPLICT_LINKS " \"${lib}\"")
+ else()
+ string(APPEND __IMPLICT_LINKS " -l${lib}")
+ endif()
+endforeach()
+
+# create a shared library
+if(NOT CMAKE_CUDA_CREATE_SHARED_LIBRARY)
+ set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
+ "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+endif()
+
+# create a shared module copy the shared library rule by default
+if(NOT CMAKE_CUDA_CREATE_SHARED_MODULE)
+ set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY})
+endif()
+
+# Create a static archive incrementally for large object file counts.
+if(NOT DEFINED CMAKE_CUDA_ARCHIVE_CREATE)
+ set(CMAKE_CUDA_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_CUDA_ARCHIVE_APPEND)
+ set(CMAKE_CUDA_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
+ set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
+endif()
+
+#Specify how to compile when ptx has been requested
+if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
+ set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -ptx <SOURCE> -o <OBJECT>")
+endif()
+
+#Specify how to compile when separable compilation has been requested
+if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
+ set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -dc <SOURCE> -o <OBJECT>")
+endif()
+
+#Specify how to compile when whole compilation has been requested
+if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
+ set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -c <SOURCE> -o <OBJECT>")
+endif()
+
+if(CMAKE_GENERATOR STREQUAL "Ninja")
+ set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
+ "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <DEFINES> <INCLUDES> <FLAGS> -x cu -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
+ #The Ninja generator uses the make file dependency files to determine what
+ #files need to be recompiled. Unfortunately, nvcc doesn't support building
+ #a source file and generating the dependencies of said file in a single
+ #invocation. Instead we have to state that you need to chain two commands.
+ #
+ #The makefile generators uses the custom CMake dependency scanner, and thus
+ #it is exempt from this logic.
+ list(APPEND CMAKE_CUDA_COMPILE_PTX_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
+ list(APPEND CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
+ list(APPEND CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
+endif()
+
+# compile a cu file into an executable
+if(NOT CMAKE_CUDA_LINK_EXECUTABLE)
+ set(CMAKE_CUDA_LINK_EXECUTABLE
+ "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_CUDA_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
+endif()
+
+#These are used when linking relocatable (dc) cuda code
+set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
+ "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
+ "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+
+
+mark_as_advanced(
+CMAKE_CUDA_FLAGS
+CMAKE_CUDA_FLAGS_RELEASE
+CMAKE_CUDA_FLAGS_RELWITHDEBINFO
+CMAKE_CUDA_FLAGS_MINSIZEREL
+CMAKE_CUDA_FLAGS_DEBUG)
+
+set(CMAKE_CUDA_INFORMATION_LOADED 1)
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 4732250..2881cb1 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -90,6 +90,11 @@ function(compiler_id_detection outvar lang)
list(APPEND ordered_compilers
MIPSpro)
+ #Currently the only CUDA compilers are NVIDIA
+ if(lang STREQUAL CUDA)
+ set(ordered_compilers NVIDIA)
+ endif()
+
if(CID_ID_DEFINE)
foreach(Id ${ordered_compilers})
set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n")
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
new file mode 100644
index 0000000..419f3a5
--- /dev/null
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -0,0 +1,115 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
+include(${CMAKE_ROOT}/Modules//CMakeParseImplicitLinkInfo.cmake)
+
+if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
+ ("${CMAKE_GENERATOR}" MATCHES "Ninja") ) )
+ message(FATAL_ERROR "CUDA language not currently supported by \"${CMAKE_GENERATOR}\" generator")
+endif()
+
+if(NOT CMAKE_CUDA_COMPILER)
+ set(CMAKE_CUDA_COMPILER_INIT NOTFOUND)
+
+ # prefer the environment variable CUDACXX
+ if(NOT $ENV{CUDACXX} STREQUAL "")
+ get_filename_component(CMAKE_CUDA_COMPILER_INIT $ENV{CUDACXX} PROGRAM PROGRAM_ARGS CMAKE_CUDA_FLAGS_ENV_INIT)
+ if(CMAKE_CUDA_FLAGS_ENV_INIT)
+ set(CMAKE_CUDA_COMPILER_ARG1 "${CMAKE_CUDA_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler")
+ endif()
+ if(NOT EXISTS ${CMAKE_CUDA_COMPILER_INIT})
+ message(FATAL_ERROR "Could not find compiler set in environment variable CUDACXX:\n$ENV{CUDACXX}.\n${CMAKE_CUDA_COMPILER_INIT}")
+ endif()
+ endif()
+
+ # finally list compilers to try
+ if(NOT CMAKE_CUDA_COMPILER_INIT)
+ set(CMAKE_CUDA_COMPILER_LIST nvcc)
+ endif()
+
+ _cmake_find_compiler(CUDA)
+else()
+ _cmake_find_compiler_path(CUDA)
+endif()
+
+mark_as_advanced(CMAKE_CUDA_COMPILER)
+
+#Allow the user to specify a host compiler
+set(CMAKE_CUDA_HOST_COMPILER "" CACHE FILEPATH "Host compiler to be used by nvcc")
+if(NOT $ENV{CUDAHOSTCXX} STREQUAL "")
+ get_filename_component(CMAKE_CUDA_HOST_COMPILER $ENV{CUDAHOSTCXX} PROGRAM)
+ if(NOT EXISTS ${CMAKE_CUDA_HOST_COMPILER})
+ message(FATAL_ERROR "Could not find compiler set in environment variable CUDAHOSTCXX:\n$ENV{CUDAHOSTCXX}.\n${CMAKE_CUDA_HOST_COMPILER}")
+ endif()
+endif()
+
+# Build a small source file to identify the compiler.
+if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
+ set(CMAKE_CUDA_COMPILER_ID_RUN 1)
+
+ # Try to identify the compiler.
+ set(CMAKE_CUDA_COMPILER_ID)
+ set(CMAKE_CUDA_PLATFORM_ID)
+ file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
+ CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT)
+
+ list(APPEND CMAKE_CUDA_COMPILER_ID_MATCH_VENDORS NVIDIA)
+ set(CMAKE_CUDA_COMPILER_ID_MATCH_VENDOR_REGEX_NVIDIA "nvcc: NVIDIA \(R\) Cuda compiler driver")
+
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCUDA/(\\./)?(CompilerIdCUDA.xctest/)?CompilerIdCUDA[ \t\n\\\"]")
+ set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
+
+ set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v")
+ if(CMAKE_CUDA_HOST_COMPILER)
+ list(APPEND CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-ccbin=${CMAKE_CUDA_HOST_COMPILER}")
+ endif()
+
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
+endif()
+
+include(CMakeFindBinUtils)
+
+#if this compiler vendor is matches NVIDIA we can determine
+#what the host compiler is. This only needs to be done if the CMAKE_CUDA_HOST_COMPILER
+#has NOT been explicitly set
+#
+#Find the line from compiler ID that contains a.out ( or last line )
+#We also need to find the implicit link lines. Which can be done by replacing
+#the compiler with cuda-fake-ld and pass too CMAKE_PARSE_IMPLICIT_LINK_INFO
+if(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
+ #grab the last line of the output which holds the link line
+ string(REPLACE "#\$ " ";" nvcc_output "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ list(GET nvcc_output -1 nvcc_output)
+
+ #extract the compiler that is being used for linking
+ string(REPLACE " " ";" nvcc_output_to_find_launcher "${nvcc_output}")
+ list(GET nvcc_output_to_find_launcher 0 CMAKE_CUDA_HOST_LINK_LAUNCHER)
+ #we need to remove the quotes that nvcc adds around the directory section
+ #of the path
+ string(REPLACE "\"" "" CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_CUDA_HOST_LINK_LAUNCHER}")
+
+ #prefix the line with cuda-fake-ld so that implicit link info believes it is
+ #a link line
+ set(nvcc_output "cuda-fake-ld ${nvcc_output}")
+ CMAKE_PARSE_IMPLICIT_LINK_INFO("${nvcc_output}"
+ CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES
+ CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES
+ CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ log
+ "${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}")
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed CUDA nvcc implicit link information from above output:\n${log}\n\n")
+
+endif()
+
+# configure all variables set in this file
+configure_file(${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
+ @ONLY
+ )
+
+set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
+set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 59d8ab6..c5a2bcb 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -101,6 +101,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
+ set(CMAKE_${lang}_COMPILER_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
endfunction()
include(CMakeCompilerIdDetection)
@@ -135,7 +137,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
set(COMPILER_DESCRIPTION
"Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1}
Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
-Id flags: ${testflags}
+Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
")
# Compile the compiler identification source.
@@ -322,6 +324,7 @@ Id flags: ${testflags}
${CMAKE_${lang}_COMPILER_ID_ARG1}
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
${testflags}
+ ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
"${src}"
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
@@ -400,6 +403,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# 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()
#-----------------------------------------------------------------------------
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake
new file mode 100644
index 0000000..670b31d
--- /dev/null
+++ b/Modules/CMakeTestCUDACompiler.cmake
@@ -0,0 +1,71 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(CMAKE_CUDA_COMPILER_FORCED)
+ # The compiler configuration was forced by the user.
+ # Assume the user has configured all compiler information.
+ set(CMAKE_CUDA_COMPILER_WORKS TRUE)
+ return()
+endif()
+
+include(CMakeTestCompilerCommon)
+
+# Remove any cached result from an older CMake version.
+# We now store this in CMakeCUDACompiler.cmake.
+unset(CMAKE_CUDA_COMPILER_WORKS CACHE)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected cuda compiler can actually compile
+# and link the most basic of programs. If not, a fatal error
+# is set and cmake stops processing commands and will not generate
+# any makefiles or projects.
+if(NOT CMAKE_CUDA_COMPILER_WORKS)
+ PrintTestCompilerStatus("CUDA" "")
+ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.cu
+ "#ifndef __CUDACC__\n"
+ "# error \"The CMAKE_CUDA_COMPILER is set to an invalid CUDA compiler\"\n"
+ "#endif\n"
+ "int main(){return 0;}\n")
+
+ try_compile(CMAKE_CUDA_COMPILER_WORKS ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.cu
+ OUTPUT_VARIABLE __CMAKE_CUDA_COMPILER_OUTPUT)
+
+ # Move result from cache to normal variable.
+ set(CMAKE_CUDA_COMPILER_WORKS ${CMAKE_CUDA_COMPILER_WORKS})
+ unset(CMAKE_CUDA_COMPILER_WORKS CACHE)
+ set(CUDA_TEST_WAS_RUN 1)
+endif()
+
+if(NOT CMAKE_CUDA_COMPILER_WORKS)
+ PrintTestCompilerStatus("CUDA" " -- broken")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the CUDA compiler works failed with "
+ "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n")
+ message(FATAL_ERROR "The CUDA compiler \"${CMAKE_CUDA_COMPILER}\" "
+ "is not able to compile a simple test program.\nIt fails "
+ "with the following output:\n ${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n"
+ "CMake will not be able to correctly generate this project.")
+else()
+ if(CUDA_TEST_WAS_RUN)
+ PrintTestCompilerStatus("CUDA" " -- works")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the CUDA compiler works passed with "
+ "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n")
+ endif()
+
+ # Try to identify the ABI and configure it into CMakeCUDACompiler.cmake
+ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
+ CMAKE_DETERMINE_COMPILER_ABI(CUDA ${CMAKE_ROOT}/Modules/CMakeCUDACompilerABI.cu)
+
+ # Re-configure to save learned information.
+ configure_file(
+ ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
+ ${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
+ @ONLY
+ )
+ include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake)
+endif()
+
+
+unset(__CMAKE_CUDA_COMPILER_OUTPUT)
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
new file mode 100644
index 0000000..e3ff5e3
--- /dev/null
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -0,0 +1,24 @@
+set(CMAKE_CUDA_VERBOSE_FLAG "-v")
+
+
+set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
+set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
+#CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we don' need
+#to forward it through nvcc
+set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
+set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
+
+set(CMAKE_CUDA_FLAGS_INIT " ")
+set(CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
+set(CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
+set(CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+
+set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
+set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
+set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
+set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
+
+set(CMAKE_CUDA_STANDARD_DEFAULT 98)
diff --git a/Modules/Compiler/NVIDIA-DetermineCompiler.cmake b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
new file mode 100644
index 0000000..32ccf8a
--- /dev/null
+++ b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__NVCC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__CUDACC_VER_MAJOR__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__CUDACC_VER_MINOR__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CUDACC_VER_BUILD__)")
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index d0ffa03..fa9a434 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -39,8 +39,6 @@ if(ALSA_INCLUDE_DIR AND EXISTS "${ALSA_INCLUDE_DIR}/alsa/version.h")
unset(alsa_version_str)
endif()
-# handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA
REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake
index 8f2b007..6944ac1 100644
--- a/Modules/FindASPELL.cmake
+++ b/Modules/FindASPELL.cmake
@@ -25,8 +25,6 @@ find_program(ASPELL_EXECUTABLE
find_library(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell)
-# handle the QUIETLY and REQUIRED arguments and set ASPELL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR ASPELL_EXECUTABLE)
diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake
index 38701be..88a2a25 100644
--- a/Modules/FindAVIFile.cmake
+++ b/Modules/FindAVIFile.cmake
@@ -32,8 +32,6 @@ if (UNIX)
endif ()
-# handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY)
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index fab04c2..95f0c56 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -73,10 +73,6 @@ if(ARMADILLO_INCLUDE_DIR)
set(ARMADILLO_VERSION_STRING "${ARMADILLO_VERSION_MAJOR}.${ARMADILLO_VERSION_MINOR}.${ARMADILLO_VERSION_PATCH}")
endif ()
-#======================
-
-
-# Checks 'REQUIRED', 'QUIET' and versions.
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Armadillo
REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR
@@ -88,10 +84,7 @@ if (ARMADILLO_FOUND)
set(ARMADILLO_LIBRARIES ${ARMADILLO_LIBRARY})
endif ()
-
# Hide internal variables
mark_as_advanced(
ARMADILLO_INCLUDE_DIR
ARMADILLO_LIBRARY)
-
-#======================
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index d40b806..0ebd465 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -253,5 +253,3 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
VERSION_VAR BISON_VERSION)
-
-# FindBISON.cmake ends here
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 2d93eba..d2307f1 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -45,8 +45,6 @@ if (BZIP2_INCLUDE_DIR AND EXISTS "${BZIP2_INCLUDE_DIR}/bzlib.h")
string(REGEX REPLACE ".* bzip2/libbzip2 version ([0-9]+\\.[^ ]+) of [0-9]+ .*" "\\1" BZIP2_VERSION_STRING "${BZLIB_H}")
endif ()
-# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
REQUIRED_VARS BZIP2_LIBRARIES BZIP2_INCLUDE_DIR
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
index d000f79..fc6695c 100644
--- a/Modules/FindBullet.cmake
+++ b/Modules/FindBullet.cmake
@@ -78,8 +78,6 @@ _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody)
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_Debug BulletSoftBody_d)
-# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 200f8c3..f4bcc36 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -44,8 +44,6 @@ if(CURL_INCLUDE_DIR)
endforeach()
endif()
-# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake
index fea644d..f11903d 100644
--- a/Modules/FindCoin3D.cmake
+++ b/Modules/FindCoin3D.cmake
@@ -70,11 +70,7 @@ else ()
endif ()
-# handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS)
mark_as_advanced(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES )
-
-
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index a0929ce..4365e99 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -190,8 +190,6 @@ endif()
set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
-# handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
CURSES_LIBRARY CURSES_INCLUDE_PATH)
diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake
index 37164e6..acd4ef6 100644
--- a/Modules/FindDart.cmake
+++ b/Modules/FindDart.cmake
@@ -26,8 +26,6 @@ find_path(DART_ROOT README.INSTALL
DOC "If you have Dart installed, where is it located?"
)
-# handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT)
diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake
index dc8e38a..45fab82 100644
--- a/Modules/FindDevIL.cmake
+++ b/Modules/FindDevIL.cmake
@@ -67,6 +67,6 @@ find_library(ILU_LIBRARIES
#message("ILU_LIBRARIES is ${ILU_LIBRARIES}")
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(IL DEFAULT_MSG
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG
IL_LIBRARIES ILU_LIBRARIES
- ILUT_LIBRARIES IL_INCLUDE_DIR)
+ IL_INCLUDE_DIR)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index cc89203..09963fc 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -44,8 +44,6 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
endforeach()
endif ()
-# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 69cf513..214873c 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -218,5 +218,3 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE
VERSION_VAR FLEX_VERSION)
-
-# FindFLEX.cmake ends here
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 21a5d89..9ea77df 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -135,9 +135,6 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
endforeach()
endif()
-
-# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index 88c4180..0843d5f 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -91,8 +91,6 @@ if(GIF_INCLUDE_DIR)
CMAKE_POP_CHECK_STATE()
endif()
-# handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR
VERSION_VAR GIF_VERSION )
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 98377a2..446c3a8 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -55,7 +55,6 @@
# GSL_LIBRARY_DEBUG - Location of the debug GSL library (if any).
#
-# Include these modules to handle the QUIETLY and REQUIRED arguments.
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#=============================================================================
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 78dc6ba..1f447f1 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -957,4 +957,3 @@ endif()
if(GTK2_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
endif()
-
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index 5d38193..769c6c3 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -65,9 +65,6 @@ if(GIT_EXECUTABLE)
unset(git_version)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set Git_FOUND to TRUE if
-# all listed variables are TRUE
-
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Git
REQUIRED_VARS GIT_EXECUTABLE
diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake
index a6ab092..1a97d99 100644
--- a/Modules/FindGnuTLS.cmake
+++ b/Modules/FindGnuTLS.cmake
@@ -50,8 +50,6 @@ find_library(GNUTLS_LIBRARY NAMES gnutls libgnutls
mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
-# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS
REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
@@ -61,4 +59,3 @@ if(GNUTLS_FOUND)
set(GNUTLS_LIBRARIES ${GNUTLS_LIBRARY})
set(GNUTLS_INCLUDE_DIRS ${GNUTLS_INCLUDE_DIR})
endif()
-
diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake
index 9ace651..aa4cd6c 100644
--- a/Modules/FindGnuplot.cmake
+++ b/Modules/FindGnuplot.cmake
@@ -46,12 +46,9 @@ endif()
# for compatibility
set(GNUPLOT ${GNUPLOT_EXECUTABLE})
-# handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot
REQUIRED_VARS GNUPLOT_EXECUTABLE
VERSION_VAR GNUPLOT_VERSION_STRING)
mark_as_advanced( GNUPLOT_EXECUTABLE )
-
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index 72d70ad..bb0e2f0 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -36,12 +36,9 @@ if (HSPELL_INCLUDE_DIR)
unset(HSPELL_H)
endif()
-# handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR
VERSION_VAR HSPELL_VERSION_STRING)
mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)
-
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index ef85abc..8aa553e 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -90,8 +90,6 @@ if(HG_EXECUTABLE)
endmacro(HG_WC_INFO)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(Hg
REQUIRED_VARS HG_EXECUTABLE
diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake
index bd3e327..26e95a0 100644
--- a/Modules/FindIcotool.cmake
+++ b/Modules/FindIcotool.cmake
@@ -39,8 +39,6 @@ if(ICOTOOL_EXECUTABLE)
unset(_icotool_version)
endif()
-# handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
Icotool
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index b644181..e233714 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -26,8 +26,6 @@ find_path(JPEG_INCLUDE_DIR jpeglib.h)
set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
-# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR)
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index 748510e..db76657 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -34,8 +34,6 @@ if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h")
string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}")
endif ()
-# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper
REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index e30917d..5c0abb0 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -262,4 +262,3 @@ mark_as_advanced(
set(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE})
set(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE})
set(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE})
-
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index 1d8f6ce..d1f4fa4 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -271,7 +271,6 @@ mark_as_advanced(
HTLATEX_COMPILER
)
-# handle variables for found Latex and its components
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(LATEX
REQUIRED_VARS LATEX_COMPILER
diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake
index 8781bae..00d5e7a 100644
--- a/Modules/FindLTTngUST.cmake
+++ b/Modules/FindLTTngUST.cmake
@@ -90,8 +90,6 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
set(LTTNGUST_LIBRARIES ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
endif()
-# handle the QUIETLY and REQUIRED arguments and set LTTNGUST_FOUND to
-# TRUE if all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(LTTngUST FOUND_VAR LTTNGUST_FOUND
REQUIRED_VARS LTTNGUST_LIBRARIES
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 1a26bbb..38e512f 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -46,17 +46,11 @@ if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive.h")
unset(_LibArchive_VERSION_STRING)
endif()
-# Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND
-# to TRUE if all listed variables are TRUE.
-# (Use ${CMAKE_ROOT}/Modules instead of ${CMAKE_CURRENT_LIST_DIR} because CMake
-# itself includes this FindLibArchive when built with an older CMake that does
-# not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.)
-include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(LibArchive
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
VERSION_VAR LibArchive_VERSION
)
-set(LibArchive_FOUND ${LIBARCHIVE_FOUND})
unset(LIBARCHIVE_FOUND)
if(LibArchive_FOUND)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 9580981..613f927 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -52,8 +52,6 @@ elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.
unset(libxml2_version_str)
endif()
-# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake
index aff464e..cd1b021 100644
--- a/Modules/FindMPEG.cmake
+++ b/Modules/FindMPEG.cmake
@@ -34,8 +34,6 @@ find_library( MPEG_vo_LIBRARY vo
/usr/local/livid/mpeg2dec/libvo/.libs
)
-# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY)
diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake
index e28054d..2c75d7b 100644
--- a/Modules/FindMPEG2.cmake
+++ b/Modules/FindMPEG2.cmake
@@ -35,9 +35,6 @@ find_library( MPEG2_vo_LIBRARY vo
/usr/local/livid/mpeg2dec/libvo/.libs
)
-
-# handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 676e1bc..842acef 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -91,7 +91,6 @@
#
# In new projects, please use the ``MPI_<lang>_XXX`` equivalents.
-# include this to handle the QUIETLY and REQUIRED arguments
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#
diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake
index 3923238..7304d95 100644
--- a/Modules/FindMotif.cmake
+++ b/Modules/FindMotif.cmake
@@ -30,12 +30,9 @@ if(UNIX)
endif()
-# handle the QUIETLY and REQUIRED arguments and set MOTIF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR)
-
mark_as_advanced(
MOTIF_INCLUDE_DIR
MOTIF_LIBRARIES
diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake
index 1abb0d6..8622b4c 100644
--- a/Modules/FindOpenAL.cmake
+++ b/Modules/FindOpenAL.cmake
@@ -92,8 +92,6 @@ find_library(OPENAL_LIBRARY
unset(_OpenAL_ARCH_DIR)
-# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index e487726..295de65 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -156,8 +156,6 @@ endif()
# This deprecated setting is for backward compatibility with CMake1.4
set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
-# handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS})
unset(_OpenGL_REQUIRED_VARS)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index af873fa..425aa45 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -227,4 +227,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph
unset(_osg_component_founds)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR})
-
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 6f94d50..1d5d553 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -140,8 +140,6 @@ if(ZLIB_FOUND)
endif ()
endif()
-# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake
index a0c8a33..423fc69 100644
--- a/Modules/FindPerl.cmake
+++ b/Modules/FindPerl.cmake
@@ -70,8 +70,6 @@ endif()
# Deprecated settings for compatibility with CMake1.4
set(PERL ${PERL_EXECUTABLE})
-# handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl
REQUIRED_VARS PERL_EXECUTABLE
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index 42729d7..e01e75e 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -239,8 +239,6 @@ if (PERL_EXECUTABLE)
endif ()
-# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH
VERSION_VAR PERL_VERSION_STRING)
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
index fe5b397..cfe9b0f 100644
--- a/Modules/FindPhysFS.cmake
+++ b/Modules/FindPhysFS.cmake
@@ -43,8 +43,5 @@ find_library(PHYSFS_LIBRARY
/opt
)
-# handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR)
-
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 3f75b19..8b7131b 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -381,8 +381,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
if (_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
else()
- list(APPEND _pkg_check_modules_exist_query --exists --print-errors --short-errors)
+ list(APPEND _pkg_check_modules_exist_query --exists)
endif()
+ list(APPEND _pkg_check_modules_exist_query --print-errors --short-errors)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 103e820..f255246 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -145,8 +145,6 @@ if(PYTHON_EXECUTABLE)
unset(_VERSION)
endif()
-# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake
index 2ee1899..995d882 100644
--- a/Modules/FindQuickTime.cmake
+++ b/Modules/FindQuickTime.cmake
@@ -29,7 +29,5 @@ find_library(QUICKTIME_LIBRARY QuickTime
lib
)
-# handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR)
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 12d6616..b6e24a3 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -205,8 +205,6 @@ find_path(TK_INCLUDE_PATH
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
)
-# handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index 23ae308..b622ca6 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -65,8 +65,6 @@ if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h")
unset(tiff_version_str)
endif()
-# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF
REQUIRED_VARS TIFF_LIBRARY TIFF_INCLUDE_DIR
diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake
index c8a87ec..9fcb41c 100644
--- a/Modules/FindTclsh.cmake
+++ b/Modules/FindTclsh.cmake
@@ -89,8 +89,6 @@ if(TCL_TCLSH)
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
-# handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh
REQUIRED_VARS TCL_TCLSH
diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake
index 68419e2..4fcb2fa 100644
--- a/Modules/FindWget.cmake
+++ b/Modules/FindWget.cmake
@@ -21,8 +21,6 @@ find_program(WGET_EXECUTABLE
${CYGWIN_INSTALL_PATH}/bin
)
-# handle the QUIETLY and REQUIRED arguments and set WGET_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wget DEFAULT_MSG WGET_EXECUTABLE)
@@ -30,4 +28,4 @@ mark_as_advanced( WGET_EXECUTABLE )
# WGET option is deprecated.
# use WGET_EXECUTABLE instead.
-set (WGET ${WGET_EXECUTABLE} )
+set (WGET ${WGET_EXECUTABLE})
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 5ee55b3..4065999 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -108,8 +108,6 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
endif()
-# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
-# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
VERSION_VAR ZLIB_VERSION_STRING)
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index c5912f8..651f9f1 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -57,7 +57,8 @@
set(SWIG_CXX_EXTENSION "cxx")
set(SWIG_EXTRA_LIBRARIES "")
-set(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py")
+set(SWIG_PYTHON_EXTRA_FILE_EXTENSIONS ".py")
+set(SWIG_JAVA_EXTRA_FILE_EXTENSIONS ".java" "JNI.java")
#
# For given swig module initialize variables associated with it
@@ -123,9 +124,9 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
endif ()
endif()
- foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION})
+ foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSIONS})
set(${outfiles} ${${outfiles}}
- "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}")
+ "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}${it}")
endforeach()
endmacro()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index fcda6f9..5b381b4 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -298,6 +298,8 @@ set(SRCS
cmLinkItem.h
cmLinkLineComputer.cxx
cmLinkLineComputer.h
+ cmLinkLineDeviceComputer.cxx
+ cmLinkLineDeviceComputer.h
cmListFileCache.cxx
cmListFileCache.h
cmListFileLexer.c
@@ -438,24 +440,10 @@ set(SRCS
cmCreateTestSourceList.h
cmDefinePropertyCommand.cxx
cmDefinePropertyCommand.h
- cmElseCommand.cxx
- cmElseCommand.h
- cmElseIfCommand.cxx
- cmElseIfCommand.h
cmEnableLanguageCommand.cxx
cmEnableLanguageCommand.h
cmEnableTestingCommand.cxx
cmEnableTestingCommand.h
- cmEndForEachCommand.cxx
- cmEndForEachCommand.h
- cmEndFunctionCommand.cxx
- cmEndFunctionCommand.h
- cmEndIfCommand.cxx
- cmEndIfCommand.h
- cmEndMacroCommand.cxx
- cmEndMacroCommand.h
- cmEndWhileCommand.cxx
- cmEndWhileCommand.h
cmExecProgramCommand.cxx
cmExecProgramCommand.h
cmExecuteProcessCommand.cxx
@@ -610,6 +598,8 @@ set(SRCS
cmTryCompileCommand.h
cmTryRunCommand.cxx
cmTryRunCommand.h
+ cmUnexpectedCommand.cxx
+ cmUnexpectedCommand.h
cmUnsetCommand.cxx
cmUnsetCommand.h
cmUseMangledMesaCommand.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d0fc2b8..1144390 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 7)
-set(CMake_VERSION_PATCH 20161126)
+set(CMake_VERSION_PATCH 20161130)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 0098a4b..ba3248f 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackIFWInstaller.h"
+#include <cmConfigure.h>
+#include <sstream>
+#include <stddef.h>
+#include <utility>
+
#include "CPack/cmCPackGenerator.h"
#include "CPack/cmCPackLog.h"
#include "cmCPackIFWGenerator.h"
@@ -12,9 +17,6 @@
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
-#include <cmConfigure.h>
-#include <utility>
-
#ifdef cmCPackLogger
#undef cmCPackLogger
#endif
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index 6eb4a6c..b159e64 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -3,8 +3,10 @@
#include <cmsys/FStream.hxx>
#include <cmsys/Process.h>
#include <cmsys/SystemTools.hxx>
-
#include <iostream>
+#include <stddef.h>
+#include <string>
+#include <vector>
#include <CoreFoundation/CoreFoundation.h>
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 0c4f573..2bccf2e 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -4,6 +4,7 @@
#include <CPack/cmCPackComponentGroup.h>
#include <CPack/cmCPackLog.h>
+#include <algorithm>
#include <cmCryptoHash.h>
#include <cmGeneratedFileStream.h>
#include <cmInstalledFile.h>
diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
index b535979..a3c8394 100644
--- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
+++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h
@@ -5,9 +5,8 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
-
#include <cmsys/FStream.hxx>
+#include <string>
/** \class cmWIXRichtTextFormatWriter
* \brief Helper class to generate Rich Text Format (RTF) documents
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index 61d0127..d538901 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -2,11 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackBundleGenerator.h"
+#include <sstream>
+#include <vector>
+
#include "cmCPackLog.h"
#include "cmSystemTools.h"
-#include <cmsys/RegularExpression.hxx>
-
cmCPackBundleGenerator::cmCPackBundleGenerator()
{
}
diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h
index 9ea4304..c9200c1 100644
--- a/Source/CPack/cmCPackBundleGenerator.h
+++ b/Source/CPack/cmCPackBundleGenerator.h
@@ -3,7 +3,11 @@
#ifndef cmCPackBundleGenerator_h
#define cmCPackBundleGenerator_h
+#include <cmConfigure.h>
+#include <string>
+
#include "cmCPackDragNDropGenerator.h"
+#include "cmCPackGenerator.h"
/** \class cmCPackBundleGenerator
* \brief A generator for OSX bundles
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index bdf4076..fd67df9 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -2,14 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackDragNDropGenerator.h"
+#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx>
-
#include <iomanip>
+#include <map>
+#include <stdlib.h>
#include <CoreFoundation/CoreFoundation.h>
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h
index f803ad9..876eab7 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.h
+++ b/Source/CPack/cmCPackDragNDropGenerator.h
@@ -3,6 +3,12 @@
#ifndef cmCPackDragNDropGenerator_h
#define cmCPackDragNDropGenerator_h
+#include <cmConfigure.h>
+#include <sstream>
+#include <stddef.h>
+#include <string>
+#include <vector>
+
#include "cmCPackGenerator.h"
class cmGeneratedFileStream;
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 09b9c0d..3878a32 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -2,24 +2,24 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackGenerator.h"
+#include <algorithm>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Glob.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <list>
+#include <utility>
+
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
-#include "cmStateTypes.h"
+#include "cmStateSnapshot.h"
#include "cmXMLSafe.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <algorithm>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/RegularExpression.hxx>
-#include <list>
-#include <utility>
-
#if defined(__HAIKU__)
#include <FindDirectory.h>
#include <StorageDefs.h>
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index f32dd70..b43bf8a 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -5,14 +5,15 @@
#include <cmConfigure.h>
-#include "cmCPackComponentGroup.h"
-#include "cmSystemTools.h"
-
#include <map>
#include <sstream>
#include <string>
#include <vector>
+#include "cmCPackComponentGroup.h"
+#include "cmSystemTools.h"
+
+class cmCPackGenerator;
class cmCPackLog;
class cmInstalledFile;
class cmMakefile;
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 2a0e65b..b012f01 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -2,9 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackGeneratorFactory.h"
+#include <cmConfigure.h>
+#include <ostream>
+#include <utility>
+
#include "IFW/cmCPackIFWGenerator.h"
+#include "cmAlgorithms.h"
#include "cmCPack7zGenerator.h"
#include "cmCPackGenerator.h"
+#include "cmCPackLog.h"
#include "cmCPackNSISGenerator.h"
#include "cmCPackSTGZGenerator.h"
#include "cmCPackTGZGenerator.h"
@@ -36,12 +42,6 @@
#include "WiX/cmCPackWIXGenerator.h"
#endif
-#include "cmAlgorithms.h"
-#include "cmCPackLog.h"
-
-#include <ostream>
-#include <utility>
-
cmCPackGeneratorFactory::cmCPackGeneratorFactory()
{
if (cmCPackTGZGenerator::CanGenerate()) {
diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h
index 0a98f91..4ee0bc1 100644
--- a/Source/CPack/cmCPackGeneratorFactory.h
+++ b/Source/CPack/cmCPackGeneratorFactory.h
@@ -3,7 +3,7 @@
#ifndef cmCPackGeneratorFactory_h
#define cmCPackGeneratorFactory_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
#include <map>
#include <string>
diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx
index 317f613..7d5c192 100644
--- a/Source/CPack/cmCPackLog.cxx
+++ b/Source/CPack/cmCPackLog.cxx
@@ -2,11 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackLog.h"
+#include <cmConfigure.h>
+#include <iostream>
+
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
-#include <iostream>
-
cmCPackLog::cmCPackLog()
{
this->Verbose = false;
diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h
index 9ffe5c4..419c932 100644
--- a/Source/CPack/cmCPackLog.h
+++ b/Source/CPack/cmCPackLog.h
@@ -3,7 +3,7 @@
#ifndef cmCPackLog_h
#define cmCPackLog_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
#include <ostream>
#include <string.h>
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 225c1fb..0d8dc48 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -2,16 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackOSXX11Generator.h"
+#include <sstream>
+#include <sys/stat.h>
+
+#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cmake.h"
-
-#include <cmsys/Glob.hxx>
-#include <cmsys/SystemTools.hxx>
-#include <sys/stat.h>
cmCPackOSXX11Generator::cmCPackOSXX11Generator()
{
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
index eb1e5ff..1918e21 100644
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ b/Source/CPack/cmCPackOSXX11Generator.h
@@ -3,6 +3,9 @@
#ifndef cmCPackOSXX11Generator_h
#define cmCPackOSXX11Generator_h
+#include <cmConfigure.h>
+#include <string>
+
#include "cmCPackGenerator.h"
/** \class cmCPackOSXX11Generator
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx
index 785ee01..70ae267 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -2,18 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackPKGGenerator.h"
+#include <vector>
+
#include "cmCPackComponentGroup.h"
+#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-#include "cmake.h"
-
-#include <cmsys/Glob.hxx>
-#include <cmsys/SystemTools.hxx>
cmCPackPKGGenerator::cmCPackPKGGenerator()
{
diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h
index bb3c1a7..1e96a62 100644
--- a/Source/CPack/cmCPackPKGGenerator.h
+++ b/Source/CPack/cmCPackPKGGenerator.h
@@ -5,10 +5,12 @@
#include <cmConfigure.h>
#include <set>
+#include <sstream>
+#include <string>
+#include "cmCPackComponentGroup.h"
#include "cmCPackGenerator.h"
-class cmCPackComponent;
class cmXMLWriter;
/** \class cmCPackPKGGenerator
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index 25e8a1c..8000d6e 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -2,20 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackPackageMakerGenerator.h"
+#include <assert.h>
+#include <cmsys/FStream.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <map>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
+
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
-#include "cmake.h"
-
-#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/SystemTools.hxx>
-
-#include <assert.h>
static inline unsigned int getVersion(unsigned int major, unsigned int minor)
{
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index d679bc1..d4c6744 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -3,6 +3,9 @@
#ifndef cmCPackPackageMakerGenerator_h
#define cmCPackPackageMakerGenerator_h
+#include <cmConfigure.h>
+
+#include "cmCPackGenerator.h"
#include "cmCPackPKGGenerator.h"
class cmCPackComponent;
diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx
index ff0ec79..a46e3a6 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.cxx
+++ b/Source/CPack/cmCPackProductBuildGenerator.cxx
@@ -2,17 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackProductBuildGenerator.h"
+#include <map>
+#include <sstream>
+#include <stddef.h>
+
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
#include "cmSystemTools.h"
-#include "cmake.h"
-
-#include <cmsys/Glob.hxx>
-#include <cmsys/SystemTools.hxx>
cmCPackProductBuildGenerator::cmCPackProductBuildGenerator()
{
diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h
index 4145eb4..b6da470 100644
--- a/Source/CPack/cmCPackProductBuildGenerator.h
+++ b/Source/CPack/cmCPackProductBuildGenerator.h
@@ -3,6 +3,10 @@
#ifndef cmCPackProductBuildGenerator_h
#define cmCPackProductBuildGenerator_h
+#include <cmConfigure.h>
+#include <string>
+
+#include "cmCPackGenerator.h"
#include "cmCPackPKGGenerator.h"
class cmCPackComponent;
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 9817327..8ec03c2 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -2,17 +2,18 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackRPMGenerator.h"
-#include "cmCPackComponentGroup.h"
-#include "cmCPackGenerator.h"
-#include "cmCPackLog.h"
-#include "cmSystemTools.h"
-
#include <algorithm>
+#include <ctype.h>
#include <map>
#include <ostream>
#include <utility>
#include <vector>
+#include "cmCPackComponentGroup.h"
+#include "cmCPackGenerator.h"
+#include "cmCPackLog.h"
+#include "cmSystemTools.h"
+
cmCPackRPMGenerator::cmCPackRPMGenerator()
{
}
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 66ba9f6..682394e 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -2,10 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackSTGZGenerator.h"
-#include "cmCPackGenerator.h"
-#include "cmCPackLog.h"
-#include "cmSystemTools.h"
-
#include <cmsys/FStream.hxx>
#include <sstream>
#include <stdio.h>
@@ -16,6 +12,10 @@
// include sys/stat.h after sys/types.h
#include <sys/stat.h>
+#include "cmCPackGenerator.h"
+#include "cmCPackLog.h"
+#include "cmSystemTools.h"
+
cmCPackSTGZGenerator::cmCPackSTGZGenerator()
{
}
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 06472c6..fa526ae 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -2,6 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include <cmConfigure.h>
+#include <cmsys/CommandLineArguments.hxx>
+#include <cmsys/Encoding.hxx>
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <stddef.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#include <cmsys/ConsoleBuf.hxx>
+#endif
+
#include "cmCPackGenerator.h"
#include "cmCPackGeneratorFactory.h"
#include "cmCPackLog.h"
@@ -10,24 +24,11 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
-#include "cmStateTypes.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cmsys/CommandLineArguments.hxx>
-#include <cmsys/Encoding.hxx>
-#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
-#include <cmsys/ConsoleBuf.hxx>
-#endif
-#include <iostream>
-#include <map>
-#include <sstream>
-#include <stddef.h>
-#include <string>
-#include <utility>
-#include <vector>
-
static const char* cmDocumentationName[][2] = {
{ CM_NULLPTR, " cpack - Packaging driver provided by CMake." },
{ CM_NULLPTR, CM_NULLPTR }
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 20512ea..d30f6b3 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -2,12 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestGIT.h"
-#include "cmAlgorithms.h"
-#include "cmCTest.h"
-#include "cmCTestVC.h"
-#include "cmProcessTools.h"
-#include "cmSystemTools.h"
-
#include <cmsys/FStream.hxx>
#include <cmsys/Process.h>
#include <ctype.h>
@@ -16,6 +10,13 @@
#include <time.h>
#include <vector>
+#include "cmAlgorithms.h"
+#include "cmCTest.h"
+#include "cmCTestVC.h"
+#include "cmProcessOutput.h"
+#include "cmProcessTools.h"
+#include "cmSystemTools.h"
+
static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major,
unsigned int minor, unsigned int fix)
{
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index c093cc6..7638f45 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -2,12 +2,13 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestGenericHandler.h"
-#include "cmCTest.h"
-#include "cmSystemTools.h"
-
+#include <cmConfigure.h>
#include <sstream>
#include <utility>
+#include "cmCTest.h"
+#include "cmSystemTools.h"
+
cmCTestGenericHandler::cmCTestGenericHandler()
{
this->HandlerVerbose = cmSystemTools::OUTPUT_NONE;
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index 4176eb2..2ebbe70 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -3,16 +3,16 @@
#ifndef cmCTestGenericHandler_h
#define cmCTestGenericHandler_h
-#include <cmConfigure.h>
-
-#include "cmCTest.h"
-#include "cmSystemTools.h"
+#include <cmConfigure.h> // IWYU pragma: keep
#include <map>
#include <stddef.h>
#include <string>
#include <vector>
+#include "cmCTest.h"
+#include "cmSystemTools.h"
+
class cmCTestCommand;
class cmGeneratedFileStream;
class cmMakefile;
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 43c0fef..03e0319 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -4,24 +4,24 @@
#include <cmConfigure.h>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Process.h>
+#include <cmsys/RegularExpression.hxx>
+#include <iostream>
+#include <stdlib.h>
+#include <string.h>
+
#include "cmCryptoHash.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
-#include "cmStateTypes.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cm_auto_ptr.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Process.h>
-#include <cmsys/RegularExpression.hxx>
-#include <iostream>
-#include <stdlib.h>
-#include <string.h>
-
#ifdef _WIN32
#include <fcntl.h> // for _O_BINARY
#include <io.h> // for _setmode
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index 5e4c5ae..fd7c3a9 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestMemCheckCommand.h"
+#include <sstream>
+#include <vector>
+
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmCTestMemCheckHandler.h"
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index a10e271..ee4630a 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -5,11 +5,13 @@
#include <cmConfigure.h> // IWYU pragma: keep
-#include <cmCTestTestHandler.h>
+#include <set>
#include <stddef.h>
#include <string>
#include <vector>
+#include "cmCTestTestHandler.h"
+
class cmCTest;
class cmProcess;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 08ea4ee..b537242 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -2,6 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestScriptHandler.h"
+#include <cmsys/Directory.hxx>
+#include <cmsys/Process.h>
+#include <map>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <utility>
+
#include "cmCTest.h"
#include "cmCTestBuildCommand.h"
#include "cmCTestCommand.h"
@@ -23,19 +32,10 @@
#include "cmMakefile.h"
#include "cmState.h"
#include "cmStateDirectory.h"
-#include "cmStateTypes.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
#include "cmake.h"
-#include <cmsys/Directory.hxx>
-#include <cmsys/Process.h>
-#include <map>
-#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <utility>
-
#ifdef _WIN32
#include <windows.h>
#else
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 2b2d207..0f13c1e 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -2,6 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestSubmitHandler.h"
+#include <cm_curl.h>
+#include <cm_jsoncpp_reader.h>
+#include <cm_jsoncpp_value.h>
+#include <cmsys/Process.h>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "cmCTest.h"
#include "cmCTestCurl.h"
#include "cmCTestScriptHandler.h"
@@ -9,19 +17,11 @@
#include "cmGeneratedFileStream.h"
#include "cmProcessOutput.h"
#include "cmState.h"
-#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cmThirdParty.h"
#include "cmXMLParser.h"
#include "cmake.h"
-#include <cm_curl.h>
-#include <cm_jsoncpp_reader.h>
-#include <cm_jsoncpp_value.h>
-#include <cmsys/Process.h>
-#include <sstream>
-#include <stdio.h>
-#include <stdlib.h>
-
#if defined(CTEST_USE_XMLRPC)
#include "cmVersion.h"
#include <cm_xmlrpc.h>
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 132d049..ab43dbc 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2,21 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestTestHandler.h"
-#include "cmCTest.h"
-#include "cmCTestBatchTestHandler.h"
-#include "cmCTestMultiProcessHandler.h"
-#include "cmCommand.h"
-#include "cmGeneratedFileStream.h"
-#include "cmGlobalGenerator.h"
-#include "cmMakefile.h"
-#include "cmState.h"
-#include "cmStateTypes.h"
-#include "cmSystemTools.h"
-#include "cmXMLWriter.h"
-#include "cm_auto_ptr.hxx"
-#include "cm_utf8.h"
-#include "cmake.h"
-
#include <algorithm>
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
@@ -32,6 +17,21 @@
#include <string.h>
#include <time.h>
+#include "cmCTest.h"
+#include "cmCTestBatchTestHandler.h"
+#include "cmCTestMultiProcessHandler.h"
+#include "cmCommand.h"
+#include "cmGeneratedFileStream.h"
+#include "cmGlobalGenerator.h"
+#include "cmMakefile.h"
+#include "cmState.h"
+#include "cmStateSnapshot.h"
+#include "cmSystemTools.h"
+#include "cmXMLWriter.h"
+#include "cm_auto_ptr.hxx"
+#include "cm_utf8.h"
+#include "cmake.h"
+
class cmExecutionStatus;
class cmCTestSubdirCommand : public cmCommand
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
index 9266bce..717117a 100644
--- a/Source/CTest/cmCTestUploadCommand.cxx
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestUploadCommand.h"
+#include <sstream>
+#include <vector>
+
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
#include "cmCTestUploadHandler.h"
@@ -9,8 +12,6 @@
#include "cmSystemTools.h"
#include "cmake.h"
-#include <sstream>
-
cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
{
cmCTestGenericHandler* handler =
diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h
index dd8b973..2681ba0 100644
--- a/Source/CTest/cmCTestVC.h
+++ b/Source/CTest/cmCTestVC.h
@@ -5,11 +5,12 @@
#include <cmConfigure.h>
-#include "cmProcessTools.h"
-
#include <iosfwd>
#include <string>
+#include "cmProcessOutput.h"
+#include "cmProcessTools.h"
+
class cmCTest;
class cmXMLWriter;
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index db97c47..eded883 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -62,11 +62,10 @@
*----------------------------------------------------------------------
*/
#include "bindexplib.h"
+
#include <cmsys/Encoding.hxx>
#include <fstream>
#include <iostream>
-#include <stdio.h>
-#include <string>
#include <windows.h>
typedef struct cmANON_OBJECT_HEADER_BIGOBJ {
diff --git a/Source/bindexplib.h b/Source/bindexplib.h
index 1a0c3a3..d6900ba 100644
--- a/Source/bindexplib.h
+++ b/Source/bindexplib.h
@@ -5,8 +5,9 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
-
+#include <set>
+#include <stdio.h>
+#include <string>
class bindexplib
{
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 4436327..8db2e5f 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -14,6 +14,7 @@
#include <time.h>
#include <vector>
+class cmCTest;
class cmCTestGenericHandler;
class cmCTestStartCommand;
class cmGeneratedFileStream;
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index a21a7d2..99fe587 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCallVisualStudioMacro.h"
+#include <sstream>
+
#include "cmSystemTools.h"
#if defined(_MSC_VER)
diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h
index 7ff4513..e9d34e5 100644
--- a/Source/cmCallVisualStudioMacro.h
+++ b/Source/cmCallVisualStudioMacro.h
@@ -5,7 +5,7 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <string>
/** \class cmCallVisualStudioMacro
* \brief Control class for communicating with CMake's Visual Studio macros
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 103e72c..4c5b093 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -18,14 +18,8 @@
#include "cmContinueCommand.h"
#include "cmCreateTestSourceList.h"
#include "cmDefinePropertyCommand.h"
-#include "cmElseCommand.h"
#include "cmEnableLanguageCommand.h"
#include "cmEnableTestingCommand.h"
-#include "cmEndForEachCommand.h"
-#include "cmEndFunctionCommand.h"
-#include "cmEndIfCommand.h"
-#include "cmEndMacroCommand.h"
-#include "cmEndWhileCommand.h"
#include "cmExecProgramCommand.h"
#include "cmExecuteProcessCommand.h"
#include "cmFileCommand.h"
@@ -74,6 +68,7 @@
#include "cmTargetLinkLibrariesCommand.h"
#include "cmTryCompileCommand.h"
#include "cmTryRunCommand.h"
+#include "cmUnexpectedCommand.h"
#include "cmUnsetCommand.h"
#include "cmWhileCommand.h"
@@ -82,7 +77,6 @@
#include "cmAuxSourceDirectoryCommand.h"
#include "cmBuildNameCommand.h"
#include "cmCMakeHostSystemInformationCommand.h"
-#include "cmElseIfCommand.h"
#include "cmExportCommand.h"
#include "cmExportLibraryDependenciesCommand.h"
#include "cmFLTKWrapUICommand.h"
@@ -130,14 +124,8 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmContinueCommand);
commands.push_back(new cmCreateTestSourceList);
commands.push_back(new cmDefinePropertyCommand);
- commands.push_back(new cmElseCommand);
commands.push_back(new cmEnableLanguageCommand);
commands.push_back(new cmEnableTestingCommand);
- commands.push_back(new cmEndForEachCommand);
- commands.push_back(new cmEndFunctionCommand);
- commands.push_back(new cmEndIfCommand);
- commands.push_back(new cmEndMacroCommand);
- commands.push_back(new cmEndWhileCommand);
commands.push_back(new cmExecProgramCommand);
commands.push_back(new cmExecuteProcessCommand);
commands.push_back(new cmFileCommand);
@@ -189,12 +177,39 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmUnsetCommand);
commands.push_back(new cmWhileCommand);
+ commands.push_back(new cmUnexpectedCommand(
+ "else", "An ELSE command was found outside of a proper "
+ "IF ENDIF structure. Or its arguments did not match "
+ "the opening IF command."));
+ commands.push_back(new cmUnexpectedCommand(
+ "elseif", "An ELSEIF command was found outside of a proper "
+ "IF ENDIF structure."));
+ commands.push_back(new cmUnexpectedCommand(
+ "endforeach", "An ENDFOREACH command was found outside of a proper "
+ "FOREACH ENDFOREACH structure. Or its arguments did "
+ "not match the opening FOREACH command."));
+ commands.push_back(new cmUnexpectedCommand(
+ "endfunction", "An ENDFUNCTION command was found outside of a proper "
+ "FUNCTION ENDFUNCTION structure. Or its arguments did not "
+ "match the opening FUNCTION command."));
+ commands.push_back(new cmUnexpectedCommand(
+ "endif", "An ENDIF command was found outside of a proper "
+ "IF ENDIF structure. Or its arguments did not match "
+ "the opening IF command."));
+ commands.push_back(new cmUnexpectedCommand(
+ "endmacro", "An ENDMACRO command was found outside of a proper "
+ "MACRO ENDMACRO structure. Or its arguments did not "
+ "match the opening MACRO command."));
+ commands.push_back(new cmUnexpectedCommand(
+ "endwhile", "An ENDWHILE command was found outside of a proper "
+ "WHILE ENDWHILE structure. Or its arguments did not "
+ "match the opening WHILE command."));
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
commands.push_back(new cmAddCompileOptionsCommand);
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmBuildNameCommand);
commands.push_back(new cmCMakeHostSystemInformationCommand);
- commands.push_back(new cmElseIfCommand);
commands.push_back(new cmExportCommand);
commands.push_back(new cmExportLibraryDependenciesCommand);
commands.push_back(new cmFLTKWrapUICommand);
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 1d29c26..3d26ea7 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -70,6 +70,7 @@ public:
std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; }
std::string GetRPathLinkString();
+ std::string GetConfig() const { return this->Config; }
private:
void AddItem(std::string const& item, const cmGeneratorTarget* tgt);
void AddSharedDepItem(std::string const& item, cmGeneratorTarget const* tgt);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 3b46fc0..fbad778 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -44,6 +44,7 @@ static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES =
"CMAKE_TRY_COMPILE_OSX_ARCHITECTURES";
static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
"CMAKE_TRY_COMPILE_PLATFORM_VARIABLES";
+static std::string const kCMAKE_WARN_DEPRECATED = "CMAKE_WARN_DEPRECATED";
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
bool isTryRun)
@@ -453,6 +454,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
vars.insert(kCMAKE_OSX_SYSROOT);
vars.insert(kCMAKE_POSITION_INDEPENDENT_CODE);
vars.insert(kCMAKE_SYSROOT);
+ vars.insert(kCMAKE_WARN_DEPRECATED);
if (const char* varListStr = this->Makefile->GetDefinition(
kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index 26d55b3..0b562da 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -3,12 +3,14 @@
#ifndef cmCryptoHash_h
#define cmCryptoHash_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include <cm_auto_ptr.hxx>
+#include <stddef.h>
#include <string>
#include <vector>
+#include "cm_auto_ptr.hxx"
+
/**
* @brief Abstract base class for cryptographic hash generators
*/
diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx
deleted file mode 100644
index 207777e..0000000
--- a/Source/cmElseCommand.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmElseCommand.h"
-
-class cmExecutionStatus;
-
-bool cmElseCommand::InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&)
-{
- this->SetError("An ELSE command was found outside of a proper "
- "IF ENDIF structure. Or its arguments did not match "
- "the opening IF command.");
- return false;
-}
diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h
deleted file mode 100644
index c0162ad..0000000
--- a/Source/cmElseCommand.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmElseCommand_h
-#define cmElseCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-
-/** \class cmElseCommand
- * \brief ends an if block
- *
- * cmElseCommand ends an if block
- */
-class cmElseCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmElseCommand; }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "else"; }
-};
-
-#endif
diff --git a/Source/cmElseIfCommand.cxx b/Source/cmElseIfCommand.cxx
deleted file mode 100644
index 1c32248..0000000
--- a/Source/cmElseIfCommand.cxx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmElseIfCommand.h"
-
-class cmExecutionStatus;
-
-bool cmElseIfCommand::InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&)
-{
- this->SetError("An ELSEIF command was found outside of a proper "
- "IF ENDIF structure.");
- return false;
-}
diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h
deleted file mode 100644
index 3f1ddde..0000000
--- a/Source/cmElseIfCommand.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmElseIfCommand_h
-#define cmElseIfCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-
-/** \class cmElseIfCommand
- * \brief ends an if block
- *
- * cmElseIfCommand ends an if block
- */
-class cmElseIfCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmElseIfCommand; }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "elseif"; }
-};
-
-#endif
diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx
deleted file mode 100644
index fe6a7f3..0000000
--- a/Source/cmEndForEachCommand.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmEndForEachCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-bool cmEndForEachCommand::InvokeInitialPass(
- std::vector<cmListFileArgument> const&, cmExecutionStatus&)
-{
- this->SetError("An ENDFOREACH command was found outside of a proper "
- "FOREACH ENDFOREACH structure. Or its arguments did "
- "not match the opening FOREACH command.");
- return false;
-}
diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h
deleted file mode 100644
index 772a139..0000000
--- a/Source/cmEndForEachCommand.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEndForEachCommand_h
-#define cmEndForEachCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-/** \class cmEndForEachCommand
- * \brief ends an if block
- *
- * cmEndForEachCommand ends an if block
- */
-class cmEndForEachCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; }
-
- /**
- * Override cmCommand::InvokeInitialPass to get arguments before
- * expansion.
- */
- bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
- cmExecutionStatus&) CM_OVERRIDE;
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) CM_OVERRIDE
- {
- return false;
- }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "endforeach"; }
-};
-
-#endif
diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx
deleted file mode 100644
index 6adb42b..0000000
--- a/Source/cmEndFunctionCommand.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmEndFunctionCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-bool cmEndFunctionCommand::InvokeInitialPass(
- std::vector<cmListFileArgument> const&, cmExecutionStatus&)
-{
- this->SetError("An ENDFUNCTION command was found outside of a proper "
- "FUNCTION ENDFUNCTION structure. Or its arguments did not "
- "match the opening FUNCTION command.");
- return false;
-}
diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h
deleted file mode 100644
index 2599637..0000000
--- a/Source/cmEndFunctionCommand.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEndFunctionCommand_h
-#define cmEndFunctionCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-/** \class cmEndFunctionCommand
- * \brief ends an if block
- *
- * cmEndFunctionCommand ends an if block
- */
-class cmEndFunctionCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; }
-
- /**
- * Override cmCommand::InvokeInitialPass to get arguments before
- * expansion.
- */
- bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
- cmExecutionStatus&) CM_OVERRIDE;
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) CM_OVERRIDE
- {
- return false;
- }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "endfunction"; }
-};
-
-#endif
diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx
deleted file mode 100644
index 50c2b42..0000000
--- a/Source/cmEndIfCommand.cxx
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmEndIfCommand.h"
-
-#include <stdlib.h> // required for atof
-
-#include "cmMakefile.h"
-
-class cmExecutionStatus;
-
-bool cmEndIfCommand::InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&)
-{
- const char* versionValue =
- this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
- if (!versionValue || (atof(versionValue) <= 1.4)) {
- return true;
- }
-
- this->SetError("An ENDIF command was found outside of a proper "
- "IF ENDIF structure. Or its arguments did not match "
- "the opening IF command.");
- return false;
-}
diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h
deleted file mode 100644
index dfd6049..0000000
--- a/Source/cmEndIfCommand.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEndIfCommand_h
-#define cmEndIfCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-
-/** \class cmEndIfCommand
- * \brief ends an if block
- *
- * cmEndIfCommand ends an if block
- */
-class cmEndIfCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmEndIfCommand; }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "endif"; }
-};
-
-#endif
diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx
deleted file mode 100644
index 046b0af..0000000
--- a/Source/cmEndMacroCommand.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmEndMacroCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-bool cmEndMacroCommand::InvokeInitialPass(
- std::vector<cmListFileArgument> const&, cmExecutionStatus&)
-{
- this->SetError("An ENDMACRO command was found outside of a proper "
- "MACRO ENDMACRO structure. Or its arguments did not "
- "match the opening MACRO command.");
- return false;
-}
diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h
deleted file mode 100644
index 3c462d4..0000000
--- a/Source/cmEndMacroCommand.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEndMacroCommand_h
-#define cmEndMacroCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-/** \class cmEndMacroCommand
- * \brief ends an if block
- *
- * cmEndMacroCommand ends an if block
- */
-class cmEndMacroCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; }
-
- /**
- * Override cmCommand::InvokeInitialPass to get arguments before
- * expansion.
- */
- bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
- cmExecutionStatus&) CM_OVERRIDE;
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) CM_OVERRIDE
- {
- return false;
- }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "endmacro"; }
-};
-
-#endif
diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx
deleted file mode 100644
index 5623f33..0000000
--- a/Source/cmEndWhileCommand.cxx
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmEndWhileCommand.h"
-
-#include "cmListFileCache.h"
-
-class cmExecutionStatus;
-
-bool cmEndWhileCommand::InvokeInitialPass(
- std::vector<cmListFileArgument> const& args, cmExecutionStatus&)
-{
- if (args.empty()) {
- this->SetError("An ENDWHILE command was found outside of a proper "
- "WHILE ENDWHILE structure.");
- } else {
- this->SetError("An ENDWHILE command was found outside of a proper "
- "WHILE ENDWHILE structure. Or its arguments did not "
- "match the opening WHILE command.");
- }
-
- return false;
-}
diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h
deleted file mode 100644
index d4e97b4..0000000
--- a/Source/cmEndWhileCommand.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
- file Copyright.txt or https://cmake.org/licensing for details. */
-#ifndef cmEndWhileCommand_h
-#define cmEndWhileCommand_h
-
-#include <cmConfigure.h>
-#include <string>
-#include <vector>
-
-#include "cmCommand.h"
-
-class cmExecutionStatus;
-struct cmListFileArgument;
-
-/** \class cmEndWhileCommand
- * \brief ends a while loop
- *
- * cmEndWhileCommand ends a while loop
- */
-class cmEndWhileCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; }
-
- /**
- * Override cmCommand::InvokeInitialPass to get arguments before
- * expansion.
- */
- bool InvokeInitialPass(std::vector<cmListFileArgument> const& args,
- cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const&,
- cmExecutionStatus&) CM_OVERRIDE
- {
- return false;
- }
-
- /**
- * This determines if the command is invoked when in script mode.
- */
- bool IsScriptable() const CM_OVERRIDE { return true; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "endwhile"; }
-};
-
-#endif
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index c2e37c1..2f6238b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2,15 +2,39 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFileCommand.h"
+#include <algorithm>
+#include <assert.h>
+#include <cm_kwiml.h>
+#include <cmsys/Directory.hxx>
+#include <cmsys/FStream.hxx>
+#include <cmsys/Glob.hxx>
+#include <cmsys/RegularExpression.hxx>
+#include <cmsys/String.hxx>
+#include <list>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+// include sys/stat.h after sys/types.h
+#include <sys/stat.h>
+
#include "cmAlgorithms.h"
+#include "cmCommandArgumentsHelper.h"
#include "cmCryptoHash.h"
-#include "cmCryptoHash.h"
+#include "cmFileLockPool.h"
#include "cmFileTimeComparison.h"
+#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmHexFileConverter.h"
#include "cmInstallType.h"
+#include "cmListFileCache.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
+#include "cmSystemTools.h"
#include "cmTimestamp.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -18,20 +42,7 @@
#include "cmFileLockResult.h"
#endif
-#undef GetCurrentDirectory
-#include <assert.h>
-#include <stdlib.h>
-
-#include <sys/types.h>
-// include sys/stat.h after sys/types.h
-#include <sys/stat.h>
-
-#include <cm_auto_ptr.hxx>
-#include <cmsys/Directory.hxx>
-#include <cmsys/Encoding.hxx>
-#include <cmsys/FStream.hxx>
-#include <cmsys/Glob.hxx>
-#include <cmsys/RegularExpression.hxx>
+class cmSystemToolsFileTime;
// Table of permissions flags.
#if defined(_WIN32) && !defined(__CYGWIN__)
diff --git a/Source/cmGhsMultiGpj.h b/Source/cmGhsMultiGpj.h
index 793d471..2c2b123 100644
--- a/Source/cmGhsMultiGpj.h
+++ b/Source/cmGhsMultiGpj.h
@@ -5,8 +5,6 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
-
class cmGeneratedFileStream;
class GhsMultiGpj
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 6bbfed5..286f375 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -2,14 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalGhsMultiGenerator.h"
+#include <cmsys/SystemTools.hxx>
+
+#include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGhsMultiTargetGenerator.h"
#include "cmLocalGhsMultiGenerator.h"
#include "cmMakefile.h"
#include "cmVersion.h"
-#include <cmAlgorithms.h>
-#include <cmsys/SystemTools.hxx>
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
const char* cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild";
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 2ce65cd..a1af6ff 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1,10 +1,9 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "windows.h" // this must be first to define GetCurrentDirectory
-
#include "cmGlobalVisualStudio10Generator.h"
#include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index acd2c2b..049e86e 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -3,6 +3,7 @@
#include "cmGlobalVisualStudio11Generator.h"
#include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
#include "cmVS11CLFlagTable.h"
diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h
index be78544..ae99408 100644
--- a/Source/cmGlobalVisualStudio11Generator.h
+++ b/Source/cmGlobalVisualStudio11Generator.h
@@ -3,7 +3,18 @@
#ifndef cmGlobalVisualStudio11Generator_h
#define cmGlobalVisualStudio11Generator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <set>
+#include <string>
+
#include "cmGlobalVisualStudio10Generator.h"
+#include "cmStateTypes.h"
+
+class cmGlobalGeneratorFactory;
+class cmMakefile;
+class cmake;
/** \class cmGlobalVisualStudio11Generator */
class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index c18ff9e..0a48ba6 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -3,6 +3,7 @@
#include "cmGlobalVisualStudio12Generator.h"
#include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
#include "cmVS12CLFlagTable.h"
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index cdda512..79efe52 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -3,8 +3,17 @@
#ifndef cmGlobalVisualStudio12Generator_h
#define cmGlobalVisualStudio12Generator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+
#include "cmGlobalVisualStudio11Generator.h"
+class cmGlobalGeneratorFactory;
+class cmMakefile;
+class cmake;
+
/** \class cmGlobalVisualStudio12Generator */
class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator
{
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index e0b86d7..b4cb823 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -3,6 +3,7 @@
#include "cmGlobalVisualStudio14Generator.h"
#include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
#include "cmVS140CLFlagTable.h"
diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h
index 991f018..ab22978 100644
--- a/Source/cmGlobalVisualStudio14Generator.h
+++ b/Source/cmGlobalVisualStudio14Generator.h
@@ -3,8 +3,17 @@
#ifndef cmGlobalVisualStudio14Generator_h
#define cmGlobalVisualStudio14Generator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+
#include "cmGlobalVisualStudio12Generator.h"
+class cmGlobalGeneratorFactory;
+class cmMakefile;
+class cmake;
+
/** \class cmGlobalVisualStudio14Generator */
class cmGlobalVisualStudio14Generator : public cmGlobalVisualStudio12Generator
{
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index fbc7a10..091a03e 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -3,20 +3,24 @@
#include "cmGlobalVisualStudio15Generator.h"
#include "cmAlgorithms.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
#include "cmVS141CLFlagTable.h"
-static const char vs15generatorName[] = "Visual Studio 15";
+static const char vs15generatorName[] = "Visual Studio 15 2017";
// Map generator name without year to name with year.
static const char* cmVS15GenName(const std::string& name, std::string& genName)
{
if (strncmp(name.c_str(), vs15generatorName,
- sizeof(vs15generatorName) - 1) != 0) {
+ sizeof(vs15generatorName) - 6) != 0) {
return 0;
}
- const char* p = name.c_str() + sizeof(vs15generatorName) - 1;
+ const char* p = name.c_str() + sizeof(vs15generatorName) - 6;
+ if (cmHasLiteralPrefix(p, " 2017")) {
+ p += 5;
+ }
genName = std::string(vs15generatorName) + p;
return p;
}
@@ -51,7 +55,7 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const
{
entry.Name = std::string(vs15generatorName) + " [arch]";
- entry.Brief = "Generates Visual Studio 15 project files. "
+ entry.Brief = "Generates Visual Studio 2017 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\".";
}
diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h
index 2e458f4..59eb11a 100644
--- a/Source/cmGlobalVisualStudio15Generator.h
+++ b/Source/cmGlobalVisualStudio15Generator.h
@@ -3,8 +3,16 @@
#ifndef cmGlobalVisualStudio15Generator_h
#define cmGlobalVisualStudio15Generator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+
#include "cmGlobalVisualStudio14Generator.h"
+class cmGlobalGeneratorFactory;
+class cmake;
+
/** \class cmGlobalVisualStudio15Generator */
class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator
{
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 8af0512..55a788f 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -1,9 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "windows.h" // this must be first to define GetCurrentDirectory
-
#include "cmGlobalVisualStudio71Generator.h"
+#include "cmDocumentationEntry.h"
#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index c60a1ff..602666e 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -681,20 +681,27 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
// default build if another target depends on it
int type = target->GetType();
if (type == cmStateEnums::GLOBAL_TARGET) {
- // check if INSTALL target is part of default build
- if (target->GetName() == "INSTALL") {
- // inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties
- for (std::vector<std::string>::const_iterator i = configs.begin();
- i != configs.end(); ++i) {
- const char* propertyValue =
- target->Target->GetMakefile()->GetDefinition(
- "CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD");
- cmGeneratorExpression ge;
- CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
- ge.Parse(propertyValue);
- if (cmSystemTools::IsOn(
- cge->Evaluate(target->GetLocalGenerator(), *i))) {
- activeConfigs.insert(*i);
+ std::list<std::string> targetNames;
+ targetNames.push_back("INSTALL");
+ targetNames.push_back("PACKAGE");
+ for (std::list<std::string>::const_iterator t = targetNames.begin();
+ t != targetNames.end(); ++t) {
+ // check if target <*t> is part of default build
+ if (target->GetName() == *t) {
+ const std::string propertyName =
+ "CMAKE_VS_INCLUDE_" + *t + "_TO_DEFAULT_BUILD";
+ // inspect CMAKE_VS_INCLUDE_<*t>_TO_DEFAULT_BUILD properties
+ for (std::vector<std::string>::const_iterator i = configs.begin();
+ i != configs.end(); ++i) {
+ const char* propertyValue =
+ target->Target->GetMakefile()->GetDefinition(propertyName);
+ cmGeneratorExpression ge;
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
+ ge.Parse(propertyValue);
+ if (cmSystemTools::IsOn(
+ cge->Evaluate(target->GetLocalGenerator(), *i))) {
+ activeConfigs.insert(*i);
+ }
}
}
}
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index cf37c2c..e961a3d 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -1,9 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "windows.h" // this must be first to define GetCurrentDirectory
-
#include "cmGlobalVisualStudio8Generator.h"
+#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmLocalVisualStudio7Generator.h"
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index 32ba849..b1634e2 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -1,9 +1,8 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "windows.h" // this must be first to define GetCurrentDirectory
-
#include "cmGlobalVisualStudio9Generator.h"
+#include "cmDocumentationEntry.h"
#include "cmLocalVisualStudio7Generator.h"
#include "cmMakefile.h"
#include "cmVisualStudioWCEPlatformParser.h"
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 354ada9..5edb81f 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -3,6 +3,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudioGenerator.h"
+#include <cmsys/Encoding.hxx>
+#include <iostream>
+
#include "cmAlgorithms.h"
#include "cmCallVisualStudioMacro.h"
#include "cmGeneratedFileStream.h"
@@ -12,7 +15,6 @@
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmTarget.h"
-#include <cmsys/Encoding.hxx>
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
: cmGlobalGenerator(cm)
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 0e88bce..f32f0bb 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -3,7 +3,22 @@
#ifndef cmGlobalVisualStudioGenerator_h
#define cmGlobalVisualStudioGenerator_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
#include "cmGlobalGenerator.h"
+#include "cmTargetDepend.h"
+
+class cmCustomCommand;
+class cmGeneratorTarget;
+class cmLocalGenerator;
+class cmMakefile;
+class cmake;
/** \class cmGlobalVisualStudioGenerator
* \brief Base class for global Visual Studio generators.
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 84a8c5e..50197c9 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2,20 +2,35 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalXCodeGenerator.h"
-#include "cmAlgorithms.h"
+#include <assert.h>
+#include <cmsys/RegularExpression.hxx>
+#include <iomanip>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
+
#include "cmComputeLinkInformation.h"
#include "cmCustomCommandGenerator.h"
+#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGeneratorFactory.h"
+#include "cmLocalGenerator.h"
#include "cmLocalXCodeGenerator.h"
#include "cmMakefile.h"
+#include "cmOutputConverter.h"
#include "cmSourceFile.h"
+#include "cmSourceGroup.h"
+#include "cmStateTypes.h"
+#include "cmSystemTools.h"
+#include "cmTarget.h"
#include "cmXCode21Object.h"
#include "cmXCodeObject.h"
+#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cm_auto_ptr.hxx>
+struct cmLinkImplementation;
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmXMLParser.h"
@@ -1925,40 +1940,24 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
+ std::vector<std::string> includes;
+ this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C",
+ configName);
std::set<std::string> emitted;
emitted.insert("/System/Library/Frameworks");
- if (this->XcodeVersion < 60) {
- std::vector<std::string> includes;
- this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C",
- configName);
- for (std::vector<std::string>::iterator i = includes.begin();
- i != includes.end(); ++i) {
- if (this->NameResolvesToFramework(*i)) {
- std::string frameworkDir = *i;
- frameworkDir += "/../";
- frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
- if (emitted.insert(frameworkDir).second) {
- fdirs.Add(this->XCodeEscapePath(frameworkDir));
- }
- } else {
- std::string incpath = this->XCodeEscapePath(*i);
- dirs.Add(incpath);
- }
- }
- } else {
- for (std::set<std::string>::iterator li = languages.begin();
- li != languages.end(); ++li) {
- std::vector<std::string> includes;
- this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, *li,
- configName);
- std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
- includes, gtgt, *li, true, false, configName);
-
- std::string& flags = cflags[*li];
- if (!includeFlags.empty()) {
- flags += " " + includeFlags;
+ for (std::vector<std::string>::iterator i = includes.begin();
+ i != includes.end(); ++i) {
+ if (this->NameResolvesToFramework(*i)) {
+ std::string frameworkDir = *i;
+ frameworkDir += "/../";
+ frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
+ if (emitted.insert(frameworkDir).second) {
+ fdirs.Add(this->XCodeEscapePath(frameworkDir));
}
+ } else {
+ std::string incpath = this->XCodeEscapePath(*i);
+ dirs.Add(incpath);
}
}
// Add framework search paths needed for linking.
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 98625d1..42c39aa 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -3,13 +3,25 @@
#ifndef cmGlobalXCodeGenerator_h
#define cmGlobalXCodeGenerator_h
-#include "cmGlobalGenerator.h"
+#include <cmConfigure.h>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
-#include "cmCustomCommand.h"
+#include "cmGlobalGenerator.h"
#include "cmXCodeObject.h"
+
+class cmCustomCommand;
+class cmGeneratorTarget;
class cmGlobalGeneratorFactory;
+class cmLocalGenerator;
+class cmMakefile;
class cmSourceFile;
class cmSourceGroup;
+class cmake;
+struct cmDocumentationEntry;
/** \class cmGlobalXCodeGenerator
* \brief Write a Unix makefiles.
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 286076f..c6c0e05 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -2,9 +2,12 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIDEOptions.h"
-#include "cmSystemTools.h"
-
#include <cmsys/String.h>
+#include <iterator>
+#include <string.h>
+
+#include "cmIDEFlagTable.h"
+#include "cmSystemTools.h"
cmIDEOptions::cmIDEOptions()
{
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index 1067c40..a0696e1 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -5,9 +5,11 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <map>
+#include <string>
+#include <vector>
-#include "cmIDEFlagTable.h"
+struct cmIDEFlagTable;
/** \class cmIDEOptions
* \brief Superclass for IDE option processing
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index 97a5d1b..bb13717 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -33,10 +33,10 @@ public:
std::string ComputeFrameworkPath(cmComputeLinkInformation& cli,
std::string const& fwSearchFlag);
- std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
- std::string const& stdLibString);
+ virtual std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
+ std::string const& stdLibString);
-private:
+protected:
std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
std::string ComputeRPath(cmComputeLinkInformation& cli);
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
new file mode 100644
index 0000000..75e5ef5
--- /dev/null
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -0,0 +1,74 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#include "cmLinkLineDeviceComputer.h"
+#include "cmComputeLinkInformation.h"
+#include "cmGeneratorTarget.h"
+#include "cmGlobalNinjaGenerator.h"
+#include "cmOutputConverter.h"
+
+cmLinkLineDeviceComputer::cmLinkLineDeviceComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir)
+ : cmLinkLineComputer(outputConverter, stateDir)
+{
+}
+
+cmLinkLineDeviceComputer::~cmLinkLineDeviceComputer()
+{
+}
+
+std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
+ cmComputeLinkInformation& cli, std::string const& stdLibString)
+{
+ // Write the library flags to the build rule.
+ std::ostringstream fout;
+ typedef cmComputeLinkInformation::ItemVector ItemVector;
+ ItemVector const& items = cli.GetItems();
+ std::string config = cli.GetConfig();
+ for (ItemVector::const_iterator li = items.begin(); li != items.end();
+ ++li) {
+ if (!li->Target) {
+ continue;
+ }
+
+ if (li->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
+ li->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ li->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
+ continue;
+ }
+
+ std::set<std::string> langs;
+ li->Target->GetLanguages(langs, config);
+ if (langs.count("CUDA") == 0) {
+ continue;
+ }
+
+ if (li->IsPath) {
+ fout << this->ConvertToOutputFormat(
+ this->ConvertToLinkReference(li->Value));
+ } else {
+ fout << li->Value;
+ }
+ fout << " ";
+ }
+
+ if (!stdLibString.empty()) {
+ fout << stdLibString << " ";
+ }
+
+ return fout.str();
+}
+
+cmNinjaLinkLineDeviceComputer::cmNinjaLinkLineDeviceComputer(
+ cmOutputConverter* outputConverter, cmStateDirectory stateDir,
+ cmGlobalNinjaGenerator const* gg)
+ : cmLinkLineDeviceComputer(outputConverter, stateDir)
+ , GG(gg)
+{
+}
+
+std::string cmNinjaLinkLineDeviceComputer::ConvertToLinkReference(
+ std::string const& lib) const
+{
+ return GG->ConvertToNinjaPath(lib);
+}
diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h
new file mode 100644
index 0000000..d1079d7
--- /dev/null
+++ b/Source/cmLinkLineDeviceComputer.h
@@ -0,0 +1,36 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+
+#ifndef cmLinkLineDeviceComputer_h
+#define cmLinkLineDeviceComputer_h
+
+#include "cmLinkLineComputer.h"
+class cmGlobalNinjaGenerator;
+
+class cmLinkLineDeviceComputer : public cmLinkLineComputer
+{
+public:
+ cmLinkLineDeviceComputer(cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir);
+ ~cmLinkLineDeviceComputer() CM_OVERRIDE;
+
+ std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
+ std::string const& stdLibString)
+ CM_OVERRIDE;
+};
+
+class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
+{
+public:
+ cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter,
+ cmStateDirectory stateDir,
+ cmGlobalNinjaGenerator const* gg);
+
+ std::string ConvertToLinkReference(std::string const& input) const
+ CM_OVERRIDE;
+
+private:
+ cmGlobalNinjaGenerator const* GG;
+};
+
+#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1fda4e9..46e49dc 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -63,6 +63,8 @@ static const char* ruleReplaceVars[] = {
"CMAKE_CURRENT_BINARY_DIR",
"CMAKE_RANLIB",
"CMAKE_LINKER",
+ "CMAKE_CUDA_HOST_COMPILER",
+ "CMAKE_CUDA_HOST_LINK_LAUNCHER",
"CMAKE_CL_SHOWINCLUDES_PREFIX"
};
@@ -1475,6 +1477,9 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
langStdMap["C"].push_back("11");
langStdMap["C"].push_back("99");
langStdMap["C"].push_back("90");
+
+ langStdMap["CUDA"].push_back("11");
+ langStdMap["CUDA"].push_back("98");
}
std::string standard(standardProp);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8bb084a..ba17f81 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -285,8 +285,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
for (std::vector<LocalObjectEntry>::const_iterator ei = lo->second.begin();
ei != lo->second.end(); ++ei) {
if (ei->Language == "C" || ei->Language == "CXX" ||
- ei->Language == "Fortran") {
- // Right now, C, C++ and Fortran have both a preprocessor and the
+ ei->Language == "CUDA" || ei->Language == "Fortran") {
+ // Right now, C, C++, Fortran and CUDA have both a preprocessor and the
// ability to generate assembly code
lang_has_preprocessor = true;
lang_has_assembly = true;
@@ -1458,7 +1458,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
// Create the scanner for this language
cmDepends* scanner = CM_NULLPTR;
- if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM") {
+ if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM" ||
+ lang == "CUDA") {
// TODO: Handle RC (resource files) dependencies correctly.
scanner = new cmDependsC(this, targetDir, lang, &validDeps);
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 4becfee..1ed57ec 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -3,8 +3,15 @@
#ifndef cmLocalVisualStudio10Generator_h
#define cmLocalVisualStudio10Generator_h
+#include <cmConfigure.h>
+
+#include <string>
+
#include "cmLocalVisualStudio7Generator.h"
+class cmGlobalGenerator;
+class cmMakefile;
+
/** \class cmLocalVisualStudio10Generator
* \brief Write Visual Studio 10 project files.
*
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 6665bb0..d69cce1 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -3,17 +3,23 @@
#ifndef cmLocalVisualStudio7Generator_h
#define cmLocalVisualStudio7Generator_h
-#include "cmLocalVisualStudioGenerator.h"
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+#include "cmLocalVisualStudioGenerator.h"
#include "cmVisualStudioGeneratorOptions.h"
-class cmSourceFile;
class cmCustomCommand;
-class cmSourceGroup;
-
-class cmLocalVisualStudio7GeneratorOptions;
+class cmGeneratorTarget;
+class cmGlobalGenerator;
class cmLocalVisualStudio7GeneratorFCInfo;
class cmLocalVisualStudio7GeneratorInternals;
+class cmMakefile;
+class cmSourceFile;
+class cmSourceGroup;
/** \class cmLocalVisualStudio7Generator
* \brief Write Visual Studio .NET project files.
@@ -119,6 +125,7 @@ private:
friend class cmLocalVisualStudio7GeneratorInternals;
class EventWriter;
+
friend class EventWriter;
std::string ModuleDefinitionFile;
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 169ecaf..39188f9 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -3,16 +3,22 @@
#ifndef cmLocalVisualStudioGenerator_h
#define cmLocalVisualStudioGenerator_h
-#include "cmLocalGenerator.h"
+#include <cmConfigure.h>
-#include "cmGlobalVisualStudioGenerator.h"
+#include <map>
+#include <memory>
+#include <string>
-#include <cm_auto_ptr.hxx>
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cm_auto_ptr.hxx"
-class cmSourceFile;
-class cmSourceGroup;
class cmCustomCommand;
class cmCustomCommandGenerator;
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmMakefile;
+class cmSourceFile;
/** \class cmLocalVisualStudioGenerator
* \brief Base class for Visual Studio generators.
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index b596a8f..739ef43 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -4,9 +4,12 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalXCodeGenerator.h"
-#include "cmMakefile.h"
#include "cmSourceFile.h"
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmMakefile;
+
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
cmMakefile* mf)
: cmLocalGenerator(gg, mf)
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 3756b61..b4a8c6c 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -3,8 +3,17 @@
#ifndef cmLocalXCodeGenerator_h
#define cmLocalXCodeGenerator_h
+#include <cmConfigure.h> // IWYU pragma: keep
+#include <map>
+#include <string>
+
#include "cmLocalGenerator.h"
+class cmGeneratorTarget;
+class cmGlobalGenerator;
+class cmMakefile;
+class cmSourceFile;
+
/** \class cmLocalXCodeGenerator
* \brief Write a local Xcode project
*
diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx
index 95518f9..586e6c6 100644
--- a/Source/cmMachO.cxx
+++ b/Source/cmMachO.cxx
@@ -1,10 +1,12 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmStandardIncludes.h" // to get CMAKE_USE_MACH_PARSER first
-
#include "cmMachO.h"
+#include <algorithm>
#include <cmsys/FStream.hxx>
+#include <stddef.h>
+#include <string>
+#include <vector>
// Include the Mach-O format information system header.
#include <mach-o/fat.h>
diff --git a/Source/cmMachO.h b/Source/cmMachO.h
index a754c1f..901f17a 100644
--- a/Source/cmMachO.h
+++ b/Source/cmMachO.h
@@ -3,6 +3,11 @@
#ifndef cmMachO_h
#define cmMachO_h
+#include <cmConfigure.h>
+
+#include <iosfwd>
+#include <string>
+
#if !defined(CMAKE_USE_MACH_PARSER)
#error "This file may be included only if CMAKE_USE_MACH_PARSER is enabled."
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 90182f9..fecc983 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4413,10 +4413,13 @@ bool cmMakefile::AddRequiredTargetCxxFeature(cmTarget* target,
if (setCxx14) {
target->SetProperty("CXX_STANDARD", "14");
+ target->SetProperty("CUDA_STANDARD", "14");
} else if (setCxx11) {
target->SetProperty("CXX_STANDARD", "11");
+ target->SetProperty("CUDA_STANDARD", "11");
} else if (setCxx98) {
target->SetProperty("CXX_STANDARD", "98");
+ target->SetProperty("CUDA_STANDARD", "98");
}
return true;
}
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 358804e..069011d 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -10,6 +10,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLinkLineComputer.h"
+#include "cmLinkLineDeviceComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
@@ -56,6 +57,9 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
// write in rules for object files and custom commands
this->WriteTargetBuildRules();
+ // write the device link rules
+ this->WriteDeviceExecutableRule(false);
+
// write the link rules
this->WriteExecutableRule(false);
if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) {
@@ -77,6 +81,218 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
this->CloseFileStreams();
}
+void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
+ bool relink)
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ const std::string cuda_lang("CUDA");
+ cmGeneratorTarget::LinkClosure const* closure =
+ this->GeneratorTarget->GetLinkClosure(this->ConfigName);
+
+ const bool hasCUDA =
+ (std::find(closure->Languages.begin(), closure->Languages.end(),
+ cuda_lang) != closure->Languages.end());
+ if (!hasCUDA) {
+ return;
+ }
+
+ std::vector<std::string> commands;
+
+ // Build list of dependencies.
+ std::vector<std::string> depends;
+ this->AppendLinkDepends(depends);
+
+ // Get the language to use for linking this library.
+ std::string linkLanguage = "CUDA";
+
+ // Get the name of the device object to generate.
+ std::string const targetOutputReal =
+ this->GeneratorTarget->ObjectDirectory + "cmake_device_link.o";
+ this->DeviceLinkObject = targetOutputReal;
+
+ this->NumberOfProgressActions++;
+ if (!this->NoRuleMessages) {
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
+ // Add the link message.
+ std::string buildEcho = "Linking ";
+ buildEcho += linkLanguage;
+ buildEcho += " device code ";
+ buildEcho += targetOutputReal;
+ this->LocalGenerator->AppendEcho(
+ commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
+ }
+
+ // Build a list of compiler flags and linker flags.
+ std::string flags;
+ std::string linkFlags;
+
+ // Add flags to create an executable.
+ // Add symbol export flags if necessary.
+ if (this->GeneratorTarget->IsExecutableWithExports()) {
+ std::string export_flag_var = "CMAKE_EXE_EXPORTS_";
+ export_flag_var += linkLanguage;
+ export_flag_var += "_FLAG";
+ this->LocalGenerator->AppendFlags(
+ linkFlags, this->Makefile->GetDefinition(export_flag_var));
+ }
+
+ this->LocalGenerator->AppendFlags(linkFlags,
+ this->LocalGenerator->GetLinkLibsCMP0065(
+ linkLanguage, *this->GeneratorTarget));
+
+ // Add language feature flags.
+ this->AddFeatureFlags(flags, linkLanguage);
+
+ this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
+ linkLanguage, this->ConfigName);
+
+ // Add target-specific linker flags.
+ this->LocalGenerator->AppendFlags(
+ linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
+ std::string linkFlagsConfig = "LINK_FLAGS_";
+ linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
+ this->LocalGenerator->AppendFlags(
+ linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
+
+ {
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ this->CreateLinkLineComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
+ }
+
+ // Construct a list of files associated with this executable that
+ // may need to be cleaned.
+ std::vector<std::string> exeCleanFiles;
+ exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal));
+
+ // Determine whether a link script will be used.
+ bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
+
+ // Construct the main link rule.
+ std::vector<std::string> real_link_commands;
+ const std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE";
+ const std::string linkRule = this->GetLinkRule(linkRuleVar);
+ std::vector<std::string> commands1;
+ cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+
+ bool useResponseFileForObjects =
+ this->CheckUseResponseFileForObjects(linkLanguage);
+ bool const useResponseFileForLibs =
+ this->CheckUseResponseFileForLibraries(linkLanguage);
+
+ // Expand the rule variables.
+ {
+ bool useWatcomQuote =
+ this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE");
+
+ // Set path conversion for link script shells.
+ this->LocalGenerator->SetLinkScriptShell(useLinkScript);
+
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ new cmLinkLineDeviceComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetForResponse(useResponseFileForLibs);
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+ linkLineComputer->SetRelink(relink);
+
+ // Collect up flags to link in needed libraries.
+ std::string linkLibs;
+ this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
+ useResponseFileForLibs, depends);
+
+ // Construct object file lists that may be needed to expand the
+ // rule.
+ std::string buildObjs;
+ this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects,
+ buildObjs, depends, useWatcomQuote);
+
+ cmRulePlaceholderExpander::RuleVariables vars;
+ std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
+
+ objectDir = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
+ cmOutputConverter::SHELL);
+
+ cmOutputConverter::OutputFormat output = (useWatcomQuote)
+ ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL;
+ std::string target = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal),
+ output);
+
+ vars.Language = linkLanguage.c_str();
+ vars.Objects = buildObjs.c_str();
+ vars.ObjectDir = objectDir.c_str();
+ vars.Target = target.c_str();
+ vars.LinkLibraries = linkLibs.c_str();
+ vars.Flags = flags.c_str();
+ vars.LinkFlags = linkFlags.c_str();
+
+ std::string launcher;
+
+ const char* val = this->LocalGenerator->GetRuleLauncher(
+ this->GeneratorTarget, "RULE_LAUNCH_LINK");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->LocalGenerator->CreateRulePlaceholderExpander());
+
+ // Expand placeholders in the commands.
+ rulePlaceholderExpander->SetTargetImpLib(targetOutputReal);
+ for (std::vector<std::string>::iterator i = real_link_commands.begin();
+ i != real_link_commands.end(); ++i) {
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i,
+ vars);
+ }
+
+ // Restore path conversion to normal shells.
+ this->LocalGenerator->SetLinkScriptShell(false);
+ }
+
+ // Optionally convert the build rule to use a script to avoid long
+ // command lines in the make shell.
+ if (useLinkScript) {
+ // Use a link script.
+ const char* name = (relink ? "drelink.txt" : "dlink.txt");
+ this->CreateLinkScript(name, real_link_commands, commands1, depends);
+ } else {
+ // No link script. Just use the link rule directly.
+ commands1 = real_link_commands;
+ }
+ this->LocalGenerator->CreateCDCommand(
+ commands1, this->Makefile->GetCurrentBinaryDirectory(),
+ this->LocalGenerator->GetBinaryDirectory());
+ commands.insert(commands.end(), commands1.begin(), commands1.end());
+ commands1.clear();
+
+ // Write the build rule.
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
+ targetOutputReal, depends, commands,
+ false);
+
+ // Write the main driver rule to build everything in this target.
+ this->WriteTargetDriverRule(targetOutputReal, relink);
+
+ // Clean all the possible executable names and symlinks.
+ this->CleanFiles.insert(this->CleanFiles.end(), exeCleanFiles.begin(),
+ exeCleanFiles.end());
+#else
+ static_cast<void>(relink);
+#endif
+}
+
void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{
std::vector<std::string> commands;
@@ -84,6 +300,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Build list of dependencies.
std::vector<std::string> depends;
this->AppendLinkDepends(depends);
+ if (!this->DeviceLinkObject.empty()) {
+ depends.push_back(this->DeviceLinkObject);
+ }
// Get the name of the executable to generate.
std::string targetName;
@@ -327,6 +546,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string buildObjs;
this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects,
buildObjs, depends, useWatcomQuote);
+ if (!this->DeviceLinkObject.empty()) {
+ buildObjs += " " +
+ this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ this->DeviceLinkObject),
+ cmOutputConverter::SHELL);
+ }
// maybe create .def file from list of objects
if (this->GeneratorTarget->IsExecutableWithExports() &&
diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h
index 36cfe40..642182b 100644
--- a/Source/cmMakefileExecutableTargetGenerator.h
+++ b/Source/cmMakefileExecutableTargetGenerator.h
@@ -21,6 +21,10 @@ public:
protected:
virtual void WriteExecutableRule(bool relink);
+ virtual void WriteDeviceExecutableRule(bool relink);
+
+private:
+ std::string DeviceLinkObject;
};
#endif
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index c591bb3..2b0e1b1 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -11,6 +11,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLinkLineComputer.h"
+#include "cmLinkLineDeviceComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
@@ -151,6 +152,24 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->WriteFrameworkRules(relink);
return;
}
+
+ if (!relink) {
+ const std::string cuda_lang("CUDA");
+ cmGeneratorTarget::LinkClosure const* closure =
+ this->GeneratorTarget->GetLinkClosure(this->ConfigName);
+
+ const bool hasCUDA =
+ (std::find(closure->Languages.begin(), closure->Languages.end(),
+ cuda_lang) != closure->Languages.end());
+ if (hasCUDA) {
+ std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
+ std::string extraFlags;
+ this->LocalGenerator->AppendFlags(
+ extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
+ this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink);
+ }
+ }
+
std::string linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
@@ -183,6 +202,24 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{
+
+ if (!relink) {
+ const std::string cuda_lang("CUDA");
+ cmGeneratorTarget::LinkClosure const* closure =
+ this->GeneratorTarget->GetLinkClosure(this->ConfigName);
+
+ const bool hasCUDA =
+ (std::find(closure->Languages.begin(), closure->Languages.end(),
+ cuda_lang) != closure->Languages.end());
+ if (hasCUDA) {
+ std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
+ std::string extraFlags;
+ this->LocalGenerator->AppendFlags(
+ extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
+ this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink);
+ }
+ }
+
std::string linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
@@ -230,6 +267,180 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
+void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
+ const std::string& linkRuleVar, const std::string& extraFlags, bool relink)
+{
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ // TODO: Merge the methods that call this method to avoid
+ // code duplication.
+ std::vector<std::string> commands;
+
+ // Build list of dependencies.
+ std::vector<std::string> depends;
+ this->AppendLinkDepends(depends);
+
+ // Get the language to use for linking this library.
+ std::string linkLanguage = "CUDA";
+
+ // Create set of linking flags.
+ std::string linkFlags;
+ this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
+
+ // Get the name of the device object to generate.
+ std::string const targetOutputReal =
+ this->GeneratorTarget->ObjectDirectory + "cmake_device_link.o";
+ this->DeviceLinkObject = targetOutputReal;
+
+ this->NumberOfProgressActions++;
+ if (!this->NoRuleMessages) {
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
+ // Add the link message.
+ std::string buildEcho = "Linking " + linkLanguage + " device code";
+ buildEcho += targetOutputReal;
+ this->LocalGenerator->AppendEcho(
+ commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
+ }
+ // Clean files associated with this library.
+ std::vector<std::string> libCleanFiles;
+ libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal));
+
+ // Determine whether a link script will be used.
+ bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
+
+ bool useResponseFileForObjects =
+ this->CheckUseResponseFileForObjects(linkLanguage);
+ bool const useResponseFileForLibs =
+ this->CheckUseResponseFileForLibraries(linkLanguage);
+
+ cmRulePlaceholderExpander::RuleVariables vars;
+ vars.Language = linkLanguage.c_str();
+
+ // Expand the rule variables.
+ std::vector<std::string> real_link_commands;
+ {
+ bool useWatcomQuote =
+ this->Makefile->IsOn(linkRuleVar + "_USE_WATCOM_QUOTE");
+
+ // Set path conversion for link script shells.
+ this->LocalGenerator->SetLinkScriptShell(useLinkScript);
+
+ // Collect up flags to link in needed libraries.
+ std::string linkLibs;
+ if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
+
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ new cmLinkLineDeviceComputer(
+ this->LocalGenerator,
+ this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetForResponse(useResponseFileForLibs);
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+ linkLineComputer->SetRelink(relink);
+
+ this->CreateLinkLibs(linkLineComputer.get(), linkLibs,
+ useResponseFileForLibs, depends);
+ }
+
+ // Construct object file lists that may be needed to expand the
+ // rule.
+ std::string buildObjs;
+ this->CreateObjectLists(useLinkScript, false, // useArchiveRules
+ useResponseFileForObjects, buildObjs, depends,
+ useWatcomQuote);
+
+ cmOutputConverter::OutputFormat output = (useWatcomQuote)
+ ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL;
+
+ std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
+ objectDir = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), objectDir),
+ cmOutputConverter::SHELL);
+
+ std::string target = this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal),
+ output);
+
+ vars.Objects = buildObjs.c_str();
+ vars.ObjectDir = objectDir.c_str();
+ vars.Target = target.c_str();
+ vars.LinkLibraries = linkLibs.c_str();
+ vars.ObjectsQuoted = buildObjs.c_str();
+ vars.LinkFlags = linkFlags.c_str();
+
+ // Add language feature flags.
+ std::string langFlags;
+ this->AddFeatureFlags(langFlags, linkLanguage);
+
+ vars.LanguageCompileFlags = langFlags.c_str();
+
+ std::string launcher;
+ const char* val = this->LocalGenerator->GetRuleLauncher(
+ this->GeneratorTarget, "RULE_LAUNCH_LINK");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->LocalGenerator->CreateRulePlaceholderExpander());
+
+ // Construct the main link rule and expand placeholders.
+ rulePlaceholderExpander->SetTargetImpLib(targetOutputReal);
+ std::string linkRule = this->GetLinkRule(linkRuleVar);
+ cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+
+ // Expand placeholders.
+ for (std::vector<std::string>::iterator i = real_link_commands.begin();
+ i != real_link_commands.end(); ++i) {
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i,
+ vars);
+ }
+ // Restore path conversion to normal shells.
+ this->LocalGenerator->SetLinkScriptShell(false);
+
+ // Clean all the possible library names and symlinks.
+ this->CleanFiles.insert(this->CleanFiles.end(), libCleanFiles.begin(),
+ libCleanFiles.end());
+ }
+
+ std::vector<std::string> commands1;
+ // Optionally convert the build rule to use a script to avoid long
+ // command lines in the make shell.
+ if (useLinkScript) {
+ // Use a link script.
+ const char* name = (relink ? "drelink.txt" : "dlink.txt");
+ this->CreateLinkScript(name, real_link_commands, commands1, depends);
+ } else {
+ // No link script. Just use the link rule directly.
+ commands1 = real_link_commands;
+ }
+ this->LocalGenerator->CreateCDCommand(
+ commands1, this->Makefile->GetCurrentBinaryDirectory(),
+ this->LocalGenerator->GetBinaryDirectory());
+ commands.insert(commands.end(), commands1.begin(), commands1.end());
+ commands1.clear();
+
+ // Compute the list of outputs.
+ std::vector<std::string> outputs(1, targetOutputReal);
+
+ // Write the build rule.
+ this->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR, outputs, depends,
+ commands, false);
+
+ // Write the main driver rule to build everything in this target.
+ this->WriteTargetDriverRule(targetOutputReal, relink);
+#else
+ static_cast<void>(linkRuleVar);
+ static_cast<void>(extraFlags);
+ static_cast<void>(relink);
+#endif
+}
+
void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
const std::string& linkRuleVar, const std::string& extraFlags, bool relink)
{
@@ -240,6 +451,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Build list of dependencies.
std::vector<std::string> depends;
this->AppendLinkDepends(depends);
+ if (!this->DeviceLinkObject.empty()) {
+ depends.push_back(this->DeviceLinkObject);
+ }
// Get the language to use for linking this library.
std::string linkLanguage =
@@ -518,6 +732,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
this->CreateObjectLists(useLinkScript, useArchiveRules,
useResponseFileForObjects, buildObjs, depends,
useWatcomQuote);
+ if (!this->DeviceLinkObject.empty()) {
+ buildObjs += " " +
+ this->LocalGenerator->ConvertToOutputFormat(
+ this->LocalGenerator->MaybeConvertToRelativePath(
+ this->LocalGenerator->GetCurrentBinaryDirectory(),
+ this->DeviceLinkObject),
+ cmOutputConverter::SHELL);
+ }
// maybe create .def file from list of objects
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY &&
diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h
index dda41b8..93ce902 100644
--- a/Source/cmMakefileLibraryTargetGenerator.h
+++ b/Source/cmMakefileLibraryTargetGenerator.h
@@ -26,6 +26,9 @@ protected:
void WriteStaticLibraryRules();
void WriteSharedLibraryRules(bool relink);
void WriteModuleLibraryRules(bool relink);
+
+ void WriteDeviceLibraryRules(const std::string& linkRule,
+ const std::string& extraFlags, bool relink);
void WriteLibraryRules(const std::string& linkRule,
const std::string& extraFlags, bool relink);
// MacOSX Framework support methods
@@ -33,6 +36,9 @@ protected:
// Store the computd framework version for OS X Frameworks.
std::string FrameworkVersion;
+
+private:
+ std::string DeviceLinkObject;
};
#endif
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5bec2bb..2e5173d 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -583,11 +583,11 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::string const includesString = "$(" + lang + "_INCLUDES)";
vars.Includes = includesString.c_str();
- // At the moment, it is assumed that C, C++, and Fortran have both
+ // At the moment, it is assumed that C, C++, Fortran, and CUDA have both
// assembly and preprocessor capabilities. The same is true for the
// ability to export compile commands
- bool lang_has_preprocessor =
- ((lang == "C") || (lang == "CXX") || (lang == "Fortran"));
+ bool lang_has_preprocessor = ((lang == "C") || (lang == "CXX") ||
+ (lang == "Fortran") || (lang == "CUDA"));
bool const lang_has_assembly = lang_has_preprocessor;
bool const lang_can_export_cmds = lang_has_preprocessor;
@@ -596,13 +596,22 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
// Construct the compile rules.
{
- std::string compileRuleVar = "CMAKE_";
- compileRuleVar += lang;
- compileRuleVar += "_COMPILE_OBJECT";
- std::string compileRule =
- this->Makefile->GetRequiredDefinition(compileRuleVar);
std::vector<std::string> compileCommands;
- cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+ if (lang == "CUDA") {
+ std::string cmdVar;
+ if (this->GeneratorTarget->GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
+ } else {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");
+ }
+ std::string compileRule = this->Makefile->GetRequiredDefinition(cmdVar);
+ cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+ } else {
+ const std::string cmdVar =
+ std::string("CMAKE_") + lang + "_COMPILE_OBJECT";
+ std::string compileRule = this->Makefile->GetRequiredDefinition(cmdVar);
+ cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+ }
if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") &&
lang_can_export_cmds && compileCommands.size() == 1) {
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 3598914..6c5b2b2 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -18,6 +18,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
#include "cmLinkLineComputer.h"
+#include "cmLinkLineDeviceComputer.h"
#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
@@ -47,6 +48,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
, TargetNameImport()
, TargetNamePDB()
, TargetLinkLanguage("")
+ , DeviceLinkObject()
{
this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName());
if (target->GetType() == cmStateEnums::EXECUTABLE) {
@@ -94,6 +96,9 @@ void cmNinjaNormalTargetGenerator::Generate()
if (this->GetGeneratorTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) {
this->WriteObjectLibStatement();
} else {
+ // If this target has cuda language link inputs, and we need to do
+ // device linking
+ this->WriteDeviceLinkStatement();
this->WriteLinkStatement();
}
}
@@ -155,6 +160,14 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerRule() const
this->GetGeneratorTarget()->GetName());
}
+std::string cmNinjaNormalTargetGenerator::LanguageLinkerDeviceRule() const
+{
+ return this->TargetLinkLanguage + "_" +
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) +
+ "_DEVICE_LINKER__" + cmGlobalNinjaGenerator::EncodeRuleName(
+ this->GetGeneratorTarget()->GetName());
+}
+
struct cmNinjaRemoveNoOpCommands
{
bool operator()(std::string const& cmd)
@@ -163,6 +176,115 @@ struct cmNinjaRemoveNoOpCommands
}
};
+void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
+{
+ cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
+ std::string ruleName = this->LanguageLinkerDeviceRule();
+ // Select whether to use a response file for objects.
+ std::string rspfile;
+ std::string rspcontent;
+
+ if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
+ cmRulePlaceholderExpander::RuleVariables vars;
+ vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
+
+ vars.Language = "CUDA";
+
+ std::string responseFlag;
+ if (!useResponseFile) {
+ vars.Objects = "$in";
+ vars.LinkLibraries = "$LINK_LIBRARIES";
+ } else {
+ std::string cmakeVarLang = "CMAKE_";
+ cmakeVarLang += this->TargetLinkLanguage;
+
+ // build response file name
+ std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG";
+ const char* flag = GetMakefile()->GetDefinition(cmakeLinkVar);
+ if (flag) {
+ responseFlag = flag;
+ } else {
+ responseFlag = "@";
+ }
+ rspfile = "$RSP_FILE";
+ responseFlag += rspfile;
+
+ // build response file content
+ if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
+ rspcontent = "$in";
+ } else {
+ rspcontent = "$in_newline";
+ }
+ rspcontent += " $LINK_LIBRARIES";
+ vars.Objects = responseFlag.c_str();
+ vars.LinkLibraries = "";
+ }
+
+ vars.ObjectDir = "$OBJECT_DIR";
+
+ vars.Target = "$TARGET_FILE";
+
+ vars.SONameFlag = "$SONAME_FLAG";
+ vars.TargetSOName = "$SONAME";
+ vars.TargetPDB = "$TARGET_PDB";
+
+ vars.Flags = "$FLAGS";
+ vars.LinkFlags = "$LINK_FLAGS";
+ vars.Manifests = "$MANIFESTS";
+
+ std::string langFlags;
+ if (targetType != cmStateEnums::EXECUTABLE) {
+ langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
+ vars.LanguageCompileFlags = langFlags.c_str();
+ }
+
+ std::string launcher;
+ const char* val = this->GetLocalGenerator()->GetRuleLauncher(
+ this->GetGeneratorTarget(), "RULE_LAUNCH_LINK");
+ if (val && *val) {
+ launcher = val;
+ launcher += " ";
+ }
+
+ CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander(
+ this->GetLocalGenerator()->CreateRulePlaceholderExpander());
+
+ // Rule for linking library/executable.
+ std::vector<std::string> linkCmds = this->ComputeDeviceLinkCmd();
+ for (std::vector<std::string>::iterator i = linkCmds.begin();
+ i != linkCmds.end(); ++i) {
+ *i = launcher + *i;
+ rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
+ *i, vars);
+ }
+ {
+ // If there is no ranlib the command will be ":". Skip it.
+ std::vector<std::string>::iterator newEnd = std::remove_if(
+ linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands());
+ linkCmds.erase(newEnd, linkCmds.end());
+ }
+
+ std::string linkCmd =
+ this->GetLocalGenerator()->BuildCommandLine(linkCmds);
+
+ // Write the linker rule with response file if needed.
+ std::ostringstream comment;
+ comment << "Rule for linking " << this->TargetLinkLanguage << " "
+ << this->GetVisibleTypeName() << ".";
+ std::ostringstream description;
+ description << "Linking " << this->TargetLinkLanguage << " "
+ << this->GetVisibleTypeName() << " $TARGET_FILE";
+ this->GetGlobalGenerator()->AddRule(ruleName, linkCmd, description.str(),
+ comment.str(),
+ /*depfile*/ "",
+ /*deptype*/ "", rspfile, rspcontent,
+ /*restat*/ "$RESTAT",
+ /*generator*/ false);
+ }
+}
+
void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
{
cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
@@ -327,6 +449,32 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
}
}
+std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
+{
+ std::vector<std::string> linkCmds;
+
+ // this target requires separable cuda compilation
+ // now build the correct command depending on if the target is
+ // an executable or a dynamic library.
+ std::string linkCmd;
+ switch (this->GetGeneratorTarget()->GetType()) {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY: {
+ const std::string cudaLinkCmd(
+ this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY"));
+ cmSystemTools::ExpandListArgument(cudaLinkCmd, linkCmds);
+ } break;
+ case cmStateEnums::EXECUTABLE: {
+ const std::string cudaLinkCmd(this->GetMakefile()->GetDefinition(
+ "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE"));
+ cmSystemTools::ExpandListArgument(cudaLinkCmd, linkCmds);
+ } break;
+ default:
+ break;
+ }
+ return linkCmds;
+}
+
std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
{
std::vector<std::string> linkCmds;
@@ -421,6 +569,211 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
return sz - linkRuleLength;
}
+void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
+{
+ cmGeneratorTarget& genTarget = *this->GetGeneratorTarget();
+
+ // determine if we need to do any device linking for this target
+ const std::string cuda_lang("CUDA");
+ cmGeneratorTarget::LinkClosure const* closure =
+ genTarget.GetLinkClosure(this->GetConfigName());
+
+ const bool hasCUDA =
+ (std::find(closure->Languages.begin(), closure->Languages.end(),
+ cuda_lang) != closure->Languages.end());
+
+ bool shouldHaveDeviceLinking = false;
+ switch (genTarget.GetType()) {
+ case cmStateEnums::SHARED_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
+ case cmStateEnums::EXECUTABLE:
+ shouldHaveDeviceLinking = true;
+ break;
+ default:
+ break;
+ }
+
+ if (!shouldHaveDeviceLinking || !hasCUDA) {
+ return;
+ }
+
+ // Now we can do device linking
+
+ // First and very important step is to make sure while inside this
+ // step our link language is set to CUDA
+ std::string cudaLinkLanguage = "CUDA";
+
+ std::string const cfgName = this->GetConfigName();
+ std::string const targetOutputReal =
+ ConvertToNinjaPath(genTarget.ObjectDirectory + "cmake_device_link.o");
+
+ std::string const targetOutputImplib =
+ ConvertToNinjaPath(genTarget.GetFullPath(cfgName,
+ /*implib=*/true));
+
+ this->DeviceLinkObject = targetOutputReal;
+
+ // Write comments.
+ cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
+ const cmStateEnums::TargetType targetType = genTarget.GetType();
+ this->GetBuildFileStream() << "# Device Link build statements for "
+ << cmState::GetTargetTypeName(targetType)
+ << " target " << this->GetTargetName() << "\n\n";
+
+ // Compute the comment.
+ std::ostringstream comment;
+ comment << "Link the " << this->GetVisibleTypeName() << " "
+ << targetOutputReal;
+
+ cmNinjaDeps emptyDeps;
+ cmNinjaVars vars;
+
+ // Compute outputs.
+ cmNinjaDeps outputs;
+ outputs.push_back(targetOutputReal);
+ // Compute specific libraries to link with.
+ cmNinjaDeps explicitDeps = this->GetObjects();
+ cmNinjaDeps implicitDeps = this->ComputeLinkDeps();
+
+ std::string frameworkPath;
+ std::string linkPath;
+
+ std::string createRule = genTarget.GetCreateRuleVariable(
+ this->TargetLinkLanguage, this->GetConfigName());
+ const bool useWatcomQuote =
+ this->GetMakefile()->IsOn(createRule + "_USE_WATCOM_QUOTE");
+ cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
+
+ vars["TARGET_FILE"] =
+ localGen.ConvertToOutputFormat(targetOutputReal, cmOutputConverter::SHELL);
+
+ CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
+ new cmNinjaLinkLineDeviceComputer(
+ this->GetLocalGenerator(),
+ this->GetLocalGenerator()->GetStateSnapshot().GetDirectory(),
+ this->GetGlobalGenerator()));
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
+
+ localGen.GetTargetFlags(
+ linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"],
+ vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget);
+
+ this->addPoolNinjaVariable("JOB_POOL_LINK", &genTarget, vars);
+
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"]);
+ vars["LINK_FLAGS"] =
+ cmGlobalNinjaGenerator::EncodeLiteral(vars["LINK_FLAGS"]);
+
+ vars["MANIFESTS"] = this->GetManifests();
+
+ vars["LINK_PATH"] = frameworkPath + linkPath;
+
+ // Compute architecture specific link flags. Yes, these go into a different
+ // variable for executables, probably due to a mistake made when duplicating
+ // code between the Makefile executable and library generators.
+ if (targetType == cmStateEnums::EXECUTABLE) {
+ std::string t = vars["FLAGS"];
+ localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName);
+ vars["FLAGS"] = t;
+ } else {
+ std::string t = vars["ARCH_FLAGS"];
+ localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName);
+ vars["ARCH_FLAGS"] = t;
+ t = "";
+ localGen.AddLanguageFlags(t, cudaLinkLanguage, cfgName);
+ vars["LANGUAGE_COMPILE_FLAGS"] = t;
+ }
+ if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
+ vars["SONAME_FLAG"] =
+ this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage);
+ vars["SONAME"] = this->TargetNameSO;
+ if (targetType == cmStateEnums::SHARED_LIBRARY) {
+ std::string install_dir =
+ this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName);
+ if (!install_dir.empty()) {
+ vars["INSTALLNAME_DIR"] = localGen.ConvertToOutputFormat(
+ install_dir, cmOutputConverter::SHELL);
+ }
+ }
+ }
+
+ cmNinjaDeps byproducts;
+
+ if (!this->TargetNameImport.empty()) {
+ const std::string impLibPath = localGen.ConvertToOutputFormat(
+ targetOutputImplib, cmOutputConverter::SHELL);
+ vars["TARGET_IMPLIB"] = impLibPath;
+ EnsureParentDirectoryExists(impLibPath);
+ if (genTarget.HasImportLibrary()) {
+ byproducts.push_back(targetOutputImplib);
+ }
+ }
+
+ const std::string objPath = GetGeneratorTarget()->GetSupportDirectory();
+ vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ this->ConvertToNinjaPath(objPath), cmOutputConverter::SHELL);
+ EnsureDirectoryExists(objPath);
+
+ if (this->GetGlobalGenerator()->IsGCCOnWindows()) {
+ // ar.exe can't handle backslashes in rsp files (implicitly used by gcc)
+ std::string& linkLibraries = vars["LINK_LIBRARIES"];
+ std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
+ std::string& link_path = vars["LINK_PATH"];
+ std::replace(link_path.begin(), link_path.end(), '\\', '/');
+ }
+
+ const std::vector<cmCustomCommand>* cmdLists[3] = {
+ &genTarget.GetPreBuildCommands(), &genTarget.GetPreLinkCommands(),
+ &genTarget.GetPostBuildCommands()
+ };
+
+ std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
+ vars["PRE_LINK"] = localGen.BuildCommandLine(preLinkCmdLines);
+ vars["POST_BUILD"] = localGen.BuildCommandLine(postBuildCmdLines);
+
+ std::vector<std::string>* cmdLineLists[3] = { &preLinkCmdLines,
+ &preLinkCmdLines,
+ &postBuildCmdLines };
+
+ for (unsigned i = 0; i != 3; ++i) {
+ for (std::vector<cmCustomCommand>::const_iterator ci =
+ cmdLists[i]->begin();
+ ci != cmdLists[i]->end(); ++ci) {
+ cmCustomCommandGenerator ccg(*ci, cfgName, this->GetLocalGenerator());
+ localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]);
+ std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
+ std::transform(ccByproducts.begin(), ccByproducts.end(),
+ std::back_inserter(byproducts), MapToNinjaPath());
+ }
+ }
+
+ cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
+
+ int commandLineLengthLimit = -1;
+ if (!this->ForceResponseFile()) {
+ commandLineLengthLimit = calculateCommandLineLengthLimit(
+ globalGen.GetRuleCmdLength(this->LanguageLinkerDeviceRule()));
+ }
+
+ const std::string rspfile =
+ std::string(cmake::GetCMakeFilesDirectoryPostSlash()) +
+ genTarget.GetName() + ".rsp";
+
+ // Gather order-only dependencies.
+ cmNinjaDeps orderOnlyDeps;
+ this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
+ orderOnlyDeps);
+
+ // Write the build statement for this target.
+ bool usedResponseFile = false;
+ globalGen.WriteBuild(this->GetBuildFileStream(), comment.str(),
+ this->LanguageLinkerDeviceRule(), outputs,
+ /*implicitOuts=*/cmNinjaDeps(), explicitDeps,
+ implicitDeps, orderOnlyDeps, vars, rspfile,
+ commandLineLengthLimit, &usedResponseFile);
+ this->WriteDeviceLinkRule(usedResponseFile);
+}
+
void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{
cmGeneratorTarget& gt = *this->GetGeneratorTarget();
@@ -481,6 +834,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmNinjaDeps explicitDeps = this->GetObjects();
cmNinjaDeps implicitDeps = this->ComputeLinkDeps();
+ if (!this->DeviceLinkObject.empty()) {
+ explicitDeps.push_back(this->DeviceLinkObject);
+ }
+
cmMakefile* mf = this->GetMakefile();
std::string frameworkPath;
@@ -504,6 +861,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
localGen.GetTargetFlags(
linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"],
vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget);
+
if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
(gt.GetType() == cmStateEnums::SHARED_LIBRARY ||
gt.IsExecutableWithExports())) {
diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h
index 5bd906f..e5595ea 100644
--- a/Source/cmNinjaNormalTargetGenerator.h
+++ b/Source/cmNinjaNormalTargetGenerator.h
@@ -22,12 +22,21 @@ public:
private:
std::string LanguageLinkerRule() const;
+ std::string LanguageLinkerDeviceRule() const;
+
const char* GetVisibleTypeName() const;
void WriteLanguagesRules();
+
void WriteLinkRule(bool useResponseFile);
+ void WriteDeviceLinkRule(bool useResponseFile);
+
void WriteLinkStatement();
+ void WriteDeviceLinkStatement();
+
void WriteObjectLibStatement();
+
std::vector<std::string> ComputeLinkCmd();
+ std::vector<std::string> ComputeDeviceLinkCmd();
private:
// Target name info.
@@ -37,6 +46,7 @@ private:
std::string TargetNameImport;
std::string TargetNamePDB;
std::string TargetLinkLanguage;
+ std::string DeviceLinkObject;
};
#endif // ! cmNinjaNormalTargetGenerator_h
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index a220cd8..e47de97 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -583,10 +583,22 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
}
// Rule for compiling object file.
- const std::string cmdVar = std::string("CMAKE_") + lang + "_COMPILE_OBJECT";
- std::string compileCmd = mf->GetRequiredDefinition(cmdVar);
std::vector<std::string> compileCmds;
- cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ if (lang == "CUDA") {
+ std::string cmdVar;
+ if (this->GeneratorTarget->GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
+ } else {
+ cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");
+ }
+ std::string compileCmd = mf->GetRequiredDefinition(cmdVar);
+ cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ } else {
+ const std::string cmdVar =
+ std::string("CMAKE_") + lang + "_COMPILE_OBJECT";
+ std::string compileCmd = mf->GetRequiredDefinition(cmdVar);
+ cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+ }
// Maybe insert an include-what-you-use runner.
if (!compileCmds.empty() && (lang == "C" || lang == "CXX")) {
diff --git a/Source/cmProcessOutput.h b/Source/cmProcessOutput.h
index d7a5e98..6a4e7d5 100644
--- a/Source/cmProcessOutput.h
+++ b/Source/cmProcessOutput.h
@@ -5,6 +5,7 @@
#include <cmConfigure.h> // IWYU pragma: keep
+#include <stddef.h>
#include <string>
#include <vector>
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f5d9e61..ee4ff39 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -266,6 +266,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("CXX_STANDARD", CM_NULLPTR);
this->SetPropertyDefault("CXX_STANDARD_REQUIRED", CM_NULLPTR);
this->SetPropertyDefault("CXX_EXTENSIONS", CM_NULLPTR);
+ this->SetPropertyDefault("CUDA_STANDARD", CM_NULLPTR);
+ this->SetPropertyDefault("CUDA_STANDARD_REQUIRED", CM_NULLPTR);
+ this->SetPropertyDefault("CUDA_EXTENSIONS", CM_NULLPTR);
this->SetPropertyDefault("LINK_SEARCH_START_STATIC", CM_NULLPTR);
this->SetPropertyDefault("LINK_SEARCH_END_STATIC", CM_NULLPTR);
}
@@ -360,6 +363,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->GetType() != cmStateEnums::UTILITY) {
this->SetPropertyDefault("C_VISIBILITY_PRESET", CM_NULLPTR);
this->SetPropertyDefault("CXX_VISIBILITY_PRESET", CM_NULLPTR);
+ this->SetPropertyDefault("CUDA_VISIBILITY_PRESET", CM_NULLPTR);
this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", CM_NULLPTR);
}
diff --git a/Source/cmUnexpectedCommand.cxx b/Source/cmUnexpectedCommand.cxx
new file mode 100644
index 0000000..a8de9e6
--- /dev/null
+++ b/Source/cmUnexpectedCommand.cxx
@@ -0,0 +1,22 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmUnexpectedCommand.h"
+
+#include <stdlib.h>
+
+#include "cmMakefile.h"
+
+class cmExecutionStatus;
+
+bool cmUnexpectedCommand::InitialPass(std::vector<std::string> const&,
+ cmExecutionStatus&)
+{
+ const char* versionValue =
+ this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
+ if (this->Name == "endif" && (!versionValue || atof(versionValue) <= 1.4)) {
+ return true;
+ }
+
+ this->SetError(this->Error);
+ return false;
+}
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
new file mode 100644
index 0000000..897dfb6
--- /dev/null
+++ b/Source/cmUnexpectedCommand.h
@@ -0,0 +1,40 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmUnexpectedCommand_h
+#define cmUnexpectedCommand_h
+
+#include <cmConfigure.h>
+#include <string>
+#include <vector>
+
+#include "cmCommand.h"
+
+class cmExecutionStatus;
+
+class cmUnexpectedCommand : public cmCommand
+{
+public:
+ cmUnexpectedCommand(std::string const& name, const char* error)
+ : Name(name)
+ , Error(error)
+ {
+ }
+
+ cmCommand* Clone() CM_OVERRIDE
+ {
+ return new cmUnexpectedCommand(this->Name, this->Error);
+ }
+
+ bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus& status) CM_OVERRIDE;
+
+ bool IsScriptable() const CM_OVERRIDE { return true; }
+
+ std::string GetName() const CM_OVERRIDE { return this->Name; }
+
+private:
+ std::string Name;
+ const char* Error;
+};
+
+#endif
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 1fa844c..a4e3adb 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -5,19 +5,22 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
-class cmMakefile;
-class cmGeneratorTarget;
+class cmComputeLinkInformation;
+class cmCustomCommand;
class cmGeneratedFileStream;
+class cmGeneratorTarget;
class cmGlobalVisualStudio10Generator;
-class cmSourceFile;
-class cmCustomCommand;
class cmLocalVisualStudio7Generator;
-class cmComputeLinkInformation;
+class cmMakefile;
+class cmSourceFile;
+class cmSourceGroup;
class cmVisualStudioGeneratorOptions;
-struct cmIDEFlagTable;
-#include "cmSourceGroup.h"
class cmVisualStudio10TargetGenerator
{
diff --git a/Source/cmVisualStudio10ToolsetOptions.h b/Source/cmVisualStudio10ToolsetOptions.h
index ea6c9c8..bb0be15 100644
--- a/Source/cmVisualStudio10ToolsetOptions.h
+++ b/Source/cmVisualStudio10ToolsetOptions.h
@@ -3,7 +3,9 @@
#ifndef cmVisualStudio10ToolsetOptions_h
#define cmVisualStudio10ToolsetOptions_h
-#include "cmStandardIncludes.h"
+#include <cmConfigure.h>
+
+#include <string>
struct cmIDEFlagTable;
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index e751bfc..62200ce 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -1,5 +1,6 @@
#include "cmVisualStudioGeneratorOptions.h"
+#include "cmLocalVisualStudioGenerator.h"
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
#include "cmVisualStudio10TargetGenerator.h"
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 0a0b96d..e27c5d3 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -3,9 +3,17 @@
#ifndef cmVisualStudioGeneratorOptions_h
#define cmVisualStudioGeneratorOptions_h
-#include "cmLocalVisualStudioGenerator.h"
+#include <cmConfigure.h>
+#include <iosfwd>
+#include <string>
+
+#include "cmGlobalVisualStudioGenerator.h"
+#include "cmIDEFlagTable.h"
#include "cmIDEOptions.h"
+
+class cmLocalVisualStudioGenerator;
+
typedef cmIDEFlagTable cmVS7FlagTable;
class cmVisualStudio10TargetGenerator;
diff --git a/Source/cmVisualStudioSlnData.h b/Source/cmVisualStudioSlnData.h
index 9f5ccb7..b2f8db9 100644
--- a/Source/cmVisualStudioSlnData.h
+++ b/Source/cmVisualStudioSlnData.h
@@ -5,7 +5,9 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <map>
+#include <string>
+#include <vector>
class cmSlnProjectEntry
{
diff --git a/Source/cmVisualStudioSlnParser.h b/Source/cmVisualStudioSlnParser.h
index 8939ab5..a3391a6 100644
--- a/Source/cmVisualStudioSlnParser.h
+++ b/Source/cmVisualStudioSlnParser.h
@@ -5,9 +5,10 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
-
#include <bitset>
+#include <iosfwd>
+#include <stddef.h>
+#include <string>
class cmSlnData;
@@ -65,6 +66,7 @@ public:
protected:
class State;
+
friend class State;
class ParsedLine;
diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h
index 25f1a18..8ed6083 100644
--- a/Source/cmVisualStudioWCEPlatformParser.h
+++ b/Source/cmVisualStudioWCEPlatformParser.h
@@ -5,7 +5,10 @@
#include <cmConfigure.h>
-#include "cmStandardIncludes.h"
+#include <map>
+#include <stddef.h>
+#include <string>
+#include <vector>
#include "cmXMLParser.h"
diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx
index a783c70..719e627 100644
--- a/Source/cmXCode21Object.cxx
+++ b/Source/cmXCode21Object.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmXCode21Object.h"
+#include <ostream>
+#include <string>
+
#include "cmSystemTools.h"
cmXCode21Object::cmXCode21Object(PBXType ptype, Type type)
diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h
index 0db20e6..083d229 100644
--- a/Source/cmXCode21Object.h
+++ b/Source/cmXCode21Object.h
@@ -3,6 +3,11 @@
#ifndef cmXCode21Object_h
#define cmXCode21Object_h
+#include <cmConfigure.h> // IWYU pragma: keep
+
+#include <iosfwd>
+#include <vector>
+
#include "cmXCodeObject.h"
class cmXCode21Object : public cmXCodeObject
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index b1dc7ea..3689ac4 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -2,9 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmXCodeObject.h"
-#include "cmSystemTools.h"
+#include <CoreFoundation/CoreFoundation.h>
+#include <ostream>
-#include <CoreFoundation/CoreFoundation.h> // CFUUIDCreate
+#include "cmSystemTools.h"
const char* cmXCodeObject::PBXTypeNames[] = {
/* clang-format needs this comment to break after the opening brace */
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h
index d495130..3bfecdf 100644
--- a/Source/cmXCodeObject.h
+++ b/Source/cmXCodeObject.h
@@ -3,9 +3,14 @@
#ifndef cmXCodeObject_h
#define cmXCodeObject_h
-#include <cmConfigure.h>
+#include <cmConfigure.h> // IWYU pragma: keep
-#include "cmStandardIncludes.h"
+#include <algorithm>
+#include <iosfwd>
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
class cmGeneratorTarget;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 59290ff..733e0e4 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1457,7 +1457,7 @@ void cmake::CreateDefaultGlobalGenerator()
const char* GeneratorName;
};
static VSVersionedGenerator const vsGenerators[] = {
- { "15.0", "Visual Studio 15" }, //
+ { "15.0", "Visual Studio 15 2017" }, //
{ "14.0", "Visual Studio 14 2015" }, //
{ "12.0", "Visual Studio 12 2013" }, //
{ "11.0", "Visual Studio 11 2012" }, //
diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx
index 82db012..e166bee 100644
--- a/Source/cmakexbuild.cxx
+++ b/Source/cmakexbuild.cxx
@@ -1,9 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmStandardIncludes.h"
-#include "cmSystemTools.h"
+#include <cmConfigure.h> // IWYU pragma: keep
+
#include <cmsys/Process.h>
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include "cmSystemTools.h"
// This is a wrapper program for xcodebuild
// it calls xcodebuild, and does two things
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index a2d313c..b8a9a6b 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -67,12 +67,15 @@
# written.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
-IF(POLICY CMP0025)
- CMAKE_POLICY(SET CMP0025 NEW)
-ENDIF()
-IF(POLICY CMP0056)
- CMAKE_POLICY(SET CMP0056 NEW)
-ENDIF()
+FOREACH(p
+ CMP0025 # CMake 3.0, Compiler id for Apple Clang is now AppleClang.
+ CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature.
+ CMP0063 # CMake 3.3, Honor visibility properties for all target types.
+ )
+ IF(POLICY ${p})
+ CMAKE_POLICY(SET ${p} NEW)
+ ENDIF()
+ENDFOREACH()
SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
#-----------------------------------------------------------------------------
diff --git a/Source/kwsys/ConsoleBuf.hxx.in b/Source/kwsys/ConsoleBuf.hxx.in
index 717462e..c45a351 100644
--- a/Source/kwsys/ConsoleBuf.hxx.in
+++ b/Source/kwsys/ConsoleBuf.hxx.in
@@ -147,42 +147,47 @@ protected:
return Traits::eof();
}
if (m_isConsoleInput) {
- wchar_t wbuffer[128];
+ // ReadConsole doesn't tell if there's more input available
+ // don't support reading more characters than this
+ wchar_t wbuffer[8192];
DWORD charsRead;
- if (::ReadConsoleW(m_hInput, wbuffer,
- (sizeof(wbuffer) / sizeof(wbuffer[0])) - 1,
- &charsRead, NULL) == 0 ||
+ if (ReadConsoleW(m_hInput, wbuffer,
+ (sizeof(wbuffer) / sizeof(wbuffer[0])), &charsRead,
+ NULL) == 0 ||
charsRead == 0) {
_setg(true);
return Traits::eof();
}
- wbuffer[charsRead] = L'\0';
- setBuffer(wbuffer, m_ibuffer);
+ setBuffer(std::wstring(wbuffer, charsRead), m_ibuffer);
} else {
- std::wstring totalBuffer;
std::wstring wbuffer;
- char buffer[128];
+ std::string strbuffer;
DWORD bytesRead;
- while (::ReadFile(m_hInput, buffer,
- (sizeof(buffer) / sizeof(buffer[0])) - 1, &bytesRead,
- NULL) == 0) {
- if (::GetLastError() == ERROR_MORE_DATA) {
- buffer[bytesRead] = '\0';
- if (decodeInputBuffer(buffer, wbuffer)) {
- totalBuffer += wbuffer;
- continue;
- }
+ LARGE_INTEGER size;
+ if (GetFileSizeEx(m_hInput, &size) == 0) {
+ _setg(true);
+ return Traits::eof();
+ }
+ char* buffer = new char[size.LowPart];
+ while (ReadFile(m_hInput, buffer, size.LowPart, &bytesRead, NULL) ==
+ 0) {
+ if (GetLastError() == ERROR_MORE_DATA) {
+ strbuffer += std::string(buffer, bytesRead);
+ continue;
}
_setg(true);
+ delete[] buffer;
return Traits::eof();
}
- buffer[bytesRead] = '\0';
- if (!decodeInputBuffer(buffer, wbuffer)) {
+ if (bytesRead > 0) {
+ strbuffer += std::string(buffer, bytesRead);
+ }
+ delete[] buffer;
+ if (!decodeInputBuffer(strbuffer, wbuffer)) {
_setg(true);
return Traits::eof();
}
- totalBuffer += wbuffer;
- setBuffer(totalBuffer, m_ibuffer);
+ setBuffer(wbuffer, m_ibuffer);
}
_setg();
}
@@ -315,6 +320,10 @@ private:
}
bool encodeOutputBuffer(const std::wstring wbuffer, std::string& buffer)
{
+ if (wbuffer.size() == 0) {
+ buffer = std::string();
+ return true;
+ }
const int length =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), NULL, 0, NULL, NULL);
@@ -329,23 +338,31 @@ private:
delete[] buf;
return success;
}
- bool decodeInputBuffer(const char* buffer, std::wstring& wbuffer)
+ bool decodeInputBuffer(const std::string buffer, std::wstring& wbuffer)
{
+ int length = int(buffer.length());
+ if (length == 0) {
+ wbuffer = std::wstring();
+ return true;
+ }
int actualCodepage = m_activeInputCodepage;
const char BOM_UTF8[] = { char(0xEF), char(0xBB), char(0xBF) };
- if (std::memcmp(buffer, BOM_UTF8, sizeof(BOM_UTF8)) == 0) {
+ const char* data = buffer.data();
+ const size_t BOMsize = sizeof(BOM_UTF8);
+ if (length >= BOMsize && std::memcmp(data, BOM_UTF8, BOMsize) == 0) {
// PowerShell uses UTF-8 with BOM for pipes
actualCodepage = CP_UTF8;
- buffer += sizeof(BOM_UTF8);
+ data += BOMsize;
+ length -= BOMsize;
}
const int wlength =
- MultiByteToWideChar(actualCodepage, 0, buffer, -1, NULL, 0);
+ MultiByteToWideChar(actualCodepage, 0, data, length, NULL, 0);
wchar_t* wbuf = new wchar_t[wlength];
const bool success =
- MultiByteToWideChar(actualCodepage, 0, buffer, -1, wbuf, wlength) > 0
+ MultiByteToWideChar(actualCodepage, 0, data, length, wbuf, wlength) > 0
? true
: false;
- wbuffer = wbuf;
+ wbuffer = std::wstring(wbuf, wlength);
delete[] wbuf;
return success;
}
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 0bf0a7c..5d4ca70 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -1,4 +1,4 @@
-#include "cmSystemTools.h"
+#include <cmConfigure.h>
#include <cmsys/FStream.hxx>
#include <iostream>
@@ -8,6 +8,8 @@
#include <utility>
#include <vector>
+#include "cmSystemTools.h"
+
class CompileCommandParser
{
public:
diff --git a/Tests/CMakeLib/testFindPackageCommand.cxx b/Tests/CMakeLib/testFindPackageCommand.cxx
index 7622756..bfd429f 100644
--- a/Tests/CMakeLib/testFindPackageCommand.cxx
+++ b/Tests/CMakeLib/testFindPackageCommand.cxx
@@ -1,9 +1,13 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmFindPackageCommand.h"
+
+#include <cmConfigure.h> // IWYU pragma: keep
#include <iostream>
#include <string>
+#include <vector>
+
+#include "cmFindPackageCommand.h"
#define cmPassed(m) std::cout << "Passed: " << (m) << "\n"
#define cmFailed(m) \
diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx
index b16b088..0dfa326 100644
--- a/Tests/CMakeLib/testSystemTools.cxx
+++ b/Tests/CMakeLib/testSystemTools.cxx
@@ -1,9 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmSystemTools.h"
+
+#include <cmConfigure.h> // IWYU pragma: keep
#include <iostream>
+#include <stddef.h>
#include <string>
+#include <vector>
+
+#include "cmSystemTools.h"
#define cmPassed(m) std::cout << "Passed: " << (m) << "\n"
#define cmFailed(m) \
diff --git a/Tests/CMakeLib/testXMLSafe.cxx b/Tests/CMakeLib/testXMLSafe.cxx
index 6c59128..fe776c5 100644
--- a/Tests/CMakeLib/testXMLSafe.cxx
+++ b/Tests/CMakeLib/testXMLSafe.cxx
@@ -1,11 +1,14 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
-#include "cmXMLSafe.h"
+
+#include <cmConfigure.h>
#include <sstream>
#include <stdio.h>
#include <string>
+#include "cmXMLSafe.h"
+
struct test_pair
{
const char* in;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 6327f25..fa5f3e8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -324,6 +324,8 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(VSGNUFortran ${CMAKE_COMMAND} -P runtest.cmake)
endif()
endif()
+
+
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
ADD_TEST_MACRO(CxxSubdirC CxxSubdirC)
@@ -1353,6 +1355,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
endif()
+ if(CMake_TEST_CUDA)
+ add_subdirectory(Cuda)
+ add_subdirectory(CudaOnly)
+ endif()
+
if(CMake_TEST_FindBoost)
add_subdirectory(FindBoost)
endif()
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
new file mode 100644
index 0000000..5772fcf
--- /dev/null
+++ b/Tests/Cuda/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+ADD_TEST_MACRO(Cuda.Complex CudaComplex)
+ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
+ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt
new file mode 100644
index 0000000..9a3703a
--- /dev/null
+++ b/Tests/Cuda/Complex/CMakeLists.txt
@@ -0,0 +1,40 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (CudaComplex CXX CUDA)
+#Goal for this example:
+
+#build a cpp dynamic library base
+#build a cuda static library base that uses separable compilation
+
+#build a cuda dynamic library that uses the first dynamic library
+#build a mixed cpp & cuda dynamic library uses all 3 previous libraries
+
+#lastly build a cpp executable that uses this last cuda dynamic library
+
+#this tests that we can properly handle linking cuda and cpp together
+#and also bulding cpp targets that need cuda implicit libraries
+
+#verify that we can pass explicit cuda arch flags
+set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+set(CMAKE_CUDA_STANDARD 11)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
+set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+
+add_library(CudaComplexCppBase SHARED dynamic.cpp)
+add_library(CudaComplexSeperableLib STATIC file1.cu file2.cu file3.cu)
+set_target_properties(CudaComplexSeperableLib
+ PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
+set_target_properties( CudaComplexSeperableLib
+ PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+add_library(CudaComplexSharedLib SHARED dynamic.cu)
+target_link_libraries(CudaComplexSharedLib PUBLIC CudaComplexCppBase)
+
+add_library(CudaComplexMixedLib SHARED mixed.cpp mixed.cu)
+target_link_libraries(CudaComplexMixedLib
+ PUBLIC CudaComplexSharedLib
+ PRIVATE CudaComplexSeperableLib)
+
+add_executable(CudaComplex main.cpp)
+target_link_libraries(CudaComplex PUBLIC CudaComplexMixedLib)
diff --git a/Tests/Cuda/Complex/dynamic.cpp b/Tests/Cuda/Complex/dynamic.cpp
new file mode 100644
index 0000000..d579f1e
--- /dev/null
+++ b/Tests/Cuda/Complex/dynamic.cpp
@@ -0,0 +1,5 @@
+
+int dynamic_base_func(int x)
+{
+ return x * x;
+}
diff --git a/Tests/Cuda/Complex/dynamic.cu b/Tests/Cuda/Complex/dynamic.cu
new file mode 100644
index 0000000..9540e86
--- /dev/null
+++ b/Tests/Cuda/Complex/dynamic.cu
@@ -0,0 +1,29 @@
+
+#include <string>
+#include <cuda.h>
+
+int dynamic_base_func(int);
+
+int __host__ cuda_dynamic_host_func(int x)
+{
+ return dynamic_base_func(x);
+}
+
+static
+__global__
+void DetermineIfValidCudaDevice()
+{
+}
+
+void cuda_dynamic_lib_func(std::string& contents )
+{
+ DetermineIfValidCudaDevice <<<1,1>>> ();
+ if(cudaSuccess == cudaGetLastError())
+ {
+ contents = "ran a cuda kernel";
+ }
+ else
+ {
+ contents = "cant run a cuda kernel";
+ }
+}
diff --git a/Tests/Cuda/Complex/file1.cu b/Tests/Cuda/Complex/file1.cu
new file mode 100644
index 0000000..a2e8bf3
--- /dev/null
+++ b/Tests/Cuda/Complex/file1.cu
@@ -0,0 +1,10 @@
+
+#include "file1.h"
+
+result_type __device__ file1_func(int x)
+{
+ result_type r;
+ r.input = x;
+ r.sum = x*x;
+ return r;
+}
diff --git a/Tests/Cuda/Complex/file1.h b/Tests/Cuda/Complex/file1.h
new file mode 100644
index 0000000..ff1945c
--- /dev/null
+++ b/Tests/Cuda/Complex/file1.h
@@ -0,0 +1,7 @@
+
+#pragma once
+struct result_type
+{
+ int input;
+ int sum;
+};
diff --git a/Tests/Cuda/Complex/file2.cu b/Tests/Cuda/Complex/file2.cu
new file mode 100644
index 0000000..6b8b06b
--- /dev/null
+++ b/Tests/Cuda/Complex/file2.cu
@@ -0,0 +1,20 @@
+
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+
+result_type_dynamic __device__ file2_func(int x)
+{
+ if(x!=42)
+ {
+ const result_type r = file1_func(x);
+ const result_type_dynamic rd { r.input, r.sum, true };
+ return rd;
+ }
+ else
+ {
+ const result_type_dynamic rd { x, x*x*x, false };
+ return rd;
+ }
+
+}
diff --git a/Tests/Cuda/Complex/file2.h b/Tests/Cuda/Complex/file2.h
new file mode 100644
index 0000000..d2dbaa4
--- /dev/null
+++ b/Tests/Cuda/Complex/file2.h
@@ -0,0 +1,10 @@
+
+#pragma once
+#include "file1.h"
+
+struct result_type_dynamic
+{
+ int input;
+ int sum;
+ bool from_static;
+};
diff --git a/Tests/Cuda/Complex/file3.cu b/Tests/Cuda/Complex/file3.cu
new file mode 100644
index 0000000..3c5e952
--- /dev/null
+++ b/Tests/Cuda/Complex/file3.cu
@@ -0,0 +1,25 @@
+
+#include <iostream>
+
+#include "file1.h"
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+result_type_dynamic __device__ file2_func(int x);
+
+static
+__global__
+void file3_kernel(result_type& r, int x)
+{
+ //call static_func which is a method that is defined in the
+ //static library that is always out of date
+ r = file1_func(x);
+ result_type_dynamic rd = file2_func(x);
+}
+
+int file3_launch_kernel(int x)
+{
+ result_type r;
+ file3_kernel <<<1,1>>> (r,x);
+ return r.sum;
+}
diff --git a/Tests/Cuda/Complex/main.cpp b/Tests/Cuda/Complex/main.cpp
new file mode 100644
index 0000000..a72ffd7
--- /dev/null
+++ b/Tests/Cuda/Complex/main.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+#include "file1.h"
+#include "file2.h"
+
+result_type call_cuda_seperable_code(int x);
+result_type mixed_launch_kernel(int x);
+
+int main(int argc, char** argv)
+{
+ call_cuda_seperable_code(42);
+ mixed_launch_kernel(42);
+ return 0;
+}
diff --git a/Tests/Cuda/Complex/mixed.cpp b/Tests/Cuda/Complex/mixed.cpp
new file mode 100644
index 0000000..205f091
--- /dev/null
+++ b/Tests/Cuda/Complex/mixed.cpp
@@ -0,0 +1,14 @@
+
+int dynamic_base_func(int);
+int cuda_dynamic_host_func(int);
+int file3_launch_kernel(int);
+
+int dynamic_final_func(int x)
+{
+ return cuda_dynamic_host_func(dynamic_base_func(x));
+}
+
+int call_cuda_seperable_code(int x)
+{
+ return file3_launch_kernel(x);
+}
diff --git a/Tests/Cuda/Complex/mixed.cu b/Tests/Cuda/Complex/mixed.cu
new file mode 100644
index 0000000..d2e8275
--- /dev/null
+++ b/Tests/Cuda/Complex/mixed.cu
@@ -0,0 +1,25 @@
+
+#include <iostream>
+
+#include "file1.h"
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+result_type_dynamic __device__ file2_func(int x);
+
+static
+__global__
+void mixed_kernel(result_type& r, int x)
+{
+ //call static_func which is a method that is defined in the
+ //static library that is always out of date
+ r = file1_func(x);
+ result_type_dynamic rd = file2_func(x);
+}
+
+int mixed_launch_kernel(int x)
+{
+ result_type r;
+ mixed_kernel <<<1,1>>> (r,x);
+ return r.sum;
+}
diff --git a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt
new file mode 100644
index 0000000..8361b9e
--- /dev/null
+++ b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (CudaConsumeCompileFeatures CXX CUDA)
+#Goal for this example:
+
+#build a c++11 library that express a c++11 public compile feature
+#link a cuda library and verify it builds with c++11 enabled
+
+#build a standalone c++/cuda mixed executable where we express a c++11
+#compile feature.
+
+
+add_library(CudaConsumeLib STATIC static.cpp static.cu)
+target_compile_features(CudaConsumeLib PUBLIC cxx_constexpr)
+
+add_executable(CudaConsumeCompileFeatures main.cu)
+target_link_libraries(CudaConsumeCompileFeatures PRIVATE CudaConsumeLib)
diff --git a/Tests/Cuda/ConsumeCompileFeatures/main.cu b/Tests/Cuda/ConsumeCompileFeatures/main.cu
new file mode 100644
index 0000000..712871c
--- /dev/null
+++ b/Tests/Cuda/ConsumeCompileFeatures/main.cu
@@ -0,0 +1,18 @@
+
+#include <iostream>
+
+int static_cxx11_func(int);
+
+void test_functions()
+{
+ auto x = static_cxx11_func( int(42) );
+ std::cout << x << std::endl;
+}
+
+int main(int argc, char **argv)
+{
+ test_functions();
+ std::cout << "this executable doesn't use cuda code, just call methods defined" << std::endl;
+ std::cout << "in libraries that have cuda code" << std::endl;
+ return 0;
+}
diff --git a/Tests/Cuda/ConsumeCompileFeatures/static.cpp b/Tests/Cuda/ConsumeCompileFeatures/static.cpp
new file mode 100644
index 0000000..565d52e
--- /dev/null
+++ b/Tests/Cuda/ConsumeCompileFeatures/static.cpp
@@ -0,0 +1,10 @@
+
+
+#include <type_traits>
+
+int static_cuda11_func(int);
+
+int static_cxx11_func(int x)
+{
+ return static_cuda11_func(x) + std::integral_constant<int, 32>::value;
+}
diff --git a/Tests/Cuda/ConsumeCompileFeatures/static.cu b/Tests/Cuda/ConsumeCompileFeatures/static.cu
new file mode 100644
index 0000000..73e43a8
--- /dev/null
+++ b/Tests/Cuda/ConsumeCompileFeatures/static.cu
@@ -0,0 +1,9 @@
+
+#include <type_traits>
+
+using tt = std::true_type;
+using ft = std::false_type;
+int __host__ static_cuda11_func(int x)
+{
+ return x * x + std::integral_constant<int, 17>::value;
+}
diff --git a/Tests/Cuda/ObjectLibrary/CMakeLists.txt b/Tests/Cuda/ObjectLibrary/CMakeLists.txt
new file mode 100644
index 0000000..cbe1e67
--- /dev/null
+++ b/Tests/Cuda/ObjectLibrary/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.7)
+project (CudaObjectLibrary CUDA CXX)
+#Goal for this example:
+
+#build a object files some with cuda and some without than
+#embed these into an executable
+
+add_library(CudaMixedObjectLib OBJECT static.cu static.cpp)
+
+add_executable(CudaObjectLibrary
+ main.cpp
+ $<TARGET_OBJECTS:CudaMixedObjectLib>)
diff --git a/Tests/Cuda/ObjectLibrary/main.cpp b/Tests/Cuda/ObjectLibrary/main.cpp
new file mode 100644
index 0000000..1a70a99
--- /dev/null
+++ b/Tests/Cuda/ObjectLibrary/main.cpp
@@ -0,0 +1,20 @@
+
+#include <iostream>
+
+int static_func(int);
+int file1_sq_func(int);
+
+void test_functions()
+{
+ file1_sq_func(static_func(42));
+}
+
+int main(int argc, char** argv)
+{
+ test_functions();
+ std::cout
+ << "this executable doesn't use cuda code, just call methods defined"
+ << std::endl;
+ std::cout << "in object files that have cuda code" << std::endl;
+ return 0;
+}
diff --git a/Tests/Cuda/ObjectLibrary/static.cpp b/Tests/Cuda/ObjectLibrary/static.cpp
new file mode 100644
index 0000000..6db1f91
--- /dev/null
+++ b/Tests/Cuda/ObjectLibrary/static.cpp
@@ -0,0 +1,6 @@
+int file1_sq_func(int);
+
+int static_func(int x)
+{
+ return file1_sq_func(x);
+}
diff --git a/Tests/Cuda/ObjectLibrary/static.cu b/Tests/Cuda/ObjectLibrary/static.cu
new file mode 100644
index 0000000..2374c23
--- /dev/null
+++ b/Tests/Cuda/ObjectLibrary/static.cu
@@ -0,0 +1,21 @@
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <iostream>
+
+int __host__ file1_sq_func(int x)
+{
+ cudaError_t err;
+ int nDevices = 0;
+ err = cudaGetDeviceCount(&nDevices);
+ if(err != cudaSuccess)
+ {
+ std::cout << "nDevices: " << nDevices << std::endl;
+ std::cout << "err: " << err << std::endl;
+ return 1;
+ }
+ std::cout << "this library uses cuda code" << std::endl;
+ std::cout << "you have " << nDevices << " devices that support cuda" << std::endl;
+
+ return x * x;
+}
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
new file mode 100644
index 0000000..85a2051
--- /dev/null
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard)
+ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation)
+ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs)
diff --git a/Tests/CudaOnly/EnableStandard/CMakeLists.txt b/Tests/CudaOnly/EnableStandard/CMakeLists.txt
new file mode 100644
index 0000000..53b9132
--- /dev/null
+++ b/Tests/CudaOnly/EnableStandard/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (CudaOnlyEnableStandard CUDA)
+
+#Goal for this example:
+#build cuda sources that require C++11 to be enabled.
+
+add_library(CUDAStatic11 STATIC static.cu)
+add_library(CUDADynamic11 SHARED shared.cu)
+
+add_executable(CudaOnlyEnableStandard main.cu)
+target_link_libraries(CudaOnlyEnableStandard PRIVATE CUDAStatic11 CUDADynamic11)
+
+set_target_properties(CUDAStatic11 CUDADynamic11 PROPERTIES CUDA_STANDARD 11)
+set_target_properties(CUDAStatic11 CUDADynamic11 PROPERTIES CUDA_STANDARD_REQUIRED TRUE)
diff --git a/Tests/CudaOnly/EnableStandard/main.cu b/Tests/CudaOnly/EnableStandard/main.cu
new file mode 100644
index 0000000..83e9dfd
--- /dev/null
+++ b/Tests/CudaOnly/EnableStandard/main.cu
@@ -0,0 +1,17 @@
+
+#include <iostream>
+
+int static_cuda11_func(int);
+int shared_cuda11_func(int);
+
+void test_functions()
+{
+ static_cuda11_func( int(42) );
+ shared_cuda11_func( int(42) );
+}
+
+int main(int argc, char **argv)
+{
+ test_functions();
+ return 0;
+}
diff --git a/Tests/CudaOnly/EnableStandard/shared.cu b/Tests/CudaOnly/EnableStandard/shared.cu
new file mode 100644
index 0000000..28555b3
--- /dev/null
+++ b/Tests/CudaOnly/EnableStandard/shared.cu
@@ -0,0 +1,9 @@
+
+#include <type_traits>
+
+using tt = std::true_type;
+using ft = std::false_type;
+int __host__ shared_cuda11_func(int x)
+{
+ return x * x + std::integral_constant<int, 17>::value;
+}
diff --git a/Tests/CudaOnly/EnableStandard/static.cu b/Tests/CudaOnly/EnableStandard/static.cu
new file mode 100644
index 0000000..73e43a8
--- /dev/null
+++ b/Tests/CudaOnly/EnableStandard/static.cu
@@ -0,0 +1,9 @@
+
+#include <type_traits>
+
+using tt = std::true_type;
+using ft = std::false_type;
+int __host__ static_cuda11_func(int x)
+{
+ return x * x + std::integral_constant<int, 17>::value;
+}
diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
new file mode 100644
index 0000000..7055eef
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
@@ -0,0 +1,33 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (CudaOnlySeparateCompilation CUDA)
+
+#Goal for this example:
+#Build a static library that defines multiple methods and kernels that
+#use each other.
+#After that confirm that we can call those methods from dynamic libraries
+#and executables.
+#We complicate the matter by also testing that multiple static libraries
+#all containing cuda separable compilation code links properly
+set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CUDA_STANDARD 11)
+add_library(CUDASerarateLibA STATIC file1.cu file2.cu file3.cu)
+
+#Having file4/file5 in a shared library causes serious problems
+#with the nvcc linker and it will generate bad entries that will
+#cause a segv when trying to run the executable
+#
+add_library(CUDASerarateLibB STATIC file4.cu file5.cu)
+target_link_libraries(CUDASerarateLibB PRIVATE CUDASerarateLibA)
+
+add_executable(CudaOnlySeparateCompilation main.cu)
+target_link_libraries(CudaOnlySeparateCompilation PRIVATE CUDASerarateLibB)
+
+set_target_properties( CUDASerarateLibA
+ CUDASerarateLibB
+ PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
+
+set_target_properties( CUDASerarateLibA
+ CUDASerarateLibB
+ PROPERTIES POSITION_INDEPENDENT_CODE ON)
diff --git a/Tests/CudaOnly/SeparateCompilation/file1.cu b/Tests/CudaOnly/SeparateCompilation/file1.cu
new file mode 100644
index 0000000..a2e8bf3
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file1.cu
@@ -0,0 +1,10 @@
+
+#include "file1.h"
+
+result_type __device__ file1_func(int x)
+{
+ result_type r;
+ r.input = x;
+ r.sum = x*x;
+ return r;
+}
diff --git a/Tests/CudaOnly/SeparateCompilation/file1.h b/Tests/CudaOnly/SeparateCompilation/file1.h
new file mode 100644
index 0000000..ff1945c
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file1.h
@@ -0,0 +1,7 @@
+
+#pragma once
+struct result_type
+{
+ int input;
+ int sum;
+};
diff --git a/Tests/CudaOnly/SeparateCompilation/file2.cu b/Tests/CudaOnly/SeparateCompilation/file2.cu
new file mode 100644
index 0000000..6b8b06b
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file2.cu
@@ -0,0 +1,20 @@
+
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+
+result_type_dynamic __device__ file2_func(int x)
+{
+ if(x!=42)
+ {
+ const result_type r = file1_func(x);
+ const result_type_dynamic rd { r.input, r.sum, true };
+ return rd;
+ }
+ else
+ {
+ const result_type_dynamic rd { x, x*x*x, false };
+ return rd;
+ }
+
+}
diff --git a/Tests/CudaOnly/SeparateCompilation/file2.h b/Tests/CudaOnly/SeparateCompilation/file2.h
new file mode 100644
index 0000000..d2dbaa4
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file2.h
@@ -0,0 +1,10 @@
+
+#pragma once
+#include "file1.h"
+
+struct result_type_dynamic
+{
+ int input;
+ int sum;
+ bool from_static;
+};
diff --git a/Tests/CudaOnly/SeparateCompilation/file3.cu b/Tests/CudaOnly/SeparateCompilation/file3.cu
new file mode 100644
index 0000000..670a18b
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file3.cu
@@ -0,0 +1,25 @@
+
+
+#include "file1.h"
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+result_type_dynamic __device__ file2_func(int x);
+
+
+static
+__global__
+void file3_kernel(result_type& r, int x)
+{
+ //call static_func which is a method that is defined in the
+ //static library that is always out of date
+ r = file1_func(x);
+ result_type_dynamic rd = file2_func(x);
+}
+
+result_type file3_launch_kernel(int x)
+{
+ result_type r;
+ file3_kernel <<<1,1>>> (r,x);
+ return r;
+}
diff --git a/Tests/CudaOnly/SeparateCompilation/file4.cu b/Tests/CudaOnly/SeparateCompilation/file4.cu
new file mode 100644
index 0000000..86ef623
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file4.cu
@@ -0,0 +1,25 @@
+
+#include <iostream>
+
+#include "file1.h"
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+result_type_dynamic __device__ file2_func(int x);
+
+static
+__global__
+void file4_kernel(result_type& r, int x)
+{
+ //call static_func which is a method that is defined in the
+ //static library that is always out of date
+ r = file1_func(x);
+ result_type_dynamic rd = file2_func(x);
+}
+
+int file4_launch_kernel(int x)
+{
+ result_type r;
+ file4_kernel <<<1,1>>> (r,x);
+ return r.sum;
+}
diff --git a/Tests/CudaOnly/SeparateCompilation/file5.cu b/Tests/CudaOnly/SeparateCompilation/file5.cu
new file mode 100644
index 0000000..6fdb32a
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/file5.cu
@@ -0,0 +1,25 @@
+
+#include <iostream>
+
+#include "file1.h"
+#include "file2.h"
+
+result_type __device__ file1_func(int x);
+result_type_dynamic __device__ file2_func(int x);
+
+static
+__global__
+void file5_kernel(result_type& r, int x)
+{
+ //call static_func which is a method that is defined in the
+ //static library that is always out of date
+ r = file1_func(x);
+ result_type_dynamic rd = file2_func(x);
+}
+
+int file5_launch_kernel(int x)
+{
+ result_type r;
+ file5_kernel <<<1,1>>> (r,x);
+ return r.sum;
+}
diff --git a/Tests/CudaOnly/SeparateCompilation/main.cu b/Tests/CudaOnly/SeparateCompilation/main.cu
new file mode 100644
index 0000000..d4520ae
--- /dev/null
+++ b/Tests/CudaOnly/SeparateCompilation/main.cu
@@ -0,0 +1,15 @@
+
+#include <iostream>
+
+#include "file1.h"
+#include "file2.h"
+
+// result_type file4_launch_kernel(int x);
+// result_type file5_launch_kernel(int x);
+
+int main(int argc, char **argv)
+{
+ // file4_launch_kernel(42);
+ // file5_launch_kernel(42);
+ return 0;
+}
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
new file mode 100644
index 0000000..c4ca8b9
--- /dev/null
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -0,0 +1,31 @@
+
+cmake_minimum_required(VERSION 3.7)
+project (CudaOnlyWithDefs CUDA)
+
+#verify that we can pass explicit cuda arch flags
+set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+set(debug_compile_flags --generate-code arch=compute_20,code=sm_20 -Xcompiler=-Werror)
+set(release_compile_defs DEFREL)
+
+#Goal for this example:
+#build a executable that needs to be passed a complex define through add_defintions
+#this verifies we can pass things such as '_','(' to nvcc
+add_definitions("-DPACKED_DEFINE=__attribute__((packed))")
+set_source_files_properties(main.notcu PROPERTIES LANGUAGE CUDA)
+add_executable(CudaOnlyWithDefs main.notcu)
+
+target_compile_options(CudaOnlyWithDefs
+ PRIVATE
+ $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>>
+ )
+
+target_compile_definitions(CudaOnlyWithDefs
+ PRIVATE
+ $<$<CONFIG:RELEASE>:$<BUILD_INTERFACE:${release_compile_defs}>>
+ )
+
+#we need to add an rpath for the cuda library so that everything
+#loads properly on the mac
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ set_target_properties(CudaOnlyWithDefs PROPERTIES LINK_FLAGS "-Wl,-rpath,${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}")
+endif()
diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu
new file mode 100644
index 0000000..6b02bbc
--- /dev/null
+++ b/Tests/CudaOnly/WithDefs/main.notcu
@@ -0,0 +1,46 @@
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <iostream>
+
+static
+__global__
+void DetermineIfValidCudaDevice()
+{
+}
+
+struct PACKED_DEFINE result_type
+{
+ bool valid;
+ int value;
+#if defined(NDEBUG) && !defined(DEFREL)
+#error missing DEFREL flag
+#endif
+};
+
+result_type can_launch_kernel()
+{
+ result_type r;
+ DetermineIfValidCudaDevice <<<1,1>>> ();
+ r.valid = (cudaSuccess == cudaGetLastError());
+ if(r.valid)
+ {
+ r.value = 1;
+ }
+ else
+ {
+ r.value = -1;
+ }
+ return r;
+}
+
+int main(int argc, char **argv)
+{
+ cudaError_t err;
+ int nDevices = 0;
+ err = cudaGetDeviceCount(&nDevices);
+ if(err != cudaSuccess)
+ {
+ return 1;
+ }
+ return 0;
+}
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index db18462..4920582 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -3,9 +3,7 @@ project(IncludeDirectories)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
OR CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
- AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles"
- OR CMAKE_GENERATOR STREQUAL "Ninja"
- OR (CMAKE_GENERATOR STREQUAL "Xcode" AND NOT XCODE_VERSION VERSION_LESS 6.0)))
+ AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
if(run_sys_includes_test)
diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
index 5078f30..dcee85e 100644
--- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt
@@ -15,17 +15,10 @@ target_include_directories(upstream SYSTEM PUBLIC
)
add_library(config_specific INTERFACE)
-if(CMAKE_GENERATOR STREQUAL "Xcode")
- # CMAKE_BUILD_TYPE does not work here for multi-config generators
- target_include_directories(config_specific SYSTEM INTERFACE
- "${CMAKE_CURRENT_SOURCE_DIR}/config_specific"
- )
-else()
- set(testConfig ${CMAKE_BUILD_TYPE})
- target_include_directories(config_specific SYSTEM INTERFACE
- "$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>"
- )
-endif()
+set(testConfig ${CMAKE_BUILD_TYPE})
+target_include_directories(config_specific SYSTEM INTERFACE
+ "$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>"
+)
add_library(consumer consumer.cpp)
target_link_libraries(consumer upstream config_specific)
diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt
index e42e971..c361af0 100644
--- a/Tests/RunCMake/CPack/CMakeLists.txt
+++ b/Tests/RunCMake/CPack/CMakeLists.txt
@@ -1,12 +1,17 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "")
+
project(${RunCMake_TEST} CXX)
-include(${RunCMake_TEST_FILE_PREFIX}.cmake)
-# include test generator specifics
-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-specifics.cmake")
- include("${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-specifics.cmake")
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/packaging_${PACKAGING_TYPE}_default.cmake")
+ include(${GENERATOR_TYPE}/packaging_${PACKAGING_TYPE}_default.cmake)
endif()
+# set default test name (can be overwritten in test.cmake or specifics.cmake)
+string(TOLOWER "${RunCMake_TEST_FILE_PREFIX}" CPACK_PACKAGE_NAME)
+
+include(tests/${RunCMake_TEST_FILE_PREFIX}/test.cmake)
+
set(CPACK_GENERATOR "${GENERATOR_TYPE}")
include(CPack)
diff --git a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake
deleted file mode 100644
index 7210e7d..0000000
--- a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(CPACK_COMPONENTS_ALL test)
-install(DIRECTORY DESTINATION empty
- COMPONENT test)
-
-set(CPACK_PACKAGE_NAME "components_empty_dir")
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
index 7e6b4b1..89da610 100644
--- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake
+++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
@@ -1,6 +1,6 @@
cmake_policy(SET CMP0057 NEW)
-function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
+function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE)
if(TEST_TYPE IN_LIST types)
set(RunCMake_TEST_NO_CLEAN TRUE)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
@@ -11,16 +11,17 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
set(full_test_name_ "${full_test_name_}-${SUBTEST_SUFFIX}-subtest")
endif()
+ string(APPEND full_test_name_ "-${PACKAGING_TYPE}-type")
+
# 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}")
- if(EXISTS "${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-Prerequirements.cmake")
- include("${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-Prerequirements.cmake")
+ if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake")
+ include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-Prerequirements.cmake")
set(FOUND_PREREQUIREMENTS false)
- get_test_prerequirements("FOUND_PREREQUIREMENTS"
- "${TEST_CONFIG_DIR}/${type}_config.cmake")
+ get_test_prerequirements("FOUND_PREREQUIREMENTS" "${config_file}")
# skip the test if prerequirements are not met
if(NOT FOUND_PREREQUIREMENTS)
@@ -32,7 +33,8 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
# execute cmake
set(RunCMake_TEST_OPTIONS "-DGENERATOR_TYPE=${TEST_TYPE}"
"-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}"
- "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}")
+ "-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}"
+ "-DPACKAGING_TYPE=${PACKAGING_TYPE}")
run_cmake(${full_test_name_})
# execute optional build step
@@ -43,7 +45,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
if(source)
set(pack_params_ -G ${TEST_TYPE} --config ./CPackSourceConfig.cmake)
FILE(APPEND ${RunCMake_TEST_BINARY_DIR}/CPackSourceConfig.cmake
- "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_}\ -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME}\")")
+ "\nset(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS \"-DRunCMake_TEST:STRING=${full_test_name_} -DRunCMake_TEST_FILE_PREFIX:STRING=${TEST_NAME} -DGENERATOR_TYPE:STRING=${TEST_TYPE}\")")
else()
unset(pack_params_)
endif()
@@ -58,10 +60,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
)
foreach(o out err)
- if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-${SUBTEST_SUFFIX}-std${o}.txt)
- set(RunCMake-std${o}-file "${TEST_TYPE}/${TEST_NAME}-${SUBTEST_SUFFIX}-std${o}.txt")
- elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/${TEST_NAME}-std${o}.txt)
- set(RunCMake-std${o}-file "${TEST_TYPE}/${TEST_NAME}-std${o}.txt")
+ if(SUBTEST_SUFFIX AND EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt)
+ set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-${SUBTEST_SUFFIX}-std${o}.txt")
+ elseif(EXISTS ${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt)
+ set(RunCMake-std${o}-file "tests/${TEST_NAME}/${TEST_TYPE}-std${o}.txt")
+ elseif(EXISTS ${RunCMake_SOURCE_DIR}/${TEST_TYPE}/default_expected_std${o}.txt)
+ set(RunCMake-std${o}-file "${TEST_TYPE}/default_expected_std${o}.txt")
endif()
endforeach()
@@ -73,6 +77,7 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
-DRunCMake_TEST_FILE_PREFIX=${TEST_NAME}
-DRunCMake_SUBTEST_SUFFIX=${SUBTEST_SUFFIX}
-DGENERATOR_TYPE=${TEST_TYPE}
+ -DPACKAGING_TYPE=${PACKAGING_TYPE}
"-Dsrc_dir=${RunCMake_SOURCE_DIR}"
"-Dbin_dir=${RunCMake_TEST_BINARY_DIR}"
"-Dconfig_file=${config_file}"
@@ -81,16 +86,20 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source)
endif()
endfunction()
-function(run_cpack_test TEST_NAME types build)
- run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false)
-endfunction()
-
-function(run_cpack_source_test TEST_NAME types build)
- run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" true)
+function(run_cpack_test TEST_NAME types build PACKAGING_TYPES)
+ foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}")
+ endforeach()
endfunction()
-function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build)
+function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES)
foreach(suffix_ IN LISTS SUBTEST_SUFFIXES)
- run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false)
+ foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}")
+ endforeach()
endforeach()
endfunction()
+
+function(run_cpack_source_test TEST_NAME types)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "")
+endfunction()
diff --git a/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake b/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake
deleted file mode 100644
index c89df89..0000000
--- a/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
-install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
-install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2)
-install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3)
-
-set(CPACK_PACKAGE_NAME "custom_names")
diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
deleted file mode 100644
index 62f2f9c..0000000
--- a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "components_empty_dir-test_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$")
diff --git a/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake
deleted file mode 100644
index 2acf45b..0000000
--- a/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-ExpectedFiles.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "3")
-set(EXPECTED_FILE_1 "custom_names-pkg_1_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_2 "second*.deb")
-set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_3 "pkg_3_abc.deb")
-set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake b/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake
deleted file mode 100644
index c64f161..0000000
--- a/Tests/RunCMake/CPack/DEB/CUSTOM_NAMES-specifics.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEB_COMPONENT_INSTALL "ON")
-
-set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
-set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second")
-set(CPACK_DEBIAN_PKG_3_FILE_NAME "pkg_3_abc.deb")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake
deleted file mode 100644
index 4531a34..0000000
--- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-ExpectedFiles.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "3")
-set(EXPECTED_FILE_1 "deb_extra-foo_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_2 "deb_extra-bar_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_2 "^.*/usr/${whitespaces_}.*/usr/bar/${whitespaces_}.*/usr/bar/CMakeLists.txt$")
-set(EXPECTED_FILE_3 "deb_extra-bas_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_3 "^.*/usr/${whitespaces_}.*/usr/bas/${whitespaces_}.*/usr/bas/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake
deleted file mode 100644
index b98065a..0000000
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-Prerequirements.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-function(get_test_prerequirements found_var)
- find_program(READELF_EXECUTABLE NAMES readelf)
-
- if(READELF_EXECUTABLE)
- set(${found_var} true PARENT_SCOPE)
- endif()
-endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake
deleted file mode 100644
index b98065a..0000000
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-Prerequirements.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-function(get_test_prerequirements found_var)
- find_program(READELF_EXECUTABLE NAMES readelf)
-
- if(READELF_EXECUTABLE)
- set(${found_var} true PARENT_SCOPE)
- endif()
-endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake
deleted file mode 100644
index a6f08fe..0000000
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-ExpectedFiles.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "5")
-set(EXPECTED_FILE_1 "dependencies-0.1.1-*-applications.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/test_prog$")
-set(EXPECTED_FILE_2 "dependencies-0.1.1-*-applications_auto.deb")
-set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo_auto${whitespaces_}.*/usr/foo_auto/test_prog$")
-set(EXPECTED_FILE_3 "dependencies-0.1.1-*-headers.deb")
-set(EXPECTED_FILE_CONTENT_3 "^.*/usr/bar${whitespaces_}.*/usr/bar/CMakeLists.txt$")
-set(EXPECTED_FILE_4 "dependencies-0.1.1-*-libs.deb")
-# dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it
-set(EXPECTED_FILE_CONTENT_4 "^.*/usr/bas${whitespaces_}.*/usr/bas/libtest_lib\\..*$")
-set(EXPECTED_FILE_5 "dependencies-0.1.1-*-libs_auto.deb")
-set(EXPECTED_FILE_CONTENT_5 "^.*/usr/bas_auto${whitespaces_}.*/usr/bas_auto/libtest_lib\\..*$")
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake
deleted file mode 100644
index ba39f2e..0000000
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-VerifyResult.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-function(checkDependencies_ FILE REGEX)
- set(whitespaces_ "[\t\n\r ]*")
-
- getPackageInfo("${FILE}" "FILE_INFO_")
- if(NOT FILE_INFO_ MATCHES "${REGEX}")
- message(FATAL_ERROR "Unexpected dependencies in '${FILE}'; file info: '${FILE_INFO_}'")
- endif()
-endfunction()
-
-foreach(dependency_type_ DEPENDS CONFLICTS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
- string(TOLOWER "${dependency_type_}" lower_dependency_type_)
- string(SUBSTRING ${lower_dependency_type_} 1 -1 lower_dependency_type_tail_)
- string(SUBSTRING ${dependency_type_} 0 1 dependency_type_head_)
- set(dependency_type_name_ "${dependency_type_head_}${lower_dependency_type_tail_}")
-
- checkDependencies_("${FOUND_FILE_1}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
- checkDependencies_("${FOUND_FILE_2}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}.*${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
- checkDependencies_("${FOUND_FILE_3}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-headers.*")
- checkDependencies_("${FOUND_FILE_4}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
- checkDependencies_("${FOUND_FILE_5}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
-endforeach()
-
-checkDependencies_("${FOUND_FILE_1}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
-checkDependencies_("${FOUND_FILE_2}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
-checkDependencies_("${FOUND_FILE_3}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
-checkDependencies_("${FOUND_FILE_4}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib.*")
-checkDependencies_("${FOUND_FILE_5}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib_auto.*, provided-lib_auto-b.*")
-
-# PREDEPENDS
-checkDependencies_("${FOUND_FILE_1}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-application, predepends-application-b.*")
-checkDependencies_("${FOUND_FILE_2}" ".*Pre-Depends${whitespaces_}:${whitespaces_}.*predepends-application, predepends-application-b.*")
-checkDependencies_("${FOUND_FILE_3}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-headers.*")
-checkDependencies_("${FOUND_FILE_4}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
-checkDependencies_("${FOUND_FILE_5}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
diff --git a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
deleted file mode 100644
index 5f82cc6..0000000
--- a/Tests/RunCMake/CPack/DEB/DEPENDENCIES-specifics.cmake
+++ /dev/null
@@ -1,23 +0,0 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEB_COMPONENT_INSTALL "ON")
-#intentionaly commented out to test old file naming
-#set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
-
-# false by default
-set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE)
-# FIXME can not be tested as libraries first have to be part of a package in order
-# to determine their dependencies and we can not be certain if there will be any
-set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE)
-
-foreach(dependency_type_ DEPENDS CONFLICTS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
- string(TOLOWER "${dependency_type_}" lower_dependency_type_)
-
- set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b")
- set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
- set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
- set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers")
-endforeach()
-
-set(CPACK_DEBIAN_PACKAGE_PROVIDES "provided-default, provided-default-b")
-set(CPACK_DEBIAN_LIBS_PACKAGE_PROVIDES "provided-lib")
-set(CPACK_DEBIAN_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake
deleted file mode 100644
index 6dc5906..0000000
--- a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "empty_dir_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/empty/$")
diff --git a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
deleted file mode 100644
index 4e9a2e7..0000000
--- a/Tests/RunCMake/CPack/DEB/EMPTY_DIR-specifics.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index 9b1be22..ad1b47b 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -9,6 +9,47 @@ function(getPackageContent FILE RESULT_VAR)
set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
endfunction()
+function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR)
+ if(COMPONENT)
+ set(COMPONENT "-${COMPONENT}")
+ endif()
+
+ if(DEFINED EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT)
+ set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT}")
+ elseif(DEFINED EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT)
+ set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT}")
+ else()
+ set(GENERATOR_SPECIFIC_FORMAT FALSE)
+ endif()
+
+ if(GENERATOR_SPECIFIC_FORMAT)
+ set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}-${REVISION}_*.deb" PARENT_SCOPE)
+ else()
+ set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.deb" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(getPackageContentList FILE RESULT_VAR)
+ execute_process(COMMAND ${DPKG_EXECUTABLE} -c "${FILE}"
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ unset(items_)
+ string(REPLACE "\n" ";" package_content_ "${package_content_}")
+ foreach(i_ IN LISTS package_content_)
+ string(REGEX REPLACE "^.* \.(/[^$]*)$" "\\1" result_ "${i_}")
+ string(REGEX REPLACE "/$" "" result_ "${result_}")
+ list(APPEND items_ "${result_}")
+ endforeach()
+
+ set(${RESULT_VAR} "${items_}" PARENT_SCOPE)
+endfunction()
+
+function(toExpectedContentList FILE_NO CONTENT_VAR)
+ # no need to do anything
+endfunction()
+
function(getMissingShlibsErrorExtra FILE RESULT_VAR)
execute_process(COMMAND ${DPKG_EXECUTABLE} -x "${FILE}" data_${PREFIX}
ERROR_VARIABLE err_)
@@ -43,8 +84,6 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
string(APPEND error_extra "; errors \"${deb_install_files_errors}\"")
endif()
- find_program(READELF_EXECUTABLE NAMES readelf)
-
if(READELF_EXECUTABLE)
string(APPEND error_extra "; readelf \"\n")
diff --git a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-ExpectedFiles.cmake
deleted file mode 100644
index dd72cf7..0000000
--- a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "long_filenames_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/${whitespaces_}.*/usr/foo/${whitespaces_}.*/usr/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-Prerequirements.cmake
deleted file mode 100644
index 0c1d77e..0000000
--- a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-Prerequirements.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-function(get_test_prerequirements found_var)
- find_program(FAKEROOT_EXECUTABLE NAMES fakeroot)
-
- if(FAKEROOT_EXECUTABLE)
- set(${found_var} true PARENT_SCOPE)
- endif()
-endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-specifics.cmake b/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-specifics.cmake
deleted file mode 100644
index 39a6be4..0000000
--- a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-specifics.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
-set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
diff --git a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake
deleted file mode 100644
index 648c866..0000000
--- a/Tests/RunCMake/CPack/DEB/MINIMAL-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "minimal_0.1.1-1_*.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
deleted file mode 100644
index 4e9a2e7..0000000
--- a/Tests/RunCMake/CPack/DEB/MINIMAL-specifics.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake
deleted file mode 100644
index 40f6730..0000000
--- a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "3")
-set(EXPECTED_FILE_1 "per_component-pkg_1_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_2 "second_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_3 "per_component-pkg_3_0.1.1-1_*.deb")
-set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake
deleted file mode 100644
index 55293be..0000000
--- a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-function(checkPackageInfo_ TYPE FILE REGEX)
- set(whitespaces_ "[\t\n\r ]*")
-
- getPackageInfo("${FILE}" "FILE_INFO_")
- if(NOT FILE_INFO_ MATCHES "${REGEX}")
- message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
- endif()
-endfunction()
-
-# check package name
-checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_1")
-checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Package${whitespaces_}:${whitespaces_}second")
-checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_3")
-
-# check package group
-checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Section${whitespaces_}:${whitespaces_}default")
-checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Section${whitespaces_}:${whitespaces_}second_group")
-checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Section${whitespaces_}:${whitespaces_}default")
diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake
deleted file mode 100644
index 25bd2e7..0000000
--- a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEB_COMPONENT_INSTALL "ON")
-set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
-
-set(CPACK_DEBIAN_PACKAGE_SECTION "default")
-set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second")
-set(CPACK_DEBIAN_PKG_2_PACKAGE_SECTION "second_group")
diff --git a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
index cb9a277..60d02e7 100644
--- a/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/DEB/Prerequirements.cmake
@@ -12,4 +12,11 @@ function(get_test_prerequirements found_var config_file)
file(APPEND "${config_file}"
"\nset(FAKEROOT_EXECUTABLE \"${FAKEROOT_EXECUTABLE}\")")
endif()
+
+ # optional tool for some tests
+ find_program(READELF_EXECUTABLE NAMES readelf)
+ if(READELF_EXECUTABLE)
+ file(APPEND "${config_file}"
+ "\nset(READELF_EXECUTABLE \"${READELF_EXECUTABLE}\")")
+ endif()
endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/DEB/packaging_COMPONENT_default.cmake
index 4b4ac8d..4219b0c 100644
--- a/Tests/RunCMake/CPack/DEB/COMPONENTS_EMPTY_DIR-specifics.cmake
+++ b/Tests/RunCMake/CPack/DEB/packaging_COMPONENT_default.cmake
@@ -1,3 +1,2 @@
-set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEB_COMPONENT_INSTALL "ON")
-set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
+set(CPACK_PACKAGE_CONTACT "someone")
diff --git a/Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake b/Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake
new file mode 100644
index 0000000..8821ab9
--- /dev/null
+++ b/Tests/RunCMake/CPack/DEB/packaging_MONOLITHIC_default.cmake
@@ -0,0 +1 @@
+set(CPACK_PACKAGE_CONTACT "someone")
diff --git a/Tests/RunCMake/CPack/DEPENDENCIES.cmake b/Tests/RunCMake/CPack/DEPENDENCIES.cmake
deleted file mode 100644
index 4f6d65f..0000000
--- a/Tests/RunCMake/CPack/DEPENDENCIES.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
-
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
- "int test_lib();\n")
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp"
- "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n")
-add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
-
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
- "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n")
-add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
-target_link_libraries(test_prog test_lib)
-
-install(TARGETS test_prog DESTINATION foo COMPONENT applications)
-install(TARGETS test_prog DESTINATION foo_auto COMPONENT applications_auto)
-install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
-install(TARGETS test_lib DESTINATION bas COMPONENT libs)
-install(TARGETS test_lib DESTINATION bas_auto COMPONENT libs_auto)
-
-set(CPACK_PACKAGE_NAME "dependencies")
diff --git a/Tests/RunCMake/CPack/EMPTY_DIR.cmake b/Tests/RunCMake/CPack/EMPTY_DIR.cmake
deleted file mode 100644
index 023ba17..0000000
--- a/Tests/RunCMake/CPack/EMPTY_DIR.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-install(DIRECTORY DESTINATION empty
- COMPONENT test)
-
-set(CPACK_PACKAGE_NAME "empty_dir")
diff --git a/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake b/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake
deleted file mode 100644
index bb42cf4..0000000
--- a/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
-install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2)
-install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3)
-
-set(CPACK_PACKAGE_NAME "per_component")
diff --git a/Tests/RunCMake/CPack/README.txt b/Tests/RunCMake/CPack/README.txt
index 5c86880..f51d254 100644
--- a/Tests/RunCMake/CPack/README.txt
+++ b/Tests/RunCMake/CPack/README.txt
@@ -1,41 +1,75 @@
RunCMake.CPack is a test module that is intended for testing of package
generators that can be validated from command line.
-TODO: all tests should cover all packaging types (single package, grouped and
- component packaging)
-
-------------
Adding a test
-------------
-CPack test root directory: 'Tests/RunCMake/CPack'.
+CPack test root directory: 'Tests/RunCMake/CPack/tests'.
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>")
+run_cpack_test(<test_name> "<generator_name_list>" <compile_stage>
+ "<packaging_type_list>")
+
+<generator_name_list> may be one generator e.g. "RPM" or multiple e.g. "RPM;DEB"
+and will be run for all listed generators. In test and verification scripts
+current generator can be accessed through GENERATOR_TYPE variable.
+
+<compile_stage> is a boolean variable that enables or disables compile stage -
+most tests don't require compilation as a non binary file can be used for
+package content but sometimes an executable or a library has to be created
+before the packaging stage.
-<generator_name> may be one generator e.g. "RPM" or multiple e.g. "RPM;DEB" and
-will be run for all listed generators.
+<packaging_type_list> can be a list of one or more packaging types: MONOLITHIC,
+COMPONENT or GROUP - each type sets per generator default variables which can
+be overwritten in the test if needed
+(see <generator_type>/packaging_<packaging_type>_default.cmake for the variables
+that are set by default for each packaging type).
+Alternatively CUSTOM value can be set which means that default values will not
+be set and that values will be set manually in the test itself.
+
+Alternatively a test with subtests can be added:
+run_cpack_test_subtests(<test_name> "<subtests_list>" "<generator_name_list>"
+ <compile_stage> "<packaging_type_list>")
+
+<subtests_list> is the only new parameter and it is a list of names that will
+be used for subtests. In test and verification scripts subtest name can be
+accessed through RunCMake_SUBTEST_SUFFIX variable.
+
+Also source package tests can be added:
+run_cpack_source_test(<test_name> "<generator_name_list>" true)
Test consists of
- test prerequirements phase (optional)
- CMake execution phase
+- build phase (optional and not available for source package tests)
- CPack execution phase
- verification of generated files
+The phases are executed once per specified generator, packaging type and subtest
+combinatiion.
+
test prerequirements phase (optional):
--------------------------------------
In some cases individual tests for certain generator need additional
prerequirements met.
-In such cases '<generator_name>/<test_name>-Prerequirements.cmake' file
-containing 'function(get_test_prerequirements found_var)' should be created.
-Function should return true if all prerequirements are met.
+In such cases '<test_name>/<generator_name>-Prerequirements.cmake' file
+containing 'function(get_test_prerequirements found_var config_file)' should be
+created. Function should return true in found_var if all prerequirements are
+met. config_file variable contains the location of config file generated by the
+generator so that this function can check if prerequired variable is set in the
+file.
+NOTE: All required programs should be searched for in generator prerequirements
+function and only checked for the variable in configure file in per test
+function.
If prerequirements are not met test will be skipped outputting
'<test_name> - SKIPPED' string. Note that this doesn't fail the entire test
@@ -48,15 +82,21 @@ TODO: skipped tests should provide expected error string so test should fail
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.
+To add a new CPack test we first create a '<test_name>/test.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.
If test will be used for multiple generators but some of them require some
-generator specific 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.
+generator specific commands then those commands should be added to 'test.cmake'
+script wrapped with 'if(GENERATOR_TYPE STREQUAL <name_of_the_generator>)'.
+
+build phase (optional and not available for source package tests)
+-----------------------------------------------------------------
+
+This phase only runs make command.
+
+NOTE: By default all tests have CMAKE_BUILD_TYPE variable set to Debug.
CPack execution phase:
----------------------
@@ -64,6 +104,8 @@ CPack execution phase:
Only executes CPack for content that was generated during CMake execution
phase.
+NOTE: By default CPACK_PACKAGE_NAME variable is set to lower case test name.
+
Verification of generated files:
--------------------------------
@@ -76,24 +118,49 @@ 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
+CMake script '<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
+ and should be present once for each expected file.
+ NOTE: This variable should be used only as last resort as it sets generator
+ specific globbing expression. Each generator can recreate file name from
+ parts that are already populated by default but can always be
+ overwritten if needed:
+ - EXPECTED_FILE_<file_number_starting_with_1>_NAME is the name component of
+ the file (by default it is set to package name that is same as test name
+ in lowercase)
+ - EXPECTED_FILE_<file_number_starting_with_1>_VERSION is the version of the
+ package (by default it is set to '0.1.1')
+ - EXPECTED_FILE_<file_number_starting_with_1>_REVISION is the revision of the
+ package (by default it is set to '1')
+
- 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
+ NOTE: This variable should be used only as last resort as it sets generator
+ specific regular expression.
+ EXPECTED_FILE_CONTENT_<file_number_starting_with_1>_LIST should be
+ prefered as it requires a list of expected files and directories that
+ is later changed automatically depending on the generator so expected
+ package content can be written only once per test for all generators.
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.
+This phase is executed if '<test_name>/VerifyResult.cmake' script exists.
+
+VerifyResult.cmake script also automatically prints out standard output and
+standard error from CPack execution phase that is compared with
+'<test_name>/<generator_name>-stdout.txt' regular expression and
+and '<test_name>/<generator_name>-stderr.txt' regular expresson respectively.
+NOTE: For subtests generator name can also be suffixed with subtest name and in
+ such case subtest file is preferred.
+ File name format: '<generator_name>-<subtest_name>-std<type>.txt' where
+ <type> can either be 'out' or 'err'.
+NOTE: If none of the comparison files are present then the default generator
+ file is used if present.
----------------------
Adding a new generator
@@ -101,13 +168,44 @@ 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)
+ directory that contains 'Helpers.cmake' script.
+ - In this script some functions must exist:
+ - getPackageContent: This function should list files that are contained in
+ a package.
+ Function 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)
+ - getPackageNameGlobexpr: This function should generate package name
+ globbing expression.
+ Function parameters:
+ + NAME that will contain the expected package name
+ + COMPONENT that will contain the expected package component
+ + VERSION that will contain the expected package version
+ + REVISION that will contain the expected package revision number
+ + FILE_NO that will contain the file number for which the globbing
+ expression is generated
+ + RESULT_VAR that will tell the function which variable in parent scope
+ should contain the result (file name globbing expression)
+ - getPackageContentList: This function should return a list of files and
+ directories that are in the provided package.
+ Function parameters:
+ + FILE that will contain the package file for which the package content
+ should be returned.
+ + RESULT_VAR that will tell the function which variable in parent scope
+ should contain the result (list of pacakge content)
+ - toExpectedContentList: This function should convert an expected package
+ content list into one that is expected for the
+ generator (e.g. rpm packages have install/relocate
+ path prefixes which aren't part of the package so
+ those paths have to be removed from the expected
+ content list).
+ Function parameters:
+ + FILE_NO that will contain the file number for which the conversion
+ should be performed
+ + CONTENT_VAR that will contain the input list and is also the variable
+ in parent scope which should contain the result (converted content list)
- 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)
@@ -119,3 +217,9 @@ To add a new generator we must
- 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
+- if needed add 'packaging_<packaging_type>_default.cmake' scripts that define
+ default variables that will be set for each packaging type (MONOLITHIC,
+ COMPONENT and GROUP)
+- if needed add 'default_expected_std<type>.txt' files where <type> is either
+ 'out' or 'err' which will contain default expected output of package
+ generation regular expression.
diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
deleted file mode 100644
index d396276..0000000
--- a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "components_empty_dir*.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$")
diff --git a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt
deleted file mode 100644
index 6ddca12..0000000
--- a/Tests/RunCMake/CPack/RPM/COMPONENTS_EMPTY_DIR-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/COMPONENTS_EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/components_empty_dir.spec$
diff --git a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake
deleted file mode 100644
index 780e57e..0000000
--- a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-ExpectedFiles.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "3")
-set(EXPECTED_FILE_1 "custom_names-pkg_1*.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_2 "second*.rpm")
-set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_3 "pkg_3_abc.rpm")
-set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake
deleted file mode 100644
index 575aa01..0000000
--- a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-specifics.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
-set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
-set(CPACK_RPM_PKG_2_PACKAGE_NAME "second")
-set(CPACK_RPM_PKG_3_FILE_NAME "pkg_3_abc.rpm")
diff --git a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt b/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt
deleted file mode 100644
index 9bfba7e..0000000
--- a/Tests/RunCMake/CPack/RPM/CUSTOM_NAMES-stderr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_1.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/second.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/CUSTOM_NAMES-build/_CPack_Packages/.*/RPM/SPECS/custom_names-pkg_3.spec$
diff --git a/Tests/RunCMake/CPack/RPM/DEBUGINFO-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/DEBUGINFO-ExpectedFiles.cmake
deleted file mode 100644
index a583e32..0000000
--- a/Tests/RunCMake/CPack/RPM/DEBUGINFO-ExpectedFiles.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "5")
-set(EXPECTED_FILE_1 "debuginfo-applications-0*.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
-set(EXPECTED_FILE_2 "debuginfo*-headers.rpm")
-set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
-set(EXPECTED_FILE_3 "debuginfo*-libs.rpm")
-set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$")
-
-set(EXPECTED_FILE_4 "debuginfo-applications-debuginfo*.rpm")
-set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
-set(EXPECTED_FILE_5 "debuginfo-libs-debuginfo*.rpm")
-set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*")
diff --git a/Tests/RunCMake/CPack/RPM/DEBUGINFO-stderr.txt b/Tests/RunCMake/CPack/RPM/DEBUGINFO-stderr.txt
deleted file mode 100644
index 557ef3d..0000000
--- a/Tests/RunCMake/CPack/RPM/DEBUGINFO-stderr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/DEBUGINFO-build/_CPack_Packages/.*/RPM/SPECS/debuginfo-applications.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/DEBUGINFO-build/_CPack_Packages/.*/RPM/SPECS/debuginfo-headers.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/DEBUGINFO-build/_CPack_Packages/.*/RPM/SPECS/debuginfo-libs.spec$
diff --git a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-ExpectedFiles.cmake
deleted file mode 100644
index cf85dab..0000000
--- a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-ExpectedFiles.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "5")
-set(EXPECTED_FILE_1 "dependencies*-applications.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
-set(EXPECTED_FILE_2 "dependencies*-applications_auto.rpm")
-set(EXPECTED_FILE_CONTENT_2 "^/usr/foo_auto${whitespaces_}/usr/foo_auto/test_prog$")
-set(EXPECTED_FILE_3 "dependencies*-headers.rpm")
-set(EXPECTED_FILE_CONTENT_3 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
-set(EXPECTED_FILE_4 "dependencies*-libs.rpm")
-set(EXPECTED_FILE_CONTENT_4 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$")
-set(EXPECTED_FILE_5 "dependencies*-libs_auto.rpm")
-set(EXPECTED_FILE_CONTENT_5 "^/usr/bas_auto${whitespaces_}/usr/bas_auto/libtest_lib.so$")
diff --git a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-VerifyResult.cmake
deleted file mode 100644
index fec8889..0000000
--- a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-VerifyResult.cmake
+++ /dev/null
@@ -1,45 +0,0 @@
-function(checkDependencies_ FILE TYPE COMPARE_LIST)
- set(whitespaces_ "[\t\n\r ]*")
-
- execute_process(COMMAND ${RPM_EXECUTABLE} -qp --${TYPE} ${FILE}
- WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
- OUTPUT_VARIABLE FILE_DEPENDENCIES_
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- string(REPLACE "\n" ";" FILE_DEPENDENCIES_LIST_ "${FILE_DEPENDENCIES_}")
-
- foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST)
- unset(FOUND_)
-
- foreach(COMPARE_ IN LISTS FILE_DEPENDENCIES_LIST_)
- if(COMPARE_ MATCHES "${COMPARE_REGEX_}")
- set(FOUND_ true)
- break()
- endif()
- endforeach()
-
- if(NOT FOUND_)
- message(FATAL_ERROR "Missing dependencies in '${FILE}'; check type: '${TYPE}'; file info: '${FILE_DEPENDENCIES_}'; missing: '${COMPARE_REGEX_}'")
- endif()
- endforeach()
-endfunction()
-
-# TODO add tests for what should not be present in lists
-checkDependencies_("${FOUND_FILE_1}" "requires" "depend-application;depend-application-b")
-checkDependencies_("${FOUND_FILE_2}" "requires" "depend-application;depend-application-b;libtest_lib\\.so.*")
-checkDependencies_("${FOUND_FILE_3}" "requires" "depend-headers")
-checkDependencies_("${FOUND_FILE_4}" "requires" "depend-default;depend-default-b")
-checkDependencies_("${FOUND_FILE_5}" "requires" "depend-default;depend-default-b")
-
-checkDependencies_("${FOUND_FILE_1}" "conflicts" "conflict-application;conflict-application-b")
-checkDependencies_("${FOUND_FILE_2}" "conflicts" "conflict-application;conflict-application-b")
-checkDependencies_("${FOUND_FILE_3}" "conflicts" "conflict-headers")
-checkDependencies_("${FOUND_FILE_4}" "conflicts" "conflict-default;conflict-default-b")
-checkDependencies_("${FOUND_FILE_5}" "conflicts" "conflict-default;conflict-default-b")
-
-checkDependencies_("${FOUND_FILE_1}" "provides" "provided-default;provided-default-b")
-checkDependencies_("${FOUND_FILE_2}" "provides" "provided-default;provided-default-b")
-checkDependencies_("${FOUND_FILE_3}" "provides" "provided-default;provided-default-b")
-checkDependencies_("${FOUND_FILE_4}" "provides" "provided-lib")
-checkDependencies_("${FOUND_FILE_5}" "provides" "provided-lib_auto;provided-lib_auto-b")
diff --git a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake b/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake
deleted file mode 100644
index 8b7fb1e..0000000
--- a/Tests/RunCMake/CPack/RPM/DEPENDENCIES-specifics.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
-# FIXME auto autoprov is not tested at the moment as Ubuntu 15.04 rpmbuild
-# does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755
-set(CPACK_RPM_PACKAGE_AUTOREQ "no")
-set(CPACK_RPM_PACKAGE_AUTOPROV "no")
-set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes")
-set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes")
-
-set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b")
-set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b")
-set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b")
-set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers")
-
-set(CPACK_RPM_PACKAGE_CONFLICTS "conflict-default, conflict-default-b")
-set(CPACK_RPM_APPLICATIONS_PACKAGE_CONFLICTS "conflict-application, conflict-application-b")
-set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflict-application, conflict-application-b")
-set(CPACK_RPM_HEADERS_PACKAGE_CONFLICTS "conflict-headers")
-
-set(CPACK_RPM_PACKAGE_PROVIDES "provided-default, provided-default-b")
-set(CPACK_RPM_LIBS_PACKAGE_PROVIDES "provided-lib")
-set(CPACK_RPM_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake
deleted file mode 100644
index 0c2977f..0000000
--- a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "empty_dir*.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/empty$")
diff --git a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt b/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt
deleted file mode 100644
index 1777aa0..0000000
--- a/Tests/RunCMake/CPack/RPM/EMPTY_DIR-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/EMPTY_DIR-build/_CPack_Packages/.*/RPM/SPECS/empty_dir.spec$
diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake
index ba77a4a..bbc358c8 100644
--- a/Tests/RunCMake/CPack/RPM/Helpers.cmake
+++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake
@@ -9,6 +9,59 @@ function(getPackageContent FILE RESULT_VAR)
set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
endfunction()
+function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR)
+ if(COMPONENT)
+ set(COMPONENT "-${COMPONENT}")
+ endif()
+
+ if(DEFINED EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT)
+ set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILE_${FILE_NO}_FILENAME_GENERATOR_SPECIFIC_FORMAT}")
+ elseif(DEFINED EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT)
+ set(GENERATOR_SPECIFIC_FORMAT "${EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT}")
+ else()
+ set(GENERATOR_SPECIFIC_FORMAT FALSE)
+ endif()
+
+ if(GENERATOR_SPECIFIC_FORMAT)
+ set(${RESULT_VAR} "${NAME}${COMPONENT}-${VERSION}-${REVISION}.*.rpm" PARENT_SCOPE)
+ else()
+ set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.rpm" PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(getPackageContentList FILE RESULT_VAR)
+ execute_process(COMMAND ${RPM_EXECUTABLE} -pql ${FILE}
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "\n" ";" package_content_ "${package_content_}")
+
+ set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
+endfunction()
+
+function(toExpectedContentList FILE_NO CONTENT_VAR)
+ if(NOT DEFINED TEST_INSTALL_PREFIX_PATHS)
+ set(TEST_INSTALL_PREFIX_PATHS "/usr")
+ endif()
+
+ unset(filtered_)
+ foreach(part_ IN LISTS ${CONTENT_VAR})
+ unset(dont_add_)
+ foreach(for_removal_ IN LISTS TEST_INSTALL_PREFIX_PATHS)
+ if(part_ STREQUAL for_removal_)
+ set(dont_add_ TRUE)
+ break()
+ endif()
+ endforeach()
+
+ if(NOT dont_add_)
+ list(APPEND filtered_ "${part_}")
+ endif()
+ endforeach()
+
+ set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE)
+endfunction()
+
function(getPackageInfo FILE RESULT_VAR)
execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE}
OUTPUT_VARIABLE info_content
diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake
deleted file mode 100644
index 033a45d..0000000
--- a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-ExpectedFiles.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "2")
-set(EXPECTED_FILE_1 "install_scripts*-foo.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_2 "install_scripts*-bar.rpm")
-set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake b/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake
deleted file mode 100644
index 4eb53c3..0000000
--- a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-specifics.cmake
+++ /dev/null
@@ -1,19 +0,0 @@
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
-set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh")
-set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh")
-set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh")
-set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh")
-
-set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh")
-set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh")
-set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh")
-set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE
- "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh")
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake
deleted file mode 100644
index 69603dd..0000000
--- a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-ExpectedFiles.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "0")
-
-if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
- set(EXPECTED_FILES_COUNT "3")
- set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm")
- set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
- set(EXPECTED_FILE_2 "main_component*-headers.rpm")
- set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
- set(EXPECTED_FILE_3 "main_component*-libs.rpm")
- set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/CMakeLists.txt$")
-endif()
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt b/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt
deleted file mode 100644
index dff163d..0000000
--- a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-found-stderr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-headers.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component-libs.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/MAIN_COMPONENT-build-found-subtest/_CPack_Packages/.*/RPM/SPECS/main_component.spec$
diff --git a/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake
deleted file mode 100644
index 800b78e..0000000
--- a/Tests/RunCMake/CPack/RPM/MINIMAL-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 7c5fb46..0000000
--- a/Tests/RunCMake/CPack/RPM/MINIMAL-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^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
deleted file mode 100644
index 4e01f7b..0000000
--- a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake
deleted file mode 100644
index 3d28d41..0000000
--- a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "3")
-set(EXPECTED_FILE_1 "per_component*-pkg_1.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_2 "per_component*-pkg_2.rpm")
-set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
-set(EXPECTED_FILE_3 "per_component*-pkg_3.rpm")
-set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake
deleted file mode 100644
index d7d4f9d..0000000
--- a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-function(checkPackageInfo_ TYPE FILE REGEX)
- set(whitespaces_ "[\t\n\r ]*")
-
- getPackageInfo("${FILE}" "FILE_INFO_")
- if(NOT FILE_INFO_ MATCHES "${REGEX}")
- message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
- endif()
-endfunction()
-
-# check package name
-checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_1")
-checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Name${whitespaces_}:${whitespaces_}second")
-checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_3")
-
-# check package group
-checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Group${whitespaces_}:${whitespaces_}default")
-checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Group${whitespaces_}:${whitespaces_}second_group")
-checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Group${whitespaces_}:${whitespaces_}default")
diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
deleted file mode 100644
index 524ef0c..0000000
--- a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
-set(CPACK_RPM_PACKAGE_GROUP "default")
-set(CPACK_RPM_PKG_2_PACKAGE_NAME "second")
-set(CPACK_RPM_PKG_2_PACKAGE_GROUP "second_group")
diff --git a/Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake
deleted file mode 100644
index 3b5a347..0000000
--- a/Tests/RunCMake/CPack/RPM/RPM_DIST-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "rpm_dist*.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake
deleted file mode 100644
index 02ebb44..0000000
--- a/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "rpm_suggests*.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt
deleted file mode 100644
index d80939f..0000000
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_components-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_components-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt
deleted file mode 100644
index 86396db..0000000
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_debuginfo-stderr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt
deleted file mode 100644
index 080c4ff..0000000
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt
deleted file mode 100644
index 665597c..0000000
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_main-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_main-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt
deleted file mode 100644
index b64b1f5..0000000
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-one_component_no_debuginfo-stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-one_component_no_debuginfo-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-applications.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt b/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt
deleted file mode 100644
index f4c1bef..0000000
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-valid-stderr.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-^CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-headers.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo-libs.spec
-CPackRPM: Will use GENERATED spec file: .*/Tests/RunCMake/RPM/CPack/SINGLE_DEBUGINFO-build-valid-subtest/_CPack_Packages/.*/RPM/SPECS/single_debuginfo.spec$
diff --git a/Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-ExpectedFiles.cmake
deleted file mode 100644
index d6811eb..0000000
--- a/Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "source_package*.src.rpm")
-set(EXPECTED_FILE_CONTENT_1 "^source_package-0.1.1.tar.gz${whitespaces_}source_package.spec$")
diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
new file mode 100644
index 0000000..4a0e4e6
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
@@ -0,0 +1 @@
+^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$
diff --git a/Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake b/Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake
new file mode 100644
index 0000000..c8b93e9
--- /dev/null
+++ b/Tests/RunCMake/CPack/RPM/packaging_COMPONENT_default.cmake
@@ -0,0 +1 @@
+set(CPACK_RPM_COMPONENT_INSTALL "ON")
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 61d4332..092fb47 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -3,23 +3,22 @@ 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;TGZ" false)
-run_cpack_source_test(SOURCE_PACKAGE "RPM" true)
-run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false)
-run_cpack_test(DEB_EXTRA "DEB" false)
-run_cpack_test(DEPENDENCIES "RPM;DEB" true)
-run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true)
-run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true)
-run_cpack_test(CUSTOM_NAMES "RPM;DEB" true)
-run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false)
-run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false)
-run_cpack_test(RPM_DIST "RPM" false)
-run_cpack_test(RPM_SUGGESTS "RPM" false)
-run_cpack_test(INSTALL_SCRIPTS "RPM" false)
-run_cpack_test(DEB_GENERATE_SHLIBS "DEB" true)
-run_cpack_test(DEB_GENERATE_SHLIBS_LDCONFIG "DEB" true)
-run_cpack_test(DEBUGINFO "RPM" true)
-run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true)
-run_cpack_test(LONG_FILENAMES "DEB" false)
-run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512;SHA3_224;SHA3_256;SHA3_384;SHA3_512" "TGZ" false)
+# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
+run_cpack_test(CUSTOM_NAMES "RPM;DEB" true "COMPONENT")
+run_cpack_test(DEBUGINFO "RPM" true "COMPONENT")
+run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT")
+run_cpack_test(DIST "RPM" false "MONOLITHIC")
+run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT")
+run_cpack_test(EXTRA "DEB" false "COMPONENT")
+run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT")
+run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT")
+run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT")
+run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC")
+run_cpack_test_subtests(MAIN_COMPONENT "invalid;found" "RPM" false "COMPONENT")
+run_cpack_test(MINIMAL "RPM;DEB;TGZ" false "MONOLITHIC")
+run_cpack_test_subtests(PACKAGE_CHECKSUM "invalid;MD5;SHA1;SHA224;SHA256;SHA384;SHA512" "TGZ" false "MONOLITHIC")
+run_cpack_test(PARTIALLY_RELOCATABLE_WARNING "RPM" false "COMPONENT")
+run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false "COMPONENT")
+run_cpack_test_subtests(SINGLE_DEBUGINFO "no_main_component;one_component;one_component_main;no_debuginfo;one_component_no_debuginfo;no_components;valid" "RPM" true "CUSTOM")
+run_cpack_source_test(SOURCE_PACKAGE "RPM")
+run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC")
diff --git a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
deleted file mode 100644
index 26e2ab0..0000000
--- a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-ExpectedFiles.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "components_empty_dir*.tar.gz")
-set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty/$")
diff --git a/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake
deleted file mode 100644
index a75514a..0000000
--- a/Tests/RunCMake/CPack/TGZ/EMPTY_DIR-ExpectedFiles.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "empty_dir*.tar.gz")
-set(EXPECTED_FILE_CONTENT_1 "^[^\n]*empty_dir-0.1.1-[^\n]*/empty/$")
diff --git a/Tests/RunCMake/CPack/TGZ/Helpers.cmake b/Tests/RunCMake/CPack/TGZ/Helpers.cmake
index f14d532..4a194c6 100644
--- a/Tests/RunCMake/CPack/TGZ/Helpers.cmake
+++ b/Tests/RunCMake/CPack/TGZ/Helpers.cmake
@@ -8,3 +8,55 @@ function(getPackageContent FILE RESULT_VAR)
set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE)
endfunction()
+
+function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR)
+ if(COMPONENT)
+ set(COMPONENT "-${COMPONENT}")
+ endif()
+
+ set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.tar.gz" PARENT_SCOPE)
+endfunction()
+
+function(getPackageContentList FILE RESULT_VAR)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar -ztf ${FILE}
+ OUTPUT_VARIABLE package_content_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE "\n" ";" package_content_ "${package_content_}")
+ foreach(i_ IN LISTS package_content_)
+ string(REGEX REPLACE "/$" "" result_ "${i_}")
+ list(APPEND items_ "${result_}")
+ endforeach()
+
+ set(${RESULT_VAR} "${items_}" PARENT_SCOPE)
+endfunction()
+
+function(toExpectedContentList FILE_NO CONTENT_VAR)
+ findExpectedFile("${FILE_NO}" "file_")
+
+ # component and monolithic packages differ for some reason by either having
+ # package filename prefix in path or not
+ if(PACKAGING_TYPE STREQUAL "MONOLITHIC")
+ get_filename_component(prefix_ "${file_}" NAME)
+ # NAME_WE removes everything after the dot and dot is in version so replace instead
+ string(REPLACE ".tar.gz" "/" prefix_ "${prefix_}")
+ else()
+ unset(prefix_)
+ endif()
+
+ if(NOT DEFINED TEST_MAIN_INSTALL_PREFIX_PATH)
+ set(TEST_MAIN_INSTALL_PREFIX_PATH "/usr")
+ endif()
+
+ unset(filtered_)
+ foreach(part_ IN LISTS ${CONTENT_VAR})
+ string(REGEX REPLACE "^${TEST_MAIN_INSTALL_PREFIX_PATH}(/|$)" "" part_ "${part_}")
+
+ if(part_)
+ list(APPEND filtered_ "${prefix_}${part_}")
+ endif()
+ endforeach()
+
+ set(${CONTENT_VAR} "${filtered_}" PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake
deleted file mode 100644
index 5c31f27..0000000
--- a/Tests/RunCMake/CPack/TGZ/MINIMAL-ExpectedFiles.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "minimal*.tar.gz")
-set(EXPECTED_FILE_CONTENT_1 "^[^\n]*minimal-0.1.1-[^\n]*/foo/\n[^\n]*minimal-0.1.1-[^\n]*/foo/CMakeLists.txt$")
diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake b/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake
deleted file mode 100644
index 205dcd8..0000000
--- a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-ExpectedFiles.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-set(whitespaces_ "[\t\n\r ]*")
-
-set(EXPECTED_FILES_COUNT "0")
-
-if (NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid")
- set(EXPECTED_FILES_COUNT "1")
- set(EXPECTED_FILE_1 "package_checksum*.tar.gz")
- set(EXPECTED_FILE_CONTENT_1 "^[^\n]*package_checksum*-[^\n]*/foo/\n[^\n]*package_checksum-[^\n]*/foo/CMakeLists.txt$")
-endif()
diff --git a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake b/Tests/RunCMake/CPack/TGZ/packaging_COMPONENT_default.cmake
index 81a5035..81a5035 100644
--- a/Tests/RunCMake/CPack/TGZ/COMPONENTS_EMPTY_DIR-specifics.cmake
+++ b/Tests/RunCMake/CPack/TGZ/packaging_COMPONENT_default.cmake
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index ad2a651..59751a7 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -1,5 +1,28 @@
cmake_minimum_required(VERSION ${CMAKE_VERSION} FATAL_ERROR)
+function(findExpectedFile FILE_NO RESULT_VAR)
+ if(NOT DEFINED EXPECTED_FILE_${FILE_NO}) # explicit file name regex was not provided - construct one from other data
+ # set defaults if parameters are not provided
+ if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_NAME)
+ string(TOLOWER "${RunCMake_TEST_FILE_PREFIX}" EXPECTED_FILE_${FILE_NO}_NAME)
+ endif()
+ if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_VERSION)
+ set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1")
+ endif()
+ if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_REVISION)
+ set(EXPECTED_FILE_${FILE_NO}_REVISION "1")
+ endif()
+
+ getPackageNameGlobexpr("${EXPECTED_FILE_${FILE_NO}_NAME}"
+ "${EXPECTED_FILE_${FILE_NO}_COMPONENT}" "${EXPECTED_FILE_${FILE_NO}_VERSION}"
+ "${EXPECTED_FILE_${FILE_NO}_REVISION}" "${FILE_NO}" "EXPECTED_FILE_${FILE_NO}")
+ endif()
+
+ file(GLOB found_file_ RELATIVE "${bin_dir}" "${EXPECTED_FILE_${FILE_NO}}")
+
+ set(${RESULT_VAR} "${found_file_}" PARENT_SCOPE)
+endfunction()
+
include("${config_file}")
include("${src_dir}/${GENERATOR_TYPE}/Helpers.cmake")
@@ -10,21 +33,38 @@ file(READ "${config_file}" config_file_content)
set(output_error_message
"\nCPack output: '${output}'\nCPack error: '${error}';\nCPack result: '${PACKAGING_RESULT}';\nconfig file: '${config_file_content}'")
-# check that expected generated files exist and contain expected content
-include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-ExpectedFiles.cmake")
+# generate default expected files data
+include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/ExpectedFiles.cmake")
+# check that expected generated files exist and contain expected content
if(NOT EXPECTED_FILES_COUNT EQUAL 0)
foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT})
- file(GLOB FOUND_FILE_${file_no_} RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}")
+ findExpectedFile("${file_no_}" "FOUND_FILE_${file_no_}")
list(APPEND foundFiles_ "${FOUND_FILE_${file_no_}}")
list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_)
if(foundFilesCount_ EQUAL 1)
unset(PACKAGE_CONTENT)
- getPackageContent("${bin_dir}/${FOUND_FILE_${file_no_}}" "PACKAGE_CONTENT")
- string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}"
- expected_content_list "${PACKAGE_CONTENT}")
+ if(DEFINED EXPECTED_FILE_CONTENT_${file_no_})
+ getPackageContent("${bin_dir}/${FOUND_FILE_${file_no_}}" "PACKAGE_CONTENT")
+
+ string(REGEX MATCH "${EXPECTED_FILE_CONTENT_${file_no_}}"
+ expected_content_list "${PACKAGE_CONTENT}")
+ else() # use content list
+ getPackageContentList("${bin_dir}/${FOUND_FILE_${file_no_}}" "PACKAGE_CONTENT")
+ set(EXPECTED_FILE_CONTENT_${file_no_} "${EXPECTED_FILE_CONTENT_${file_no_}_LIST}")
+ toExpectedContentList("${file_no_}" "EXPECTED_FILE_CONTENT_${file_no_}")
+
+ list(SORT PACKAGE_CONTENT)
+ list(SORT EXPECTED_FILE_CONTENT_${file_no_})
+
+ if(PACKAGE_CONTENT STREQUAL EXPECTED_FILE_CONTENT_${file_no_})
+ set(expected_content_list TRUE)
+ else()
+ set(expected_content_list FALSE)
+ endif()
+ endif()
if(NOT expected_content_list)
string(REPLACE "\n" "\n actual> " msg_actual "\n${PACKAGE_CONTENT}")
@@ -40,6 +80,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
"Found more than one file for file No. '${file_no_}'!"
" Found files count '${foundFilesCount_}'."
" Files: '${FOUND_FILE_${file_no_}}'"
+ " Globbing expression: '${EXPECTED_FILE_${file_no_}}'"
"${output_error_message}")
endif()
endforeach()
@@ -84,11 +125,9 @@ else()
endif()
# handle additional result verifications
-if(EXISTS "${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-VerifyResult.cmake")
- include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-VerifyResult.cmake")
-else()
- # by default only print out output and error so that they can be compared by
- # regex
- message(STATUS "${output}")
- message("${error}")
+if(EXISTS "${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/VerifyResult.cmake")
+ include("${src_dir}/tests/${RunCMake_TEST_FILE_PREFIX}/VerifyResult.cmake")
endif()
+
+message(STATUS "${output}")
+message("${error}")
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
new file mode 100644
index 0000000..ae5f0af
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
@@ -0,0 +1,12 @@
+set(EXPECTED_FILES_COUNT "3")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
+set(EXPECTED_FILE_1_COMPONENT "pkg_1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_2_NAME "second")
+set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+
+if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
+ string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
+ set(EXPECTED_FILE_3 "pkg_3_abc.${file_extension_}")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
new file mode 100644
index 0000000..0c2b37b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
@@ -0,0 +1,14 @@
+if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
+ if(GENERATOR_TYPE STREQUAL "DEB")
+ set(generator_type_suffix_ "IAN") # not entirely compatible...
+ endif()
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_FILE_NAME "${GENERATOR_TYPE}-DEFAULT")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second")
+ string(TOLOWER "${GENERATOR_TYPE}" file_extension_)
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_3_FILE_NAME "pkg_3_abc.${file_extension_}")
+endif()
+
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2)
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3)
diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake
new file mode 100644
index 0000000..06e56d3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake
@@ -0,0 +1,16 @@
+set(whitespaces_ "[\t\n\r ]*")
+
+set(EXPECTED_FILES_COUNT "5")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
+
+set(EXPECTED_FILE_1_COMPONENT "applications")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog")
+set(EXPECTED_FILE_2 "debuginfo*-headers.rpm")
+set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt")
+set(EXPECTED_FILE_3 "debuginfo*-libs.rpm")
+set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so")
+
+set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo")
+set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
+set(EXPECTED_FILE_5_COMPONENT "libs-debuginfo")
+set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*")
diff --git a/Tests/RunCMake/CPack/DEBUGINFO.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
index d98b682..0642d83 100644
--- a/Tests/RunCMake/CPack/DEBUGINFO.cmake
+++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
@@ -6,8 +6,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id")
endif()
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
set(CMAKE_BUILD_TYPE Debug)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
@@ -30,5 +28,3 @@ set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON)
set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON)
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src")
-
-set(CPACK_PACKAGE_NAME "debuginfo")
diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt
new file mode 100644
index 0000000..5df274a
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/DEB-stderr.txt
@@ -0,0 +1 @@
+^CPackDeb: ((- Generating dependency list)|(Using only user-provided dependencies because dpkg-shlibdeps is not found\.))$
diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake
new file mode 100644
index 0000000..3b280ba
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/ExpectedFiles.cmake
@@ -0,0 +1,18 @@
+set(EXPECTED_FILES_COUNT "5")
+set(EXPECTED_FILE_1_COMPONENT "applications")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog")
+set(EXPECTED_FILE_2_COMPONENT "applications_auto")
+set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo_auto;/usr/foo_auto/test_prog")
+set(EXPECTED_FILE_3_COMPONENT "headers")
+set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt")
+set(EXPECTED_FILE_4_COMPONENT "libs")
+set(EXPECTED_FILE_CONTENT_4_LIST "/usr/bas;/usr/bas/libtest_lib.so")
+set(EXPECTED_FILE_5_COMPONENT "libs_auto")
+set(EXPECTED_FILE_CONTENT_5_LIST "/usr;/usr/bas_auto;/usr/bas_auto/libtest_lib.so")
+
+if(GENERATOR_TYPE STREQUAL "DEB")
+ set(whitespaces_ "[\t\n\r ]*")
+ # dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it
+ set(EXPECTED_FILE_CONTENT_4 "^.*/usr/bas${whitespaces_}.*/usr/bas/libtest_lib\\..*$")
+ set(EXPECTED_FILE_CONTENT_5 "^.*/usr/bas_auto${whitespaces_}.*/usr/bas_auto/libtest_lib\\..*$")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake
new file mode 100644
index 0000000..7923148
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/VerifyResult.cmake
@@ -0,0 +1,82 @@
+if(GENERATOR_TYPE STREQUAL "DEB")
+ function(checkDependencies_ FILE REGEX)
+ set(whitespaces_ "[\t\n\r ]*")
+
+ getPackageInfo("${FILE}" "FILE_INFO_")
+ if(NOT FILE_INFO_ MATCHES "${REGEX}")
+ message(FATAL_ERROR "Unexpected dependencies in '${FILE}'; file info: '${FILE_INFO_}'")
+ endif()
+ endfunction()
+
+ foreach(dependency_type_ DEPENDS CONFLICTS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
+ string(TOLOWER "${dependency_type_}" lower_dependency_type_)
+ string(SUBSTRING ${lower_dependency_type_} 1 -1 lower_dependency_type_tail_)
+ string(SUBSTRING ${dependency_type_} 0 1 dependency_type_head_)
+ set(dependency_type_name_ "${dependency_type_head_}${lower_dependency_type_tail_}")
+
+ checkDependencies_("${FOUND_FILE_1}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
+ checkDependencies_("${FOUND_FILE_2}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}.*${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b.*")
+ checkDependencies_("${FOUND_FILE_3}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-headers.*")
+ checkDependencies_("${FOUND_FILE_4}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
+ checkDependencies_("${FOUND_FILE_5}" ".*${dependency_type_name_}${whitespaces_}:${whitespaces_}${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b.*")
+ endforeach()
+
+ checkDependencies_("${FOUND_FILE_1}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
+ checkDependencies_("${FOUND_FILE_2}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
+ checkDependencies_("${FOUND_FILE_3}" ".*Provides${whitespaces_}:${whitespaces_}provided-default, provided-default-b")
+ checkDependencies_("${FOUND_FILE_4}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib.*")
+ checkDependencies_("${FOUND_FILE_5}" ".*Provides${whitespaces_}:${whitespaces_}provided-lib_auto.*, provided-lib_auto-b.*")
+
+ # PREDEPENDS
+ checkDependencies_("${FOUND_FILE_1}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-application, predepends-application-b.*")
+ checkDependencies_("${FOUND_FILE_2}" ".*Pre-Depends${whitespaces_}:${whitespaces_}.*predepends-application, predepends-application-b.*")
+ checkDependencies_("${FOUND_FILE_3}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-headers.*")
+ checkDependencies_("${FOUND_FILE_4}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
+ checkDependencies_("${FOUND_FILE_5}" ".*Pre-Depends${whitespaces_}:${whitespaces_}predepends-default, predepends-default-b.*")
+elseif(GENERATOR_TYPE STREQUAL "RPM")
+ function(checkDependencies_ FILE TYPE COMPARE_LIST)
+ set(whitespaces_ "[\t\n\r ]*")
+
+ execute_process(COMMAND ${RPM_EXECUTABLE} -qp --${TYPE} ${FILE}
+ WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
+ OUTPUT_VARIABLE FILE_DEPENDENCIES_
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE "\n" ";" FILE_DEPENDENCIES_LIST_ "${FILE_DEPENDENCIES_}")
+
+ foreach(COMPARE_REGEX_ IN LISTS COMPARE_LIST)
+ unset(FOUND_)
+
+ foreach(COMPARE_ IN LISTS FILE_DEPENDENCIES_LIST_)
+ if(COMPARE_ MATCHES "${COMPARE_REGEX_}")
+ set(FOUND_ true)
+ break()
+ endif()
+ endforeach()
+
+ if(NOT FOUND_)
+ message(FATAL_ERROR "Missing dependencies in '${FILE}'; check type: '${TYPE}'; file info: '${FILE_DEPENDENCIES_}'; missing: '${COMPARE_REGEX_}'")
+ endif()
+ endforeach()
+ endfunction()
+
+ # TODO add tests for what should not be present in lists
+ checkDependencies_("${FOUND_FILE_1}" "requires" "depend-application;depend-application-b")
+ checkDependencies_("${FOUND_FILE_2}" "requires" "depend-application;depend-application-b;libtest_lib\\.so.*")
+ checkDependencies_("${FOUND_FILE_3}" "requires" "depend-headers")
+ checkDependencies_("${FOUND_FILE_4}" "requires" "depend-default;depend-default-b")
+ checkDependencies_("${FOUND_FILE_5}" "requires" "depend-default;depend-default-b")
+
+ checkDependencies_("${FOUND_FILE_1}" "conflicts" "conflicts-application;conflicts-application-b")
+ checkDependencies_("${FOUND_FILE_2}" "conflicts" "conflicts-application;conflicts-application-b")
+ checkDependencies_("${FOUND_FILE_3}" "conflicts" "conflicts-headers")
+ checkDependencies_("${FOUND_FILE_4}" "conflicts" "conflicts-default;conflicts-default-b")
+ checkDependencies_("${FOUND_FILE_5}" "conflicts" "conflicts-default;conflicts-default-b")
+
+ checkDependencies_("${FOUND_FILE_1}" "provides" "provided-default;provided-default-b")
+ checkDependencies_("${FOUND_FILE_2}" "provides" "provided-default;provided-default-b")
+ checkDependencies_("${FOUND_FILE_3}" "provides" "provided-default;provided-default-b")
+ checkDependencies_("${FOUND_FILE_4}" "provides" "provided-lib")
+ checkDependencies_("${FOUND_FILE_5}" "provides" "provided-lib_auto;provided-lib_auto-b")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake
new file mode 100644
index 0000000..fbd786e
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake
@@ -0,0 +1,60 @@
+if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
+ if(GENERATOR_TYPE STREQUAL "DEB")
+ # false by default
+ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS FALSE)
+ # FIXME can not be tested as libraries first have to be part of a package in order
+ # to determine their dependencies and we can not be certain if there will be any
+ set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_SHLIBDEPS TRUE)
+
+ foreach(dependency_type_ DEPENDS PREDEPENDS ENHANCES BREAKS REPLACES RECOMMENDS SUGGESTS)
+ string(TOLOWER "${dependency_type_}" lower_dependency_type_)
+
+ set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${lower_dependency_type_}-default, ${lower_dependency_type_}-default-b")
+ set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
+ set(CPACK_DEBIAN_APPLICATIONS_AUTO_PACKAGE_${dependency_type_} "${lower_dependency_type_}-application, ${lower_dependency_type_}-application-b")
+ set(CPACK_DEBIAN_HEADERS_PACKAGE_${dependency_type_} "${lower_dependency_type_}-headers")
+ endforeach()
+
+ set(generator_type_suffix_ "IAN") # not entirely compatible...
+ else() # RPM
+ # FIXME auto autoprov is not tested at the moment as Ubuntu 15.04 rpmbuild
+ # does not use them correctly: https://bugs.launchpad.net/rpm/+bug/1475755
+ set(CPACK_RPM_PACKAGE_AUTOREQ "no")
+ set(CPACK_RPM_PACKAGE_AUTOPROV "no")
+ set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_AUTOREQPROV "yes")
+ set(CPACK_RPM_LIBS_AUTO_PACKAGE_AUTOREQPROV "yes")
+
+ set(CPACK_RPM_PACKAGE_REQUIRES "depend-default, depend-default-b")
+ set(CPACK_RPM_APPLICATIONS_PACKAGE_REQUIRES "depend-application, depend-application-b")
+ set(CPACK_RPM_APPLICATIONS_AUTO_PACKAGE_REQUIRES "depend-application, depend-application-b")
+ set(CPACK_RPM_HEADERS_PACKAGE_REQUIRES "depend-headers")
+ endif()
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_CONFLICTS "conflicts-default, conflicts-default-b")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_APPLICATIONS_PACKAGE_CONFLICTS "conflicts-application, conflicts-application-b")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_APPLICATIONS_AUTO_PACKAGE_CONFLICTS "conflicts-application, conflicts-application-b")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_HEADERS_PACKAGE_CONFLICTS "conflicts-headers")
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_PROVIDES "provided-default, provided-default-b")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_LIBS_PACKAGE_PROVIDES "provided-lib")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_LIBS_AUTO_PACKAGE_PROVIDES "provided-lib_auto, provided-lib_auto-b")
+endif()
+
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp"
+ "int test_lib();\n")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp"
+ "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n")
+add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
+ "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n")
+add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
+target_link_libraries(test_prog test_lib)
+
+install(TARGETS test_prog DESTINATION foo COMPONENT applications)
+install(TARGETS test_prog DESTINATION foo_auto COMPONENT applications_auto)
+install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
+install(TARGETS test_lib DESTINATION bas COMPONENT libs)
+install(TARGETS test_lib DESTINATION bas_auto COMPONENT libs_auto)
diff --git a/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake
new file mode 100644
index 0000000..6142eb3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DIST/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/RPM/RPM_DIST-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake
index 7375ecc..7375ecc 100644
--- a/Tests/RunCMake/CPack/RPM/RPM_DIST-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/RPM_DIST.cmake b/Tests/RunCMake/CPack/tests/DIST/test.cmake
index eb2a123..6bdd2c0 100644
--- a/Tests/RunCMake/CPack/RPM_DIST.cmake
+++ b/Tests/RunCMake/CPack/tests/DIST/test.cmake
@@ -1,4 +1,3 @@
install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
-set(CPACK_PACKAGE_NAME "rpm_dist")
diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake
new file mode 100644
index 0000000..650687c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/ExpectedFiles.cmake
@@ -0,0 +1,7 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/empty")
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(EXPECTED_FILE_1_COMPONENT "test")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake
new file mode 100644
index 0000000..cd2c9fd
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake
@@ -0,0 +1,14 @@
+if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
+ if(GENERATOR_TYPE STREQUAL "DEB")
+ set(generator_type_suffix_ "IAN") # not entirely compatible...
+ endif()
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_FILE_NAME "${GENERATOR_TYPE}-DEFAULT")
+endif()
+
+install(DIRECTORY DESTINATION empty
+ COMPONENT test)
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL test)
+endif()
diff --git a/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake
new file mode 100644
index 0000000..ded2923
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTRA/ExpectedFiles.cmake
@@ -0,0 +1,8 @@
+set(EXPECTED_FILES_COUNT "3")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
+set(EXPECTED_FILE_1_COMPONENT "foo")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_2_COMPONENT "bar")
+set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt")
+set(EXPECTED_FILE_3_COMPONENT "bas")
+set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake
index 85e137f..85e137f 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/EXTRA/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/tests/EXTRA/test.cmake
index 189d123..efa6dac 100644
--- a/Tests/RunCMake/CPack/DEB_EXTRA.cmake
+++ b/Tests/RunCMake/CPack/tests/EXTRA/test.cmake
@@ -32,8 +32,4 @@ endforeach()
set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm")
-set(CPACK_PACKAGE_NAME "deb_extra")
-set(CPACK_PACKAGE_CONTACT "someone")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
-
-set(CPACK_DEB_COMPONENT_INSTALL ON)
diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake
new file mode 100644
index 0000000..be44b2e
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/DEB-Prerequirements.cmake
@@ -0,0 +1,7 @@
+function(get_test_prerequirements found_var config_file)
+ include(${config_file})
+
+ if(READELF_EXECUTABLE)
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/ExpectedFiles.cmake
index a8efb61..ccb5ef0 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/ExpectedFiles.cmake
@@ -1,6 +1,6 @@
set(whitespaces_ "[\t\n\r ]*")
set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "generate_shlibs_0.1.1-1_*.deb")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
# dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it
set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/libtest_lib\\..*$")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake
index b1952ef..b1952ef 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake
index 1aeb06f..90351ba 100644
--- a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake
@@ -1,5 +1,3 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEB_COMPONENT_INSTALL "ON")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON")
@@ -14,5 +12,3 @@ add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
set_target_properties(test_lib PROPERTIES SOVERSION "0.8")
install(TARGETS test_lib DESTINATION foo COMPONENT libs)
-
-set(CPACK_PACKAGE_NAME "generate_shlibs")
diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake
new file mode 100644
index 0000000..be44b2e
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/DEB-Prerequirements.cmake
@@ -0,0 +1,7 @@
+function(get_test_prerequirements found_var config_file)
+ include(${config_file})
+
+ if(READELF_EXECUTABLE)
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake
index 9a9dee3..d66c044 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/ExpectedFiles.cmake
@@ -1,6 +1,6 @@
set(whitespaces_ "[\t\n\r ]*")
set(EXPECTED_FILES_COUNT "1")
-set(EXPECTED_FILE_1 "generate_shlibs_ldconfig_0.1.1-1_*.deb")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
# dynamic lib extension is .so on Linux and .dylib on Mac so we will use a wildcard .* for it
set(EXPECTED_FILE_CONTENT_1 "^.*/usr/lib${whitespaces_}.*/usr/lib/libtest_lib\\..*$")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake
index 422cfbe..422cfbe 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake
index f58c876..15c496b 100644
--- a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake
+++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS_LDCONFIG/test.cmake
@@ -1,5 +1,3 @@
-set(CPACK_PACKAGE_CONTACT "someone")
-set(CPACK_DEB_COMPONENT_INSTALL "ON")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON")
@@ -15,5 +13,3 @@ add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp")
set_target_properties(test_lib PROPERTIES SOVERSION "0.8")
install(TARGETS test_lib LIBRARY DESTINATION lib COMPONENT libs NAMELINK_SKIP)
-
-set(CPACK_PACKAGE_NAME "generate_shlibs_ldconfig")
diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake
new file mode 100644
index 0000000..44346ab
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/ExpectedFiles.cmake
@@ -0,0 +1,5 @@
+set(EXPECTED_FILES_COUNT "2")
+set(EXPECTED_FILE_1_COMPONENT "foo")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_2_COMPONENT "bar")
+set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake
index d7d82f2..d7d82f2 100644
--- a/Tests/RunCMake/CPack/RPM/INSTALL_SCRIPTS-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake
index 13aa77b..fb1b8de 100644
--- a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake
+++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake
@@ -1,3 +1,23 @@
+if(GENERATOR_TYPE STREQUAL "RPM")
+ set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh")
+ set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh")
+ set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh")
+ set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh")
+
+ set(CPACK_RPM_foo_PRE_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh")
+ set(CPACK_RPM_foo_POST_INSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh")
+ set(CPACK_RPM_foo_PRE_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh")
+ set(CPACK_RPM_foo_POST_UNINSTALL_SCRIPT_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh")
+endif()
+
set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
# default
@@ -22,5 +42,3 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh"
install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo)
install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar)
-
-set(CPACK_PACKAGE_NAME "install_scripts")
diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/DEB-Prerequirements.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/DEB-Prerequirements.cmake
new file mode 100644
index 0000000..ddd16e5
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/DEB-Prerequirements.cmake
@@ -0,0 +1,7 @@
+function(get_test_prerequirements found_var config_file)
+ include(${config_file})
+
+ if(FAKEROOT_EXECUTABLE)
+ set(${found_var} true PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake
new file mode 100644
index 0000000..631d957
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/ExpectedFiles.cmake
@@ -0,0 +1,3 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt")
diff --git a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/VerifyResult.cmake
index 0452343..0452343 100644
--- a/Tests/RunCMake/CPack/DEB/LONG_FILENAMES-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/LONG_FILENAMES.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake
index 3242aef..f235d47 100644
--- a/Tests/RunCMake/CPack/LONG_FILENAMES.cmake
+++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake
@@ -1,3 +1,8 @@
+if(GENERATOR_TYPE STREQUAL "DEB")
+ set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
+ set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
+endif()
+
set(LONG_FILENAME
"${CMAKE_CURRENT_BINARY_DIR}/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt")
@@ -6,5 +11,3 @@ file(WRITE
"long_filename_test")
install(FILES ${LONG_FILENAME} DESTINATION foo)
-
-set(CPACK_PACKAGE_NAME "long_filenames")
diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake
new file mode 100644
index 0000000..6bfb0c1
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/ExpectedFiles.cmake
@@ -0,0 +1,11 @@
+set(EXPECTED_FILES_COUNT "0")
+
+if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "invalid")
+ set(EXPECTED_FILES_COUNT "3")
+ set(EXPECTED_FILE_1 "main_component-0.1.1-1.*.rpm")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+ set(EXPECTED_FILE_2_COMPONENT "headers")
+ set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt")
+ set(EXPECTED_FILE_3_COMPONENT "libs")
+ set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/CMakeLists.txt")
+endif()
diff --git a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/RPM-invalid-stderr.txt
index 4d8ac6e..4d8ac6e 100644
--- a/Tests/RunCMake/CPack/RPM/MAIN_COMPONENT-invalid-stderr.txt
+++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/RPM-invalid-stderr.txt
diff --git a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake
index 99c6cae..791c586 100644
--- a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake
+++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake
@@ -1,5 +1,3 @@
-set(CPACK_RPM_COMPONENT_INSTALL "ON")
-
install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications)
install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers)
install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs)
@@ -10,5 +8,3 @@ else()
set(CPACK_RPM_MAIN_COMPONENT "applications")
set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
endif()
-
-set(CPACK_PACKAGE_NAME "main_component")
diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake
new file mode 100644
index 0000000..6142eb3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/MINIMAL/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/MINIMAL.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake
index f29ad2a..83ed0f2 100644
--- a/Tests/RunCMake/CPack/MINIMAL.cmake
+++ b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake
@@ -1,3 +1 @@
install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
-
-set(CPACK_PACKAGE_NAME "minimal")
diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake
new file mode 100644
index 0000000..eed5b92
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/ExpectedFiles.cmake
@@ -0,0 +1,6 @@
+set(EXPECTED_FILES_COUNT "0")
+
+if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid")
+ set(EXPECTED_FILES_COUNT "1")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+endif()
diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/TGZ-invalid-stderr.txt
index abf6d8c..abf6d8c 100644
--- a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-invalid-stderr.txt
+++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/TGZ-invalid-stderr.txt
diff --git a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake
index e9e65d6..e4f9618 100644
--- a/Tests/RunCMake/CPack/TGZ/PACKAGE_CHECKSUM-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/VerifyResult.cmake
@@ -9,6 +9,4 @@ if(NOT ${RunCMake_SUBTEST_SUFFIX} MATCHES "invalid")
if(NOT expected_value STREQUAL CHSUM_VALUE)
message(FATAL_ERROR "Generated checksum is not valid! Expected [${expected_value}] Got [${CHSUM_VALUE}]")
endif()
-else()
- message(${error})
endif()
diff --git a/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake
index 5ca288c..0838063 100644
--- a/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake
+++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake
@@ -1,4 +1,3 @@
install(FILES CMakeLists.txt DESTINATION foo)
-set(CPACK_PACKAGE_NAME "package_checksum")
set(CPACK_PACKAGE_CHECKSUM ${RunCMake_SUBTEST_SUFFIX})
diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake
new file mode 100644
index 0000000..ae58c4b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/not_relocatable;/not_relocatable/CMakeLists.txt;/opt")
diff --git a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/RPM-stderr.txt
index 3b63d5b..3b63d5b 100644
--- a/Tests/RunCMake/CPack/RPM/PARTIALLY_RELOCATABLE_WARNING-stderr.txt
+++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/RPM-stderr.txt
diff --git a/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake
index 31e729b..4698fb3 100644
--- a/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake
+++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake
@@ -2,5 +2,3 @@ install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static)
set(CPACK_PACKAGE_RELOCATABLE TRUE)
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")
-
-set(CPACK_RPM_COMPONENT_INSTALL ON)
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake
new file mode 100644
index 0000000..9bdb176
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/ExpectedFiles.cmake
@@ -0,0 +1,8 @@
+set(EXPECTED_FILES_COUNT "3")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
+set(EXPECTED_FILE_1_COMPONENT "pkg_1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_2_NAME "second")
+set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_3_COMPONENT "pkg_3")
+set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
new file mode 100644
index 0000000..18ef63c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
@@ -0,0 +1,26 @@
+function(checkPackageInfo_ TYPE FILE REGEX)
+ getPackageInfo("${FILE}" "FILE_INFO_")
+ if(NOT FILE_INFO_ MATCHES "${REGEX}")
+ message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'")
+ endif()
+endfunction()
+
+if(GENERATOR_TYPE STREQUAL "DEB")
+ set(name_ "Package")
+ set(group_ "Section")
+elseif(GENERATOR_TYPE STREQUAL "RPM")
+ set(name_ "Name")
+ set(group_ "Group")
+endif()
+
+set(whitespaces_ "[\t\n\r ]*")
+
+# check package name
+checkPackageInfo_("name" "${FOUND_FILE_1}" ".*${name_}${whitespaces_}:${whitespaces_}per_component_fields-pkg_1")
+checkPackageInfo_("name" "${FOUND_FILE_2}" ".*${name_}${whitespaces_}:${whitespaces_}second")
+checkPackageInfo_("name" "${FOUND_FILE_3}" ".*${name_}${whitespaces_}:${whitespaces_}per_component_fields-pkg_3")
+
+# check package group
+checkPackageInfo_("group" "${FOUND_FILE_1}" ".*${group_}${whitespaces_}:${whitespaces_}default")
+checkPackageInfo_("group" "${FOUND_FILE_2}" ".*${group_}${whitespaces_}:${whitespaces_}second_group")
+checkPackageInfo_("group" "${FOUND_FILE_3}" ".*${group_}${whitespaces_}:${whitespaces_}default")
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
new file mode 100644
index 0000000..8719c0b
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
@@ -0,0 +1,18 @@
+if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
+ if(GENERATOR_TYPE STREQUAL "DEB")
+ set(generator_type_suffix_ "IAN") # not entirely compatible...
+ set(group_ "SECTION")
+ else()
+ set(group_ "GROUP")
+ endif()
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_FILE_NAME "${GENERATOR_TYPE}-DEFAULT")
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_${group_} "default")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_NAME "second")
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_${group_} "second_group")
+endif()
+
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2)
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3)
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake
index dc49343..ca866ea 100644
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake
@@ -1,29 +1,29 @@
set(whitespaces_ "[\t\n\r ]*")
-
set(EXPECTED_FILES_COUNT "0")
+set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo")
set(EXPECTED_FILES_COUNT "4")
set(EXPECTED_FILE_1 "single_debuginfo-0.1.1-1.*.rpm")
- set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog")
set(EXPECTED_FILE_2 "single_debuginfo*-headers.rpm")
- set(EXPECTED_FILE_CONTENT_2 "^/usr/bar${whitespaces_}/usr/bar/CMakeLists.txt$")
+ set(EXPECTED_FILE_CONTENT_2_LIST "/usr;/usr/bar;/usr/bar/CMakeLists.txt")
set(EXPECTED_FILE_3 "single_debuginfo*-libs.rpm")
- set(EXPECTED_FILE_CONTENT_3 "^/usr/bas${whitespaces_}/usr/bas/libtest_lib.so$")
+ set(EXPECTED_FILE_CONTENT_3_LIST "/usr;/usr/bas;/usr/bas/libtest_lib.so")
- set(EXPECTED_FILE_4 "single_debuginfo-debuginfo*.rpm")
+ set(EXPECTED_FILE_4_COMPONENT "debuginfo")
set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo")
set(EXPECTED_FILES_COUNT "2")
set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm")
- set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog")
set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components")
set(EXPECTED_FILES_COUNT "2")
set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm")
- set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/test_prog$")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/test_prog")
set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm")
set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*")
diff --git a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/RPM-no_main_component-stderr.txt
index 454283c..454283c 100644
--- a/Tests/RunCMake/CPack/RPM/SINGLE_DEBUGINFO-no_main_component-stderr.txt
+++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/RPM-no_main_component-stderr.txt
diff --git a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake
index ae4995e..60e9038 100644
--- a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake
+++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake
@@ -52,5 +52,3 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid"
endif()
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src")
-
-set(CPACK_PACKAGE_NAME "single_debuginfo")
diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake
new file mode 100644
index 0000000..0a3e426
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "source_package-0.1.1.tar.gz;source_package.spec")
diff --git a/Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/VerifyResult.cmake
index a84e296..bc54d79 100644
--- a/Tests/RunCMake/CPack/RPM/SOURCE_PACKAGE-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/VerifyResult.cmake
@@ -1,3 +1,5 @@
+set(whitespaces_ "[\t\n\r ]*")
+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_rpm")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_rpm/BUILD")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test_rpm/BUILDROOT")
diff --git a/Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake
index 946439d..359b98f 100644
--- a/Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake
+++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake
@@ -5,5 +5,3 @@ add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
install(TARGETS test_prog DESTINATION foo COMPONENT applications)
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
-
-set(CPACK_PACKAGE_NAME "source_package")
diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake
new file mode 100644
index 0000000..6142eb3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt
new file mode 100644
index 0000000..feb296c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/RPM-stderr.txt
@@ -0,0 +1 @@
+^(.*CPackRPM:Warning: SUGGESTS not supported in provided rpmbuild.*)?CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build/_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec$
diff --git a/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
index 32cc6d1..32cc6d1 100644
--- a/Tests/RunCMake/CPack/RPM/RPM_SUGGESTS-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/VerifyResult.cmake
diff --git a/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake b/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake
index e6e0c1f..dc90ae8 100644
--- a/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake
+++ b/Tests/RunCMake/CPack/tests/SUGGESTS/test.cmake
@@ -1,4 +1,3 @@
install(FILES CMakeLists.txt DESTINATION foo)
set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested")
-set(CPACK_PACKAGE_NAME "rpm_suggests")
diff --git a/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake b/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake
new file mode 100644
index 0000000..7265900
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake
@@ -0,0 +1,29 @@
+set(vcSlnFile "${RunCMake_TEST_BINARY_DIR}/AddPackageToDefault.sln")
+if(NOT EXISTS "${vcSlnFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcSlnFile} does not exist.")
+ return()
+endif()
+
+set(packageGuidFound FALSE)
+set(packageGuid "")
+set(packageInBuild FALSE)
+file(STRINGS "${vcSlnFile}" lines)
+foreach(line IN LISTS lines)
+ if(NOT packageGuidFound)
+ if(line MATCHES "^Project.*\"PACKAGE.vcx?proj\".*\"{([A-F0-9-]+)}\"$")
+ set(packageGuidFound TRUE)
+ set(packageGuid ${CMAKE_MATCH_1})
+ endif()
+ else()
+ if(line MATCHES ".*{${packageGuid}}.*")
+ if(line MATCHES "^[ \t]*{${packageGuid}}\\..*\\.Build.0 = .*$")
+ set(packageInBuild TRUE)
+ endif()
+ endif()
+ endif()
+endforeach()
+
+if(NOT packageInBuild)
+ set(RunCMake_TEST_FAILED "PACKAGE is not in default build")
+ return()
+endif()
diff --git a/Tests/RunCMake/VSSolution/AddPackageToDefault.cmake b/Tests/RunCMake/VSSolution/AddPackageToDefault.cmake
new file mode 100644
index 0000000..5f69ec5
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/AddPackageToDefault.cmake
@@ -0,0 +1,2 @@
+include(CPack)
+set(CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD TRUE)
diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
index afd74a1..4ec3e3b 100644
--- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
@@ -10,6 +10,7 @@ run_cmake(Override1)
run_cmake(Override2)
run_cmake(StartupProject)
run_cmake(StartupProjectMissing)
+run_cmake(AddPackageToDefault)
if(RunCMake_GENERATOR MATCHES "Visual Studio ([^7]|[7][0-9])" AND NOT NO_USE_FOLDERS)
run_cmake(StartupProjectUseFolders)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 522433a..4934bcd 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -18,6 +18,7 @@ run_cmake(NonSourceCompileDefinitions)
set(RunCMake_TEST_OPTIONS --debug-trycompile)
run_cmake(PlatformVariables)
+run_cmake(WarnDeprecated)
unset(RunCMake_TEST_OPTIONS)
run_cmake(TargetTypeExe)
diff --git a/Tests/RunCMake/try_compile/WarnDeprecated.cmake b/Tests/RunCMake/try_compile/WarnDeprecated.cmake
new file mode 100644
index 0000000..dfcb5f9
--- /dev/null
+++ b/Tests/RunCMake/try_compile/WarnDeprecated.cmake
@@ -0,0 +1,19 @@
+enable_language(C)
+
+set(CMAKE_WARN_DEPRECATED SOME_VALUE)
+
+try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ OUTPUT_VARIABLE out
+ )
+if(NOT result)
+ message(FATAL_ERROR "try_compile failed:\n${out}")
+endif()
+
+# Check that the cache was populated with our custom variable.
+file(STRINGS ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeCache.txt entries
+ REGEX CMAKE_WARN_DEPRECATED:UNINITIALIZED=${CMAKE_WARN_DEPRECATED}
+ )
+if(NOT entries)
+ message(FATAL_ERROR "try_compile did not populate cache as expected")
+endif()
diff --git a/Tests/RunCMake/while/EndAlone-stderr.txt b/Tests/RunCMake/while/EndAlone-stderr.txt
index cd98687..5fe6655 100644
--- a/Tests/RunCMake/while/EndAlone-stderr.txt
+++ b/Tests/RunCMake/while/EndAlone-stderr.txt
@@ -1,5 +1,5 @@
^CMake Error at EndAlone.cmake:1 \(endwhile\):
endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE
- structure.
+ structure. Or its arguments did not match the opening WHILE command.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Utilities/cmlibarchive/libarchive/CMakeLists.txt b/Utilities/cmlibarchive/libarchive/CMakeLists.txt
index 4eeb5e3..eaa7b20 100644
--- a/Utilities/cmlibarchive/libarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/libarchive/CMakeLists.txt
@@ -38,6 +38,8 @@ SET(libarchive_SOURCES
archive_hmac.c
archive_hmac_private.h
archive_match.c
+ archive_openssl_evp_private.h
+ archive_openssl_hmac_private.h
archive_options.c
archive_options_private.h
archive_pack_dev.h
diff --git a/Utilities/cmlibarchive/libarchive/archive_cryptor.c b/Utilities/cmlibarchive/libarchive/archive_cryptor.c
index 0be30c6..2a51dfe 100644
--- a/Utilities/cmlibarchive/libarchive/archive_cryptor.c
+++ b/Utilities/cmlibarchive/libarchive/archive_cryptor.c
@@ -302,6 +302,7 @@ aes_ctr_release(archive_crypto_ctx *ctx)
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
+ ctx->ctx = EVP_CIPHER_CTX_new();
switch (key_len) {
case 16: ctx->type = EVP_aes_128_ecb(); break;
@@ -314,7 +315,7 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
- EVP_CIPHER_CTX_init(&ctx->ctx);
+ EVP_CIPHER_CTX_init(ctx->ctx);
return 0;
}
@@ -324,10 +325,10 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
int outl = 0;
int r;
- r = EVP_EncryptInit_ex(&ctx->ctx, ctx->type, NULL, ctx->key, NULL);
+ r = EVP_EncryptInit_ex(ctx->ctx, ctx->type, NULL, ctx->key, NULL);
if (r == 0)
return -1;
- r = EVP_EncryptUpdate(&ctx->ctx, ctx->encr_buf, &outl, ctx->nonce,
+ r = EVP_EncryptUpdate(ctx->ctx, ctx->encr_buf, &outl, ctx->nonce,
AES_BLOCK_SIZE);
if (r == 0 || outl != AES_BLOCK_SIZE)
return -1;
@@ -337,7 +338,7 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
- EVP_CIPHER_CTX_cleanup(&ctx->ctx);
+ EVP_CIPHER_CTX_free(ctx->ctx);
memset(ctx->key, 0, ctx->key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
return 0;
diff --git a/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h b/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h
index 37eaad3..0ca544b 100644
--- a/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_cryptor_private.h
@@ -99,12 +99,12 @@ typedef struct {
} archive_crypto_ctx;
#elif defined(HAVE_LIBCRYPTO)
-#include <openssl/evp.h>
+#include "archive_openssl_evp_private.h"
#define AES_BLOCK_SIZE 16
#define AES_MAX_KEY_SIZE 32
typedef struct {
- EVP_CIPHER_CTX ctx;
+ EVP_CIPHER_CTX *ctx;
const EVP_CIPHER *type;
uint8_t key[AES_MAX_KEY_SIZE];
unsigned key_len;
diff --git a/Utilities/cmlibarchive/libarchive/archive_digest.c b/Utilities/cmlibarchive/libarchive/archive_digest.c
index f009d31..4153923 100644
--- a/Utilities/cmlibarchive/libarchive/archive_digest.c
+++ b/Utilities/cmlibarchive/libarchive/archive_digest.c
@@ -207,7 +207,9 @@ __archive_nettle_md5final(archive_md5_ctx *ctx, void *md)
static int
__archive_openssl_md5init(archive_md5_ctx *ctx)
{
- EVP_DigestInit(ctx, EVP_md5());
+ if ((*ctx = EVP_MD_CTX_new()) == NULL)
+ return (ARCHIVE_FAILED);
+ EVP_DigestInit(*ctx, EVP_md5());
return (ARCHIVE_OK);
}
@@ -215,7 +217,7 @@ static int
__archive_openssl_md5update(archive_md5_ctx *ctx, const void *indata,
size_t insize)
{
- EVP_DigestUpdate(ctx, indata, insize);
+ EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK);
}
@@ -226,8 +228,11 @@ __archive_openssl_md5final(archive_md5_ctx *ctx, void *md)
* this is meant to cope with that. Real fix is probably to fix
* archive_write_set_format_xar.c
*/
- if (ctx->digest)
- EVP_DigestFinal(ctx, md, NULL);
+ if (*ctx) {
+ EVP_DigestFinal(*ctx, md, NULL);
+ EVP_MD_CTX_free(*ctx);
+ *ctx = NULL;
+ }
return (ARCHIVE_OK);
}
@@ -359,7 +364,9 @@ __archive_nettle_ripemd160final(archive_rmd160_ctx *ctx, void *md)
static int
__archive_openssl_ripemd160init(archive_rmd160_ctx *ctx)
{
- EVP_DigestInit(ctx, EVP_ripemd160());
+ if ((*ctx = EVP_MD_CTX_new()) == NULL)
+ return (ARCHIVE_FAILED);
+ EVP_DigestInit(*ctx, EVP_ripemd160());
return (ARCHIVE_OK);
}
@@ -367,14 +374,18 @@ static int
__archive_openssl_ripemd160update(archive_rmd160_ctx *ctx, const void *indata,
size_t insize)
{
- EVP_DigestUpdate(ctx, indata, insize);
+ EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK);
}
static int
__archive_openssl_ripemd160final(archive_rmd160_ctx *ctx, void *md)
{
- EVP_DigestFinal(ctx, md, NULL);
+ if (*ctx) {
+ EVP_DigestFinal(*ctx, md, NULL);
+ EVP_MD_CTX_free(*ctx);
+ *ctx = NULL;
+ }
return (ARCHIVE_OK);
}
@@ -509,7 +520,9 @@ __archive_nettle_sha1final(archive_sha1_ctx *ctx, void *md)
static int
__archive_openssl_sha1init(archive_sha1_ctx *ctx)
{
- EVP_DigestInit(ctx, EVP_sha1());
+ if ((*ctx = EVP_MD_CTX_new()) == NULL)
+ return (ARCHIVE_FAILED);
+ EVP_DigestInit(*ctx, EVP_sha1());
return (ARCHIVE_OK);
}
@@ -517,7 +530,7 @@ static int
__archive_openssl_sha1update(archive_sha1_ctx *ctx, const void *indata,
size_t insize)
{
- EVP_DigestUpdate(ctx, indata, insize);
+ EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK);
}
@@ -528,8 +541,11 @@ __archive_openssl_sha1final(archive_sha1_ctx *ctx, void *md)
* this is meant to cope with that. Real fix is probably to fix
* archive_write_set_format_xar.c
*/
- if (ctx->digest)
- EVP_DigestFinal(ctx, md, NULL);
+ if (*ctx) {
+ EVP_DigestFinal(*ctx, md, NULL);
+ EVP_MD_CTX_free(*ctx);
+ *ctx = NULL;
+ }
return (ARCHIVE_OK);
}
@@ -733,7 +749,9 @@ __archive_nettle_sha256final(archive_sha256_ctx *ctx, void *md)
static int
__archive_openssl_sha256init(archive_sha256_ctx *ctx)
{
- EVP_DigestInit(ctx, EVP_sha256());
+ if ((*ctx = EVP_MD_CTX_new()) == NULL)
+ return (ARCHIVE_FAILED);
+ EVP_DigestInit(*ctx, EVP_sha256());
return (ARCHIVE_OK);
}
@@ -741,14 +759,18 @@ static int
__archive_openssl_sha256update(archive_sha256_ctx *ctx, const void *indata,
size_t insize)
{
- EVP_DigestUpdate(ctx, indata, insize);
+ EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK);
}
static int
__archive_openssl_sha256final(archive_sha256_ctx *ctx, void *md)
{
- EVP_DigestFinal(ctx, md, NULL);
+ if (*ctx) {
+ EVP_DigestFinal(*ctx, md, NULL);
+ EVP_MD_CTX_free(*ctx);
+ *ctx = NULL;
+ }
return (ARCHIVE_OK);
}
@@ -928,7 +950,9 @@ __archive_nettle_sha384final(archive_sha384_ctx *ctx, void *md)
static int
__archive_openssl_sha384init(archive_sha384_ctx *ctx)
{
- EVP_DigestInit(ctx, EVP_sha384());
+ if ((*ctx = EVP_MD_CTX_new()) == NULL)
+ return (ARCHIVE_FAILED);
+ EVP_DigestInit(*ctx, EVP_sha384());
return (ARCHIVE_OK);
}
@@ -936,14 +960,18 @@ static int
__archive_openssl_sha384update(archive_sha384_ctx *ctx, const void *indata,
size_t insize)
{
- EVP_DigestUpdate(ctx, indata, insize);
+ EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK);
}
static int
__archive_openssl_sha384final(archive_sha384_ctx *ctx, void *md)
{
- EVP_DigestFinal(ctx, md, NULL);
+ if (*ctx) {
+ EVP_DigestFinal(*ctx, md, NULL);
+ EVP_MD_CTX_free(*ctx);
+ *ctx = NULL;
+ }
return (ARCHIVE_OK);
}
@@ -1147,7 +1175,9 @@ __archive_nettle_sha512final(archive_sha512_ctx *ctx, void *md)
static int
__archive_openssl_sha512init(archive_sha512_ctx *ctx)
{
- EVP_DigestInit(ctx, EVP_sha512());
+ if ((*ctx = EVP_MD_CTX_new()) == NULL)
+ return (ARCHIVE_FAILED);
+ EVP_DigestInit(*ctx, EVP_sha512());
return (ARCHIVE_OK);
}
@@ -1155,14 +1185,18 @@ static int
__archive_openssl_sha512update(archive_sha512_ctx *ctx, const void *indata,
size_t insize)
{
- EVP_DigestUpdate(ctx, indata, insize);
+ EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK);
}
static int
__archive_openssl_sha512final(archive_sha512_ctx *ctx, void *md)
{
- EVP_DigestFinal(ctx, md, NULL);
+ if (*ctx) {
+ EVP_DigestFinal(*ctx, md, NULL);
+ EVP_MD_CTX_free(*ctx);
+ *ctx = NULL;
+ }
return (ARCHIVE_OK);
}
diff --git a/Utilities/cmlibarchive/libarchive/archive_digest_private.h b/Utilities/cmlibarchive/libarchive/archive_digest_private.h
index 77fad58..b58ffb3 100644
--- a/Utilities/cmlibarchive/libarchive/archive_digest_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_digest_private.h
@@ -134,7 +134,7 @@
defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
#define ARCHIVE_CRYPTO_OPENSSL 1
-#include <openssl/evp.h>
+#include "archive_openssl_evp_private.h"
#endif
/* Windows crypto headers */
@@ -161,7 +161,7 @@ typedef CC_MD5_CTX archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_NETTLE)
typedef struct md5_ctx archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL)
-typedef EVP_MD_CTX archive_md5_ctx;
+typedef EVP_MD_CTX *archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_WIN)
typedef Digest_CTX archive_md5_ctx;
#else
@@ -175,7 +175,7 @@ typedef RIPEMD160_CTX archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE)
typedef struct ripemd160_ctx archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL)
-typedef EVP_MD_CTX archive_rmd160_ctx;
+typedef EVP_MD_CTX *archive_rmd160_ctx;
#else
typedef unsigned char archive_rmd160_ctx;
#endif
@@ -189,7 +189,7 @@ typedef CC_SHA1_CTX archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE)
typedef struct sha1_ctx archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL)
-typedef EVP_MD_CTX archive_sha1_ctx;
+typedef EVP_MD_CTX *archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_WIN)
typedef Digest_CTX archive_sha1_ctx;
#else
@@ -209,7 +209,7 @@ typedef CC_SHA256_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE)
typedef struct sha256_ctx archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL)
-typedef EVP_MD_CTX archive_sha256_ctx;
+typedef EVP_MD_CTX *archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_WIN)
typedef Digest_CTX archive_sha256_ctx;
#else
@@ -227,7 +227,7 @@ typedef CC_SHA512_CTX archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE)
typedef struct sha384_ctx archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL)
-typedef EVP_MD_CTX archive_sha384_ctx;
+typedef EVP_MD_CTX *archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_WIN)
typedef Digest_CTX archive_sha384_ctx;
#else
@@ -247,7 +247,7 @@ typedef CC_SHA512_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE)
typedef struct sha512_ctx archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
-typedef EVP_MD_CTX archive_sha512_ctx;
+typedef EVP_MD_CTX *archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_WIN)
typedef Digest_CTX archive_sha512_ctx;
#else
diff --git a/Utilities/cmlibarchive/libarchive/archive_hmac.c b/Utilities/cmlibarchive/libarchive/archive_hmac.c
index 7857c0f..1e0ae28 100644
--- a/Utilities/cmlibarchive/libarchive/archive_hmac.c
+++ b/Utilities/cmlibarchive/libarchive/archive_hmac.c
@@ -176,8 +176,10 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
- HMAC_CTX_init(ctx);
- HMAC_Init(ctx, key, key_len, EVP_sha1());
+ *ctx = HMAC_CTX_new();
+ if (*ctx == NULL)
+ return -1;
+ HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL);
return 0;
}
@@ -185,22 +187,22 @@ static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
- HMAC_Update(ctx, data, data_len);
+ HMAC_Update(*ctx, data, data_len);
}
static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
unsigned int len = (unsigned int)*out_len;
- HMAC_Final(ctx, out, &len);
+ HMAC_Final(*ctx, out, &len);
*out_len = len;
}
static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
- HMAC_CTX_cleanup(ctx);
- memset(ctx, 0, sizeof(*ctx));
+ HMAC_CTX_free(*ctx);
+ *ctx = NULL;
}
#else
diff --git a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h
index 64de743..eb45c4e 100644
--- a/Utilities/cmlibarchive/libarchive/archive_hmac_private.h
+++ b/Utilities/cmlibarchive/libarchive/archive_hmac_private.h
@@ -70,9 +70,9 @@ typedef struct {
typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx;
#elif defined(HAVE_LIBCRYPTO)
-#include <openssl/hmac.h>
+#include "archive_openssl_hmac_private.h"
-typedef HMAC_CTX archive_hmac_sha1_ctx;
+typedef HMAC_CTX* archive_hmac_sha1_ctx;
#else
diff --git a/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h
new file mode 100644
index 0000000..0e97e27
--- /dev/null
+++ b/Utilities/cmlibarchive/libarchive/archive_openssl_evp_private.h
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
+#define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
+
+#include <openssl/evp.h>
+#include <openssl/opensslv.h>
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#include <stdlib.h> /* malloc, free */
+#include <string.h> /* memset */
+static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
+{
+ EVP_MD_CTX *ctx = (EVP_MD_CTX *)malloc(sizeof(EVP_MD_CTX));
+ if (ctx != NULL) {
+ memset(ctx, 0, sizeof(*ctx));
+ }
+ return ctx;
+}
+
+static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
+{
+ EVP_MD_CTX_cleanup(ctx);
+ memset(ctx, 0, sizeof(*ctx));
+ free(ctx);
+}
+#endif
+
+#endif
diff --git a/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h
new file mode 100644
index 0000000..d4ae0d1
--- /dev/null
+++ b/Utilities/cmlibarchive/libarchive/archive_openssl_hmac_private.h
@@ -0,0 +1,52 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
+#define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
+
+#include <openssl/hmac.h>
+#include <openssl/opensslv.h>
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#include <stdlib.h> /* malloc, free */
+#include <string.h> /* memset */
+static inline HMAC_CTX *HMAC_CTX_new(void)
+{
+ HMAC_CTX *ctx = (HMAC_CTX *)malloc(sizeof(HMAC_CTX));
+ if (ctx != NULL) {
+ memset(ctx, 0, sizeof(*ctx));
+ HMAC_CTX_init(ctx);
+ }
+ return ctx;
+}
+
+static inline void HMAC_CTX_free(HMAC_CTX *ctx)
+{
+ HMAC_CTX_cleanup(ctx);
+ memset(ctx, 0, sizeof(*ctx));
+ free(ctx);
+}
+#endif
+
+#endif
diff --git a/Utilities/cmlibrhash/librhash/sha256.c b/Utilities/cmlibrhash/librhash/sha256.c
index 064dfe2..af5b0fe 100644
--- a/Utilities/cmlibrhash/librhash/sha256.c
+++ b/Utilities/cmlibrhash/librhash/sha256.c
@@ -218,8 +218,8 @@ void rhash_sha256_final(sha256_ctx *ctx, unsigned char* result)
/* pad message and run for last block */
/* append the byte 0x80 to the message */
- ctx->message[index] &= le2me_32(~(0xFFFFFFFF << shift));
- ctx->message[index++] ^= le2me_32(0x80 << shift);
+ ctx->message[index] &= le2me_32(~(0xFFFFFFFFu << shift));
+ ctx->message[index++] ^= le2me_32(0x80u << shift);
/* if no room left in the message to store 64-bit message length */
if (index > 14) {
diff --git a/bootstrap b/bootstrap
index ec081fa..8063edb 100755
--- a/bootstrap
+++ b/bootstrap
@@ -277,14 +277,8 @@ CMAKE_CXX_SOURCES="\
cmDepends \
cmDependsC \
cmDocumentationFormatter \
- cmElseCommand \
cmEnableLanguageCommand \
cmEnableTestingCommand \
- cmEndForEachCommand \
- cmEndFunctionCommand \
- cmEndIfCommand \
- cmEndMacroCommand \
- cmEndWhileCommand \
cmExecProgramCommand \
cmExecuteProcessCommand \
cmExpandedCommandArgument \
@@ -406,6 +400,7 @@ CMAKE_CXX_SOURCES="\
cmTimestamp \
cmTryCompileCommand \
cmTryRunCommand \
+ cmUnexpectedCommand \
cmUnsetCommand \
cmVersion \
cmWhileCommand \