summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:13:33 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:13:33 +0900
commit48d9a397fa3cf76397824122450a1450af712716 (patch)
tree37bb17e0bcabc1da17c5606716c713de5d7d0366 /Tests
parent53666ee1cffac26c55edcbd9361dbd88a734cfa7 (diff)
downloadcmake-48d9a397fa3cf76397824122450a1450af712716.tar.gz
cmake-48d9a397fa3cf76397824122450a1450af712716.tar.bz2
cmake-48d9a397fa3cf76397824122450a1450af712716.zip
Imported Upstream version 3.13.0upstream/3.13.0
Diffstat (limited to 'Tests')
-rw-r--r--Tests/BuildDepends/CMakeLists.txt11
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt7
-rw-r--r--Tests/CMakeCommands/add_link_options/CMakeLists.txt20
-rw-r--r--Tests/CMakeCommands/add_link_options/LinkOptionsExe.c4
-rw-r--r--Tests/CMakeCommands/link_directories/CMakeLists.txt30
-rw-r--r--Tests/CMakeCommands/link_directories/LinkDirectoriesExe.c4
-rw-r--r--Tests/CMakeCommands/target_link_directories/CMakeLists.txt40
-rw-r--r--Tests/CMakeCommands/target_link_directories/LinkDirectoriesLib.c7
-rw-r--r--Tests/CMakeCommands/target_link_directories/subdir/CMakeLists.txt2
-rw-r--r--Tests/CMakeCommands/target_link_libraries/CMakeLists.txt12
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt15
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirA/SubDirA.c14
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt15
-rw-r--r--Tests/CMakeCommands/target_link_libraries/SubDirB/SubDirB.c14
-rw-r--r--Tests/CMakeCommands/target_link_libraries/TopDir.c14
-rw-r--r--Tests/CMakeCommands/target_link_options/CMakeLists.txt34
-rw-r--r--Tests/CMakeCommands/target_link_options/LinkOptionsLib.c7
-rw-r--r--Tests/CMakeCommands/target_sources/CMakeLists.txt36
-rw-r--r--Tests/CMakeCommands/target_sources/empty_1.cpp21
-rw-r--r--Tests/CMakeCommands/target_sources/empty_2.cpp7
-rw-r--r--Tests/CMakeCommands/target_sources/empty_3.cpp7
-rw-r--r--Tests/CMakeCommands/target_sources/main.cpp16
-rw-r--r--Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt6
-rw-r--r--Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp21
-rw-r--r--Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp21
-rw-r--r--Tests/CMakeLib/testRST.expect1
-rw-r--r--Tests/CMakeLib/testRST.rst1
-rw-r--r--Tests/CMakeLib/testSystemTools.cxx2
-rw-r--r--Tests/CMakeLists.txt83
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in4
-rw-r--r--Tests/CSharpOnly/CMakeLists.txt3
-rw-r--r--Tests/CSharpOnly/empty.cs0
-rw-r--r--Tests/CSharpOnly/empty.txt0
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/Complex/CMakeLists.txt2
-rw-r--r--Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt2
-rw-r--r--Tests/Cuda/MixedStandardLevels/CMakeLists.txt2
-rw-r--r--Tests/Cuda/ObjectLibrary/CMakeLists.txt2
-rw-r--r--Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt45
-rw-r--r--Tests/Cuda/ProperDeviceLibraries/main.cu (renamed from Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu)9
-rw-r--r--Tests/Cuda/ProperDeviceLibraries/use_pthreads.cu9
-rw-r--r--Tests/Cuda/ProperDeviceLibraries/use_pthreads.cxx9
-rw-r--r--Tests/Cuda/WithC/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/CircularLinkLine/CMakeLists.txt34
-rw-r--r--Tests/CudaOnly/CircularLinkLine/file1.cu6
-rw-r--r--Tests/CudaOnly/CircularLinkLine/file2.cu6
-rw-r--r--Tests/CudaOnly/CircularLinkLine/file3.cu8
-rw-r--r--Tests/CudaOnly/CircularLinkLine/main.cu5
-rw-r--r--Tests/CudaOnly/EnableStandard/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/ExportPTX/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt15
-rw-r--r--Tests/CudaOnly/PDB/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/SeparateCompilation/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt2
-rw-r--r--Tests/CustomCommandWorkingDirectory/CMakeLists.txt28
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt51
-rw-r--r--Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt6
-rw-r--r--Tests/ExportImport/Export/SubDirLinkA/SubDirLinkA.c11
-rw-r--r--Tests/ExportImport/Export/SubDirLinkB/CMakeLists.txt4
-rw-r--r--Tests/ExportImport/Export/testTopDirLib.c11
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt28
-rw-r--r--Tests/ExportImport/Import/A/SubDirLink.c14
-rw-r--r--Tests/ExportImport/Import/A/imp_testLinkOptions.cpp8
-rw-r--r--Tests/FindPackageModeMakefileTest/foo.cpp2
-rw-r--r--Tests/FindPackageModeMakefileTest/foo.h8
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt2
-rw-r--r--Tests/GoogleTest/Test/CMakeLists.txt7
-rw-r--r--Tests/GoogleTest/Test/empty.cxx0
-rw-r--r--Tests/ImportedSameName/A/CMakeLists.txt8
-rw-r--r--Tests/ImportedSameName/A/a.c3
-rw-r--r--Tests/ImportedSameName/B/CMakeLists.txt8
-rw-r--r--Tests/ImportedSameName/B/b.c3
-rw-r--r--Tests/ImportedSameName/CMakeLists.txt8
-rw-r--r--Tests/ImportedSameName/main.c16
-rw-r--r--Tests/LinkDirectory/External/CMakeLists.txt14
-rw-r--r--Tests/MathTest/CMakeLists.txt33
-rw-r--r--Tests/MathTest/MathTestExec.cxx40
-rw-r--r--Tests/OutName/CMakeLists.txt6
-rw-r--r--Tests/OutName/main.c4
-rw-r--r--Tests/QtAutogen/AutogenTest.cmake4
-rw-r--r--Tests/QtAutogen/CommonTests.cmake9
-rw-r--r--Tests/QtAutogen/DefinesTest/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocOsMacros/CMakeLists.txt32
-rw-r--r--Tests/QtAutogen/MocOsMacros/TestClass.cpp77
-rw-r--r--Tests/QtAutogen/MocOsMacros/TestClass.hpp52
-rw-r--r--Tests/QtAutogen/MocOsMacros/main.cpp32
-rw-r--r--Tests/QtAutogen/RerunMocBasic/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunRccDepends/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/SameName/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/TestMacros.cmake3
-rw-r--r--Tests/RunCMake/AndroidMK/AndroidMK.cmake6
-rw-r--r--Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt8
-rw-r--r--Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt8
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake5
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-NEW-result.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt)0
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt2
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake2
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake2
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt4
-rw-r--r--Tests/RunCMake/BundleUtilities/CMP0080-WARN.cmake1
-rw-r--r--Tests/RunCMake/BundleUtilities/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/Byproducts/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Byproducts/CleanByproducts.cmake93
-rw-r--r--Tests/RunCMake/Byproducts/RunCMakeTest.cmake58
-rw-r--r--Tests/RunCMake/Byproducts/files.cmake.in2
-rw-r--r--Tests/RunCMake/Byproducts/foo.cpp14
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0069/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-Common.cmake5
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-NEW-result.txt (renamed from Tests/RunCMake/list/SORT-TooManyArguments-result.txt)0
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-NEW.cmake4
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-OLD.cmake4
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0081/CMP0081-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0081/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0081/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0081/empty.cpp7
-rw-r--r--Tests/RunCMake/CMakeLists.txt17
-rw-r--r--Tests/RunCMake/CPack/CPackTestHelpers.cmake34
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake4
-rw-r--r--Tests/RunCMake/CPack/External/Helpers.cmake31
-rw-r--r--Tests/RunCMake/CPack/External/Prerequirements.cmake0
-rw-r--r--Tests/RunCMake/CPack/RPM/default_expected_stderr.txt2
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake10
-rw-r--r--Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake39
-rw-r--r--Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake4
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/ExpectedFiles.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/VerifyResult.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/bad_major-stderr.txt6
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/bad_minor-stderr.txt6
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake24
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt176
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/invalid_bad-stderr.txt6
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake86
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake14
-rw-r--r--Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake7
-rw-r--r--Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake58
-rw-r--r--Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake3
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt1
-rw-r--r--Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg-result.txt (renamed from Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt)0
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg2-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake14
-rw-r--r--Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake8
-rw-r--r--Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt8
-rw-r--r--Tests/RunCMake/CommandLine/NoArgs-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake77
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg2-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Wizard-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Wizard-stderr.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt7
-rw-r--r--Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake12
-rw-r--r--Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt7
-rw-r--r--Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake13
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake14
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake83
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/LinkStatic/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/LinkStatic/RunCMakeTest.cmake27
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake4
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt1
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake7
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt1
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake4
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt1
-rw-r--r--Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake21
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt10
-rw-r--r--Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt10
-rw-r--r--Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake5
-rw-r--r--Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake41
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake23
-rw-r--r--Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/RunCMake.cmake9
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake6
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt1
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt24
-rw-r--r--Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake6
-rw-r--r--Tests/RunCMake/Syntax/QueryCache-stderr.txt2
-rw-r--r--Tests/RunCMake/Syntax/QueryCache.cmake6
-rw-r--r--Tests/RunCMake/Syntax/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt2
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt (renamed from Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt)0
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-OLD.cmake10
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt21
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN.cmake8
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInInterface.cmake4
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake10
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake8
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake11
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt1
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake8
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp7
-rw-r--r--Tests/RunCMake/TargetSources/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt9
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt2
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake1
-rw-r--r--Tests/RunCMake/UseSWIG/CMP0078-common.cmake10
-rw-r--r--Tests/RunCMake/UseSWIG/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/UseSWIG/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/UseSWIG/example.i2
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake22
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake5
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake22
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake5
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsGlobals-check.cmake44
-rw-r--r--Tests/RunCMake/VS10Project/VsGlobals.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake33
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake37
-rw-r--r--Tests/RunCMake/add_link_options/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake2
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake4
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake2
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake36
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake15
-rw-r--r--Tests/RunCMake/add_link_options/LINKER_expansion.cmake4
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake7
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake7
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake7
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake17
-rw-r--r--Tests/RunCMake/add_link_options/LinkOptionsExe.c4
-rw-r--r--Tests/RunCMake/add_link_options/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/add_link_options/RunCMakeTest.cmake38
-rw-r--r--Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt1
-rw-r--r--Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt4
-rw-r--r--Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake6
-rw-r--r--Tests/RunCMake/add_link_options/dump.c13
-rw-r--r--Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt13
-rw-r--r--Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt13
-rw-r--r--Tests/RunCMake/configure_file/DirInput-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt1
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt (renamed from Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt)0
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt (renamed from Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt)0
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/ctest_submit/test.cmake.in1
-rw-r--r--Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt6
-rw-r--r--Tests/RunCMake/find_program/RelAndAbsPath.cmake63
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake1
-rwxr-xr-xTests/RunCMake/find_program/testCWD1
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN.cmake36
-rw-r--r--Tests/RunCMake/install/Deprecated-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/Deprecated.cmake13
-rw-r--r--Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-OPTIONAL.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-PERMISSIONS.cmake5
-rw-r--r--Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt1
-rw-r--r--Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake10
-rw-r--r--Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake7
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake20
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT.cmake5
-rw-r--r--Tests/RunCMake/install/SCRIPT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake13
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake27
-rw-r--r--Tests/RunCMake/install/TARGETS-Parts-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-Parts.cmake7
-rw-r--r--Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake14
-rw-r--r--Tests/RunCMake/install/TARGETS-RPATH.cmake14
-rw-r--r--Tests/RunCMake/install/install_script.cmake5
-rw-r--r--Tests/RunCMake/install/obj1.c5
-rw-r--r--Tests/RunCMake/install/obj1.h6
-rw-r--r--Tests/RunCMake/install/pattern/empty.c0
-rw-r--r--Tests/RunCMake/install/pattern/empty.h0
-rw-r--r--Tests/RunCMake/install/pattern/empty.txt0
-rw-r--r--Tests/RunCMake/install/postinstall.cmake1
-rw-r--r--Tests/RunCMake/install/preinstall.cmake1
-rwxr-xr-xTests/RunCMake/install/script (renamed from Tests/SimpleInstall/scripts/sample_script)0
-rwxr-xr-xTests/RunCMake/install/script.bat (renamed from Tests/SimpleInstall/scripts/sample_script.bat)0
-rw-r--r--Tests/RunCMake/install/testobj1.c9
-rw-r--r--Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt2
-rw-r--r--Tests/RunCMake/list/INSERT-InvalidIndex.cmake2
-rw-r--r--Tests/RunCMake/list/RunCMakeTest.cmake14
-rw-r--r--Tests/RunCMake/list/SORT-BadCaseOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-BadCaseOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-BadCompareOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt5
-rw-r--r--Tests/RunCMake/list/SORT-BadCompareOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-BadOrderOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt5
-rw-r--r--Tests/RunCMake/list/SORT-BadOrderOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake2
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake2
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake2
-rw-r--r--Tests/RunCMake/list/SORT-NoCaseOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-NoCaseOption.cmake1
-rw-r--r--Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-WrongOption-result.txt1
-rw-r--r--Tests/RunCMake/list/SORT-WrongOption-stderr.txt4
-rw-r--r--Tests/RunCMake/list/SORT-WrongOption.cmake (renamed from Tests/RunCMake/list/SORT-TooManyArguments.cmake)0
-rw-r--r--Tests/RunCMake/list/SORT.cmake114
-rw-r--r--Tests/RunCMake/math/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt5
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt8
-rw-r--r--Tests/RunCMake/math/MATH-ToleratedExpression.cmake4
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument.cmake1
-rw-r--r--Tests/RunCMake/math/MATH.cmake12
-rw-r--r--Tests/RunCMake/math/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/option/CMP0077-NEW.cmake14
-rw-r--r--Tests/RunCMake/option/CMP0077-OLD.cmake9
-rw-r--r--Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake14
-rw-r--r--Tests/RunCMake/option/CMP0077-WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/option/CMP0077-WARN.cmake5
-rw-r--r--Tests/RunCMake/option/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/option/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/print_stdin.c18
-rw-r--r--Tests/RunCMake/project/ProjectTwice.cmake26
-rw-r--r--Tests/RunCMake/project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake3
-rw-r--r--Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt2
-rw-r--r--Tests/RunCMake/set_property/LINK_OPTIONS.cmake3
-rw-r--r--Tests/RunCMake/set_property/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt17
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake6
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt6
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake6
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake6
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_link_options/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake15
-rw-r--r--Tests/RunCMake/target_link_options/LINKER_expansion.cmake49
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake7
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake55
-rw-r--r--Tests/RunCMake/target_link_options/LinkOptionsExe.c4
-rw-r--r--Tests/RunCMake/target_link_options/LinkOptionsLib.c7
-rw-r--r--Tests/RunCMake/target_link_options/RunCMakeTest.cmake41
-rw-r--r--Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt1
-rw-r--r--Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt4
-rw-r--r--Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake5
-rw-r--r--Tests/RunCMake/target_link_options/dump.c13
-rw-r--r--Tests/RunCMake/try_compile/CMP0056-stderr.txt13
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt398
-rw-r--r--Tests/SimpleInstall/InstallScript1.cmake5
-rw-r--r--Tests/SimpleInstall/InstallScript2.cmake14
-rw-r--r--Tests/SimpleInstall/InstallScript3.cmake12
-rw-r--r--Tests/SimpleInstall/InstallScript4.cmake22
-rw-r--r--Tests/SimpleInstall/PackageScript.cmake10
-rw-r--r--Tests/SimpleInstall/PostInstall.cmake6
-rw-r--r--Tests/SimpleInstall/PreInstall.cmake2
-rw-r--r--Tests/SimpleInstall/TestSubDir/CMakeLists.txt3
-rw-r--r--Tests/SimpleInstall/TestSubDir/TSD.cxx10
-rw-r--r--Tests/SimpleInstall/TestSubDir/TSD.h1
-rw-r--r--Tests/SimpleInstall/TestSubDir/TSD_utils.cxx9
-rw-r--r--Tests/SimpleInstall/foo.c6
-rw-r--r--Tests/SimpleInstall/foo.h10
-rw-r--r--Tests/SimpleInstall/inst.cxx34
-rw-r--r--Tests/SimpleInstall/inst2.cxx2
-rw-r--r--Tests/SimpleInstall/lib1.cxx6
-rw-r--r--Tests/SimpleInstall/lib1.h1
-rw-r--r--Tests/SimpleInstall/lib2.cxx6
-rw-r--r--Tests/SimpleInstall/lib2.h11
-rw-r--r--Tests/SimpleInstall/lib3.cxx6
-rw-r--r--Tests/SimpleInstall/lib3.h11
-rw-r--r--Tests/SimpleInstall/lib4.cxx6
-rw-r--r--Tests/SimpleInstall/lib4.h11
-rw-r--r--Tests/SimpleInstall/scripts/CMakeLists.txt1
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt397
-rw-r--r--Tests/SimpleInstallS2/InstallScript1.cmake5
-rw-r--r--Tests/SimpleInstallS2/InstallScript2.cmake14
-rw-r--r--Tests/SimpleInstallS2/InstallScript3.cmake12
-rw-r--r--Tests/SimpleInstallS2/InstallScript4.cmake22
-rw-r--r--Tests/SimpleInstallS2/PackageScript.cmake10
-rw-r--r--Tests/SimpleInstallS2/PostInstall.cmake6
-rw-r--r--Tests/SimpleInstallS2/PreInstall.cmake2
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt3
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/TSD.cxx10
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/TSD.h1
-rw-r--r--Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx9
-rw-r--r--Tests/SimpleInstallS2/foo.c6
-rw-r--r--Tests/SimpleInstallS2/foo.h10
-rw-r--r--Tests/SimpleInstallS2/inst.cxx34
-rw-r--r--Tests/SimpleInstallS2/inst2.cxx2
-rw-r--r--Tests/SimpleInstallS2/lib1.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib1.h1
-rw-r--r--Tests/SimpleInstallS2/lib2.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib2.h11
-rw-r--r--Tests/SimpleInstallS2/lib3.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib3.h11
-rw-r--r--Tests/SimpleInstallS2/lib4.cxx6
-rw-r--r--Tests/SimpleInstallS2/lib4.h11
-rw-r--r--Tests/SimpleInstallS2/scripts/CMakeLists.txt1
-rwxr-xr-xTests/SimpleInstallS2/scripts/sample_script2
-rwxr-xr-xTests/SimpleInstallS2/scripts/sample_script.bat1
-rw-r--r--Tests/UseSWIG/BasicConfiguration.cmake1
-rw-r--r--Tests/UseSWIG/BasicCsharp/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/BasicPerl/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/BasicPython/CMakeLists.txt2
-rw-r--r--Tests/UseSWIG/CMakeLists.txt11
-rw-r--r--Tests/UseSWIG/ModuleVersion2/CMakeLists.txt3
-rw-r--r--Tests/UseSWIG/MultipleModules/CMakeLists.txt3
-rw-r--r--Tests/UseSWIG/MultiplePython/CMakeLists.txt3
-rw-r--r--Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt45
-rw-r--r--Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i9
-rw-r--r--Tests/VSNASM/CMakeLists.txt12
-rw-r--r--Tests/VSNASM/bar.asm13
-rw-r--r--Tests/VSNASM/include/foo-proc.asm2
-rw-r--r--Tests/VSNASM/main.c3
541 files changed, 4097 insertions, 1438 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 3b4ff60df..39a5131fe 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -345,6 +345,17 @@ is not newer than dependency
${TEST_LINK_DEPENDS}
")
endif()
+
+ set(linkdep2 ${BuildDepends_BINARY_DIR}/Project/linkdep2${CMAKE_EXECUTABLE_SUFFIX})
+ if(${linkdep2} IS_NEWER_THAN ${TEST_LINK_DEPENDS})
+ message("INTERFACE_LINK_DEPENDS worked")
+ else()
+ message(SEND_ERROR "INTERFACE_LINK_DEPENDS failed. Executable
+ ${linkdep2}
+is not newer than dependency
+ ${TEST_LINK_DEPENDS}
+")
+ endif()
endif()
if(EXISTS "${link_depends_no_shared_check_txt}")
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index 127b36540..3f41b26d0 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -106,7 +106,12 @@ set_property(
if(TEST_LINK_DEPENDS)
add_executable(linkdep linkdep.cxx)
- set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS})
+ set_property(TARGET linkdep PROPERTY LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>)
+
+ add_library(foo_interface INTERFACE)
+ set_property(TARGET foo_interface PROPERTY INTERFACE_LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>)
+ add_executable(linkdep2 linkdep.cxx)
+ target_link_libraries(linkdep2 PRIVATE foo_interface)
endif()
add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c
diff --git a/Tests/CMakeCommands/add_link_options/CMakeLists.txt b/Tests/CMakeCommands/add_link_options/CMakeLists.txt
new file mode 100644
index 000000000..bb7dcbbfc
--- /dev/null
+++ b/Tests/CMakeCommands/add_link_options/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(add_link_options LANGUAGES C)
+
+
+add_link_options(-LINK_FLAG)
+
+add_executable(add_link_options EXCLUDE_FROM_ALL LinkOptionsExe.c)
+
+get_target_property(result add_link_options LINK_OPTIONS)
+if (NOT result MATCHES "-LINK_FLAG")
+ message(SEND_ERROR "add_link_options not populated the LINK_OPTIONS target property")
+endif()
+
+
+add_library(imp UNKNOWN IMPORTED)
+get_target_property(result imp LINK_OPTIONS)
+if (result)
+ message(FATAL_ERROR "add_link_options populated the LINK_OPTIONS target property")
+endif()
diff --git a/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c b/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c
new file mode 100644
index 000000000..8488f4e58
--- /dev/null
+++ b/Tests/CMakeCommands/add_link_options/LinkOptionsExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/link_directories/CMakeLists.txt b/Tests/CMakeCommands/link_directories/CMakeLists.txt
new file mode 100644
index 000000000..60c07b638
--- /dev/null
+++ b/Tests/CMakeCommands/link_directories/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 3.12)
+
+project(link_directories LANGUAGES C)
+
+
+link_directories(/A)
+link_directories(BEFORE /B)
+
+set(CMAKE_LINK_DIRECTORIES_BEFORE ON)
+link_directories(/C)
+
+get_directory_property(result LINK_DIRECTORIES)
+if (NOT result MATCHES "/C;/B;/A")
+ message(SEND_ERROR "link_directories not populated the LINK_DIRECTORIES directory property")
+endif()
+
+
+add_executable(link_directories EXCLUDE_FROM_ALL LinkDirectoriesExe.c)
+
+get_target_property(result link_directories LINK_DIRECTORIES)
+if (NOT result MATCHES "/C;/B;/A")
+ message(SEND_ERROR "link_directories not populated the LINK_DIRECTORIES target property")
+endif()
+
+
+add_library(imp UNKNOWN IMPORTED)
+get_target_property(result imp LINK_DIRECTORIES)
+if (result)
+ message(FATAL_ERROR "link_directories populated the LINK_DIRECTORIES target property")
+endif()
diff --git a/Tests/CMakeCommands/link_directories/LinkDirectoriesExe.c b/Tests/CMakeCommands/link_directories/LinkDirectoriesExe.c
new file mode 100644
index 000000000..8488f4e58
--- /dev/null
+++ b/Tests/CMakeCommands/link_directories/LinkDirectoriesExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_directories/CMakeLists.txt b/Tests/CMakeCommands/target_link_directories/CMakeLists.txt
new file mode 100644
index 000000000..bc7b9b212
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_directories/CMakeLists.txt
@@ -0,0 +1,40 @@
+
+cmake_minimum_required(VERSION 3.12)
+
+project(target_link_directories LANGUAGES C)
+
+add_library(target_link_directories SHARED LinkDirectoriesLib.c)
+# Test no items
+target_link_directories(target_link_directories PRIVATE)
+
+add_library(target_link_directories_2 SHARED EXCLUDE_FROM_ALL LinkDirectoriesLib.c)
+target_link_directories(target_link_directories_2 PRIVATE /private/dir INTERFACE /interface/dir)
+get_target_property(result target_link_directories_2 LINK_DIRECTORIES)
+if (NOT result MATCHES "/private/dir")
+ message(SEND_ERROR "${result} target_link_directories not populated the LINK_DIRECTORIES target property")
+endif()
+get_target_property(result target_link_directories_2 INTERFACE_LINK_DIRECTORIES)
+if (NOT result MATCHES "/interface/dir")
+ message(SEND_ERROR "target_link_directories not populated the INTERFACE_LINK_DIRECTORIES target property of shared library")
+endif()
+
+add_library(target_link_directories_3 STATIC EXCLUDE_FROM_ALL LinkDirectoriesLib.c)
+target_link_directories(target_link_directories_3 INTERFACE /interface/dir)
+get_target_property(result target_link_directories_3 INTERFACE_LINK_DIRECTORIES)
+if (NOT result MATCHES "/interface/dir")
+ message(SEND_ERROR "target_link_directories not populated the INTERFACE_LINK_DIRECTORIES target property of static library")
+endif()
+
+add_library(target_link_directories_4 SHARED EXCLUDE_FROM_ALL LinkDirectoriesLib.c)
+target_link_directories(target_link_directories_4 PRIVATE relative/dir)
+get_target_property(result target_link_directories_4 LINK_DIRECTORIES)
+if (NOT result MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir")
+ message(SEND_ERROR "target_link_directories not populated the LINK_DIRECTORIES with relative path")
+endif()
+
+add_subdirectory(subdir)
+target_link_directories(target_link_directories_5 PRIVATE relative/dir)
+get_target_property(result target_link_directories_5 LINK_DIRECTORIES)
+if (NOT result MATCHES "${CMAKE_CURRENT_SOURCE_DIR}/relative/dir")
+ message(SEND_ERROR "target_link_directories not populated the LINK_DIRECTORIES with relative path")
+endif()
diff --git a/Tests/CMakeCommands/target_link_directories/LinkDirectoriesLib.c b/Tests/CMakeCommands/target_link_directories/LinkDirectoriesLib.c
new file mode 100644
index 000000000..9bbd24cd8
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_directories/LinkDirectoriesLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_directories/subdir/CMakeLists.txt b/Tests/CMakeCommands/target_link_directories/subdir/CMakeLists.txt
new file mode 100644
index 000000000..7e7ad2a97
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_directories/subdir/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_library(target_link_directories_5 SHARED EXCLUDE_FROM_ALL ../LinkDirectoriesLib.c)
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index e11f980df..85ce1f785 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -130,3 +130,15 @@ target_link_libraries(newsignature1 PRIVATE depC INTERFACE depD PUBLIC depB PRIV
assert_property(newsignature1 INTERFACE_LINK_LIBRARIES "depD;depB")
assert_property(newsignature1 LINK_LIBRARIES "depC;depB;subdirlib")
+
+#----------------------------------------------------------------------------
+# Test cross-directory linking.
+cmake_policy(PUSH)
+cmake_policy(SET CMP0079 NEW)
+add_executable(TopDir TopDir.c)
+add_subdirectory(SubDirA)
+add_subdirectory(SubDirB)
+target_link_libraries(SubDirB TopDirImported)
+add_library(TopDirImported IMPORTED INTERFACE)
+target_compile_definitions(TopDirImported INTERFACE DEF_TopDirImported)
+cmake_policy(POP)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt
new file mode 100644
index 000000000..4dae10395
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt
@@ -0,0 +1,15 @@
+add_executable(SubDirA SubDirA.c)
+
+# Link to a target imported in this directory that would not normally
+# be visible to the directory in which TopDir is defined.
+target_link_libraries(TopDir PUBLIC SameNameImported)
+
+# Link SubDirA to a target imported in this directory that has the same
+# name as a target imported in SubDirB's directory. SubDirB will also
+# tell us to link its copy. At compile time we verify both are linked.
+target_link_libraries(SubDirA PRIVATE SameNameImported)
+
+# Import a target with the same name as a target imported in SubDirB.
+# Distinguish this copy by having a unique usage requirement.
+add_library(SameNameImported IMPORTED INTERFACE)
+target_compile_definitions(SameNameImported INTERFACE DEF_SameNameImportedSubDirA)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirA/SubDirA.c b/Tests/CMakeCommands/target_link_libraries/SubDirA/SubDirA.c
new file mode 100644
index 000000000..4706bb94e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirA/SubDirA.c
@@ -0,0 +1,14 @@
+#ifndef DEF_SameNameImportedSubDirA
+# error "DEF_SameNameImportedSubDirA is not defined but should be!"
+#endif
+#ifndef DEF_SameNameImportedSubDirB
+# error "DEF_SameNameImportedSubDirB is not defined but should be!"
+#endif
+#ifdef DEF_TopDirImported
+# error "DEF_TopDirImported is defined but should not be!"
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt
new file mode 100644
index 000000000..7c918e699
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirB/CMakeLists.txt
@@ -0,0 +1,15 @@
+add_executable(SubDirB SubDirB.c)
+
+# Link to a target imported in this directory that would not normally
+# be visible to the directory in which TopDir is defined.
+target_link_libraries(TopDir PUBLIC SameNameImported)
+
+# Link SubDirA to a target imported in this directory that has the same
+# name as a target imported in SubDirA's directory. We verify when
+# compiling SubDirA that it sees our target and its own.
+target_link_libraries(SubDirA PRIVATE SameNameImported)
+
+# Import a target with the same name as a target imported in SubDirA.
+# Distinguish this copy by having a unique usage requirement.
+add_library(SameNameImported IMPORTED INTERFACE)
+target_compile_definitions(SameNameImported INTERFACE DEF_SameNameImportedSubDirB)
diff --git a/Tests/CMakeCommands/target_link_libraries/SubDirB/SubDirB.c b/Tests/CMakeCommands/target_link_libraries/SubDirB/SubDirB.c
new file mode 100644
index 000000000..6e567298c
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/SubDirB/SubDirB.c
@@ -0,0 +1,14 @@
+#ifdef DEF_SameNameImportedSubDirA
+# error "DEF_SameNameImportedSubDirA is defined but should not be!"
+#endif
+#ifdef DEF_SameNameImportedSubDirB
+# error "DEF_SameNameImportedSubDirB is defined but should not be!"
+#endif
+#ifndef DEF_TopDirImported
+# error "DEF_TopDirImported is not defined but should be!"
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/TopDir.c b/Tests/CMakeCommands/target_link_libraries/TopDir.c
new file mode 100644
index 000000000..4706bb94e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/TopDir.c
@@ -0,0 +1,14 @@
+#ifndef DEF_SameNameImportedSubDirA
+# error "DEF_SameNameImportedSubDirA is not defined but should be!"
+#endif
+#ifndef DEF_SameNameImportedSubDirB
+# error "DEF_SameNameImportedSubDirB is not defined but should be!"
+#endif
+#ifdef DEF_TopDirImported
+# error "DEF_TopDirImported is defined but should not be!"
+#endif
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_link_options/CMakeLists.txt b/Tests/CMakeCommands/target_link_options/CMakeLists.txt
new file mode 100644
index 000000000..e84d0410e
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_options/CMakeLists.txt
@@ -0,0 +1,34 @@
+
+cmake_minimum_required(VERSION 3.11)
+
+project(target_link_options LANGUAGES C)
+
+add_library(target_link_options SHARED LinkOptionsLib.c)
+# Test no items
+target_link_options(target_link_options PRIVATE)
+
+add_library(target_link_options_2 SHARED EXCLUDE_FROM_ALL LinkOptionsLib.c)
+target_link_options(target_link_options_2 PRIVATE -PRIVATE_FLAG INTERFACE -INTERFACE_FLAG)
+get_target_property(result target_link_options_2 LINK_OPTIONS)
+if (NOT result MATCHES "-PRIVATE_FLAG")
+ message(SEND_ERROR "target_link_options not populated the LINK_OPTIONS target property")
+endif()
+get_target_property(result target_link_options_2 INTERFACE_LINK_OPTIONS)
+if (NOT result MATCHES "-INTERFACE_FLAG")
+ message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property of shared library")
+endif()
+
+add_library(target_link_options_3 STATIC EXCLUDE_FROM_ALL LinkOptionsLib.c)
+target_link_options(target_link_options_3 INTERFACE -INTERFACE_FLAG)
+get_target_property(result target_link_options_3 INTERFACE_LINK_OPTIONS)
+if (NOT result MATCHES "-INTERFACE_FLAG")
+ message(SEND_ERROR "target_link_options not populated the INTERFACE_LINK_OPTIONS target property of static library")
+endif()
+
+add_library(target_link_options_4 SHARED EXCLUDE_FROM_ALL LinkOptionsLib.c)
+target_link_options(target_link_options_4 PRIVATE -PRIVATE_FLAG)
+target_link_options(target_link_options_4 BEFORE PRIVATE -BEFORE_PRIVATE_FLAG)
+get_target_property(result target_link_options_4 LINK_OPTIONS)
+if (NOT result MATCHES "-BEFORE_PRIVATE_FLAG.*-PRIVATE_FLAG")
+ message(SEND_ERROR "target_link_options not managing correctly 'BEFORE' keyword")
+endif()
diff --git a/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c b/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c
new file mode 100644
index 000000000..9bbd24cd8
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_options/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/CMakeLists.txt b/Tests/CMakeCommands/target_sources/CMakeLists.txt
new file mode 100644
index 000000000..ab14855c7
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/CMakeLists.txt
@@ -0,0 +1,36 @@
+
+cmake_minimum_required(VERSION 3.12)
+cmake_policy(SET CMP0076 NEW)
+
+project(target_sources)
+
+add_library(target_sources_lib)
+target_compile_definitions(target_sources_lib PRIVATE "-DIS_LIB")
+add_subdirectory(subdir)
+
+set(subdir_fullpath "${CMAKE_CURRENT_LIST_DIR}/subdir")
+
+get_property(target_sources_lib_property TARGET target_sources_lib PROPERTY SOURCES)
+if (NOT "$<1:${subdir_fullpath}/subdir_empty_1.cpp>" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Generator expression to absolute sub directory file not found")
+endif()
+if (NOT "$<1:${subdir_fullpath}/../empty_1.cpp>" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Generator expression to absolute main directory file not found")
+endif()
+if (NOT "${subdir_fullpath}/subdir_empty_2.cpp" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Relative sub directory file not converted to absolute")
+endif()
+if (NOT "$<1:empty_2.cpp>" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Generator expression to relative main directory file not found")
+endif()
+if (NOT "${subdir_fullpath}/../empty_3.cpp" IN_LIST target_sources_lib_property)
+ message(SEND_ERROR "target_sources_lib: Relative main directory file not converted to absolute")
+endif()
+
+add_executable(target_sources main.cpp)
+target_link_libraries(target_sources target_sources_lib)
+
+get_property(target_sources_property TARGET target_sources PROPERTY SOURCES)
+if (NOT "main.cpp" IN_LIST target_sources_property)
+ message(SEND_ERROR "target_sources: Relative main directory file converted to absolute")
+endif()
diff --git a/Tests/CMakeCommands/target_sources/empty_1.cpp b/Tests/CMakeCommands/target_sources/empty_1.cpp
new file mode 100644
index 000000000..01e5b07ae
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/empty_1.cpp
@@ -0,0 +1,21 @@
+#ifdef IS_LIB
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int internal_empty_1()
+{
+ return 0;
+}
+
+#else
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int empty_1()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/CMakeCommands/target_sources/empty_2.cpp b/Tests/CMakeCommands/target_sources/empty_2.cpp
new file mode 100644
index 000000000..48ae8bb23
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/empty_2.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty_2()
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/empty_3.cpp b/Tests/CMakeCommands/target_sources/empty_3.cpp
new file mode 100644
index 000000000..bd3a6d1c8
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/empty_3.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty_3()
+{
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/main.cpp b/Tests/CMakeCommands/target_sources/main.cpp
new file mode 100644
index 000000000..622771cb9
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/main.cpp
@@ -0,0 +1,16 @@
+#include <iostream>
+
+int empty_1();
+int subdir_empty_1();
+int subdir_empty_2();
+
+int main()
+{
+ int e1 = empty_1();
+ int se1 = subdir_empty_1();
+ int se2 = subdir_empty_2();
+
+ std::cout << e1 << " " << se1 << " " << se2 << std::endl;
+
+ return 0;
+}
diff --git a/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt b/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt
new file mode 100644
index 000000000..f749f1d7a
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/subdir/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+target_sources(target_sources_lib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp>
+ $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp>
+ subdir_empty_2.cpp
+ PRIVATE $<1:empty_2.cpp>
+ ../empty_3.cpp)
diff --git a/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp
new file mode 100644
index 000000000..3c61321a1
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_1.cpp
@@ -0,0 +1,21 @@
+#ifdef IS_LIB
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int internal_subdir_empty_1()
+{
+ return 0;
+}
+
+#else
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int subdir_empty_1()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp
new file mode 100644
index 000000000..47fa73697
--- /dev/null
+++ b/Tests/CMakeCommands/target_sources/subdir/subdir_empty_2.cpp
@@ -0,0 +1,21 @@
+#ifdef IS_LIB
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int internal_subdir_empty_2()
+{
+ return 0;
+}
+
+#else
+
+# ifdef _WIN32
+__declspec(dllexport)
+# endif
+ int subdir_empty_2()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/CMakeLib/testRST.expect b/Tests/CMakeLib/testRST.expect
index 1ffd6b966..d7b91d1b4 100644
--- a/Tests/CMakeLib/testRST.expect
+++ b/Tests/CMakeLib/testRST.expect
@@ -19,6 +19,7 @@ Variable ``VARIABLE_<PLACEHOLDER>`` with trailing placeholder and target.
Environment variable ``SOME_ENV_VAR``.
Environment variable ``some env var`` with space and target.
Generator ``Some Generator`` with space.
+Generator ``Some Generator`` with space.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Inline link Link Text.
Inline link Link Text <With \-escaped Brackets>.
diff --git a/Tests/CMakeLib/testRST.rst b/Tests/CMakeLib/testRST.rst
index c8587c036..633219f8b 100644
--- a/Tests/CMakeLib/testRST.rst
+++ b/Tests/CMakeLib/testRST.rst
@@ -26,6 +26,7 @@ Variable :variable:`VARIABLE_<PLACEHOLDER> <target>` with trailing placeholder a
Environment variable :envvar:`SOME_ENV_VAR`.
Environment variable :envvar:`some env var <SOME_ENV_VAR>` with space and target.
Generator :generator:`Some Generator` with space.
+Generator :cpack_gen:`Some Generator` with space.
Inline literal ``~!@#$%^&*( )_+-=\\[]{}'":;,<>.?/``.
Inline link `Link Text <ExternalDest>`_.
Inline link `Link Text \<With \\-escaped Brackets\> <ExternalDest>`_.
diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx
index 0dfa326a3..623ad28d9 100644
--- a/Tests/CMakeLib/testSystemTools.cxx
+++ b/Tests/CMakeLib/testSystemTools.cxx
@@ -52,7 +52,7 @@ int testSystemTools(int /*unused*/, char* /*unused*/ [])
cmAssert(cmSystemTools::strverscmp("99999999999999", "99999999999991") > 0,
"strverscmp natural overflow");
cmAssert(cmSystemTools::strverscmp("00000000000009", "00000000000001") > 0,
- "strverscmp deciaml precision");
+ "strverscmp decimal precision");
cmAssert(cmSystemTools::strverscmp("a.b.c.0", "a.b.c.000") > 0,
"strverscmp multiple zeros");
cmAssert(cmSystemTools::strverscmp("lib_1.2_10", "lib_1.2_2") > 0,
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b8b724ed8..0de6c416e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -368,6 +368,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(CxxSubdirC CxxSubdirC)
ADD_TEST_MACRO(IPO COnly/COnly)
ADD_TEST_MACRO(OutDir runtime/OutDir)
+ ADD_TEST_MACRO(OutName exe.OutName.exe)
ADD_TEST_MACRO(ObjectLibrary UseCshared)
ADD_TEST_MACRO(NewlineArgs NewlineArgs)
ADD_TEST_MACRO(SetLang SetLang)
@@ -396,6 +397,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
ADD_TEST_MACRO(AliasTarget AliasTarget)
ADD_TEST_MACRO(StagingPrefix StagingPrefix)
+ ADD_TEST_MACRO(ImportedSameName ImportedSameName)
ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set(ConfigSources_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
@@ -869,33 +871,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
- set(SimpleInstallInstallDir
- "${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
- add_test(SimpleInstall ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/SimpleInstall"
- "${CMake_BINARY_DIR}/Tests/SimpleInstall"
- ${build_generator_args}
- --build-project TestSimpleInstall
- --build-two-config
- --build-options ${build_options}
- "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
- "-DCTEST_TEST_CPACK:BOOL=${CTEST_TEST_CPACK}"
- --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExe)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstall")
- add_test(SimpleInstall-Stage2 ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2"
- "${CMake_BINARY_DIR}/Tests/SimpleInstallS2"
- ${build_generator_args}
- --build-project TestSimpleInstall
- --build-two-config
- --build-options ${build_options}
- "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}"
- "-DSTAGE2:BOOL=1"
- --test-command ${SimpleInstallInstallDir}/MyTest/bin/SimpleInstExeS2)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleInstallS2")
-
set(MissingInstallInstallDir
"${CMake_BINARY_DIR}/Tests/MissingInstall/InstallDirectory")
add_test(MissingInstall ${CMAKE_CTEST_COMMAND}
@@ -1821,7 +1796,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1)
set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2)
set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1)
- set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall)
# Test static linking on toolchains known to support it.
if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
@@ -1940,6 +1914,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
message(STATUS
".vcproj file association indicates VCExpress, avoiding MFC test")
set(CTEST_RUN_MFC OFF)
+ elseif( NOT ov )
+ message(STATUS
+ ".vcproj has no file association, avoiding MFC test")
+ set(CTEST_RUN_MFC OFF)
endif()
endif()
@@ -2129,7 +2107,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]")
set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]")
set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]")
- set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]")
+ set(reg_vs14 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]")
set(reg_ws80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]")
set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]")
set(reg_ws10_0 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\Build Tools for Windows 10;srcPath]")
@@ -2150,12 +2128,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
get_filename_component(ntver "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion;CurrentVersion]" NAME)
if(WIN32 AND ntver VERSION_GREATER 6.1) # Windows >= 8.0
- macro(add_test_VSWinStorePhone name generator systemName systemVersion)
+ macro(add_test_VSWinStorePhone name generator systemName systemVersion architecture)
add_test(NAME VSWinStorePhone.${name} COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/VSWinStorePhone"
"${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}"
--build-generator "${generator}"
+ --build-generator-platform "${architecture}"
--build-project VSWinStorePhone
--build-config $<CONFIGURATION>
--build-options -DCMAKE_SYSTEM_NAME=${systemName}
@@ -2165,14 +2144,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endmacro()
if(vs11 AND ws80)
- add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0)
- add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012 ARM" WindowsStore 8.0)
- add_test_VSWinStorePhone(vs11-store80-X64 "Visual Studio 11 2012 Win64" WindowsStore 8.0)
+ add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0 Win32)
+ add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012" WindowsStore 8.0 ARM)
+ add_test_VSWinStorePhone(vs11-store80-X64 "Visual Studio 11 2012" WindowsStore 8.0 x64)
endif()
if(vs12 AND ws81)
- add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1)
- add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013 ARM" WindowsStore 8.1)
- add_test_VSWinStorePhone(vs12-store81-X64 "Visual Studio 12 2013 Win64" WindowsStore 8.1)
+ add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1 Win32)
+ add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013" WindowsStore 8.1 ARM)
+ add_test_VSWinStorePhone(vs12-store81-X64 "Visual Studio 12 2013" WindowsStore 8.1 x64)
add_test(NAME VSXaml COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -2185,18 +2164,24 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
-DCMAKE_SYSTEM_VERSION=8.1
)
endif()
+ if(CMake_TEST_VSWinStorePhone_VS_2017 AND ws10_0)
+ add_test_VSWinStorePhone(vs15-store10_0-X86 "Visual Studio 15 2017" WindowsStore 10.0 Win32)
+ add_test_VSWinStorePhone(vs15-store10_0-ARM "Visual Studio 15 2017" WindowsStore 10.0 ARM)
+ add_test_VSWinStorePhone(vs15-store10_0-X64 "Visual Studio 15 2017" WindowsStore 10.0 x64)
+ add_test_VSWinStorePhone(vs15-store10_0-ARM64 "Visual Studio 15 2017" WindowsStore 10.0 ARM64)
+ endif()
if(vs14 AND ws10_0)
- add_test_VSWinStorePhone(vs14-store10_0-X86 "Visual Studio 14 2015" WindowsStore 10.0)
- add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015 ARM" WindowsStore 10.0)
- add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015 Win64" WindowsStore 10.0)
+ add_test_VSWinStorePhone(vs14-store10_0-X86 "Visual Studio 14 2015" WindowsStore 10.0 Win32)
+ add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015" WindowsStore 10.0 ARM)
+ add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015" WindowsStore 10.0 x64)
endif()
if(vs11 AND wp80)
- add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0)
- add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012 ARM" WindowsPhone 8.0)
+ add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0 Win32)
+ add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012" WindowsPhone 8.0 ARM)
endif()
if(vs12 AND wp81)
- add_test_VSWinStorePhone(vs12-phone81-X86 "Visual Studio 12 2013" WindowsPhone 8.1)
- add_test_VSWinStorePhone(vs12-phone81-ARM "Visual Studio 12 2013 ARM" WindowsPhone 8.1)
+ add_test_VSWinStorePhone(vs12-phone81-X86 "Visual Studio 12 2013" WindowsPhone 8.1 Win32)
+ add_test_VSWinStorePhone(vs12-phone81-ARM "Visual Studio 12 2013" WindowsPhone 8.1 ARM)
endif()
endif()
@@ -2256,7 +2241,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-generator "Green Hills MULTI"
--build-project ReturnNum
--build-config $<CONFIGURATION>
- --build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt"
+ --build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt
-DGHS_BSP_NAME="simarm"
)
endif ()
@@ -2843,6 +2828,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
ADD_TEST_MACRO(CMakeCommands.target_include_directories target_include_directories)
ADD_TEST_MACRO(CMakeCommands.target_compile_definitions target_compile_definitions)
ADD_TEST_MACRO(CMakeCommands.target_compile_options target_compile_options)
+ ADD_TEST_MACRO(CMakeCommands.target_sources target_sources)
+
+ ADD_TEST_MACRO(CMakeCommands.add_link_options)
+ ADD_TEST_MACRO(CMakeCommands.target_link_options)
+ ADD_TEST_MACRO(CMakeCommands.link_directories)
+ ADD_TEST_MACRO(CMakeCommands.target_link_directories)
# The cmake server-mode test requires python for a simple client.
find_package(PythonInterp QUIET)
@@ -3437,10 +3428,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
)
endif()
- add_test(NAME CMakeWizardTest COMMAND cmake -i)
- set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION
- "The \"cmake -i\" wizard mode is no longer supported.")
-
# Define a set of "contract" tests, each activated by a cache entry
# named "CMake_TEST_CONTRACT_<project>". For each Contract test,
# the project should provide a directory with a CMakeLists.txt file
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index 76f5e4f6a..f517e64a6 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -53,6 +53,10 @@ set(result andy brad)
list(INSERT result -1 bill ken)
TEST("INSERT result -1 bill ken" "andy;bill;ken;brad")
+set(result andy brad)
+list(INSERT result 2 bill ken)
+TEST("INSERT result 2 bill ken" "andy;brad;bill;ken")
+
set(result andy bill brad ken bob)
list(REMOVE_ITEM result bob)
TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken")
diff --git a/Tests/CSharpOnly/CMakeLists.txt b/Tests/CSharpOnly/CMakeLists.txt
index 0e3e39e21..82049c78d 100644
--- a/Tests/CSharpOnly/CMakeLists.txt
+++ b/Tests/CSharpOnly/CMakeLists.txt
@@ -8,3 +8,6 @@ add_library(lib2 SHARED lib2.cs)
add_executable(CSharpOnly csharponly.cs)
target_link_libraries(CSharpOnly lib1 lib2)
+
+add_custom_target(CSharpCustom ALL SOURCES empty.cs)
+add_custom_target(custom.cs ALL DEPENDS empty.txt)
diff --git a/Tests/CSharpOnly/empty.cs b/Tests/CSharpOnly/empty.cs
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/CSharpOnly/empty.cs
diff --git a/Tests/CSharpOnly/empty.txt b/Tests/CSharpOnly/empty.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/CSharpOnly/empty.txt
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 8a43df55a..1b3daa6c9 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -4,5 +4,6 @@ ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
ADD_TEST_MACRO(Cuda.MixedStandardLevels MixedStandardLevels)
ADD_TEST_MACRO(Cuda.ToolkitInclude CudaToolkitInclude)
+ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries)
ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
ADD_TEST_MACRO(Cuda.WithC CudaWithC)
diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt
index f4e192340..d3d4b7c28 100644
--- a/Tests/Cuda/Complex/CMakeLists.txt
+++ b/Tests/Cuda/Complex/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaComplex CXX CUDA)
+project (Complex CXX CUDA)
#Goal for this example:
#build a cpp dynamic library base
diff --git a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt
index 9fda2d02b..7098a7df5 100644
--- a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt
+++ b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaConsumeCompileFeatures CXX CUDA)
+project (ConsumeCompileFeatures CXX CUDA)
#Goal for this example:
#build a c++11 library that express a c++11 public compile feature
diff --git a/Tests/Cuda/MixedStandardLevels/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels/CMakeLists.txt
index 683abe709..b399662a7 100644
--- a/Tests/Cuda/MixedStandardLevels/CMakeLists.txt
+++ b/Tests/Cuda/MixedStandardLevels/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.7)
-project(CudaComplex CXX CUDA)
+project(MixedStandardLevels CXX CUDA)
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
diff --git a/Tests/Cuda/ObjectLibrary/CMakeLists.txt b/Tests/Cuda/ObjectLibrary/CMakeLists.txt
index da5fb876e..395bd3881 100644
--- a/Tests/Cuda/ObjectLibrary/CMakeLists.txt
+++ b/Tests/Cuda/ObjectLibrary/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaObjectLibrary CUDA CXX)
+project (ObjectLibrary CUDA CXX)
#Goal for this example:
#
#Build C++ and CUDA object files and than use them to make an executable
diff --git a/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt b/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt
new file mode 100644
index 000000000..cb47b09b4
--- /dev/null
+++ b/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.13)
+project(ProperDeviceLibraries CXX CUDA)
+
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_35,code=compute_35 -gencode arch=compute_35,code=sm_35")
+set(CMAKE_CUDA_STANDARD 11)
+
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads)
+
+add_executable(ProperDeviceLibraries main.cu)
+set_target_properties(ProperDeviceLibraries
+ PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
+
+add_library(UseThreadsMixed SHARED use_pthreads.cxx use_pthreads.cu)
+target_link_libraries(UseThreadsMixed Threads::Threads)
+
+add_library(UseThreadsCuda SHARED use_pthreads.cu)
+target_link_libraries(UseThreadsCuda Threads::Threads)
+
+target_link_libraries(ProperDeviceLibraries PRIVATE UseThreadsMixed UseThreadsCuda)
+
+if(THREADS_HAVE_PTHREAD_ARG AND CMAKE_USE_PTHREADS_INIT)
+ add_library(UseExplicitPThreadsFlag SHARED use_pthreads.cu)
+ target_compile_options(UseExplicitPThreadsFlag PUBLIC "-Xcompiler=-pthread")
+ target_link_libraries(UseExplicitPThreadsFlag PUBLIC "-pthread")
+
+ add_library(UseExplicitLThreadsFlag SHARED use_pthreads.cu)
+ target_compile_options(UseExplicitLThreadsFlag PUBLIC "-Xcompiler=-pthread")
+ target_link_libraries(UseExplicitLThreadsFlag PUBLIC "-lpthread")
+
+ add_library(UseExplicitLongThreadsFlag SHARED use_pthreads.cu)
+ target_link_libraries(UseExplicitLongThreadsFlag PUBLIC "--library pthread")
+
+ target_link_libraries(ProperDeviceLibraries PRIVATE UseExplicitPThreadsFlag UseExplicitLThreadsFlag UseExplicitLongThreadsFlag)
+endif()
+
+if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.0.0)
+ #CUDA 10 removed the cublas_device library
+ target_link_libraries(ProperDeviceLibraries PRIVATE cublas_device)
+endif()
+
+if(APPLE)
+ # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
+ set_property(TARGET ProperDeviceLibraries PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
+endif()
diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu b/Tests/Cuda/ProperDeviceLibraries/main.cu
index 2c7c3887b..8ceb0ccb4 100644
--- a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
+++ b/Tests/Cuda/ProperDeviceLibraries/main.cu
@@ -3,6 +3,15 @@
#include <cuda_runtime.h>
#include <iostream>
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+
+# include <pthread.h>
+static int verify_linking_to_pthread()
+{
+ return static_cast<int>(pthread_self());
+}
+#endif
+
// this test only makes sense for versions of CUDA that ships
// static libraries that have separable compilation device symbols
#if __CUDACC_VER_MAJOR__ <= 9
diff --git a/Tests/Cuda/ProperDeviceLibraries/use_pthreads.cu b/Tests/Cuda/ProperDeviceLibraries/use_pthreads.cu
new file mode 100644
index 000000000..c57b8a828
--- /dev/null
+++ b/Tests/Cuda/ProperDeviceLibraries/use_pthreads.cu
@@ -0,0 +1,9 @@
+
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+
+# include <pthread.h>
+static int verify_linking_to_pthread_cuda()
+{
+ return static_cast<int>(pthread_self());
+}
+#endif
diff --git a/Tests/Cuda/ProperDeviceLibraries/use_pthreads.cxx b/Tests/Cuda/ProperDeviceLibraries/use_pthreads.cxx
new file mode 100644
index 000000000..dc7c208a4
--- /dev/null
+++ b/Tests/Cuda/ProperDeviceLibraries/use_pthreads.cxx
@@ -0,0 +1,9 @@
+
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+
+# include <pthread.h>
+static int verify_linking_to_pthread_cxx()
+{
+ return static_cast<int>(pthread_self());
+}
+#endif
diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt
index 831ce12c9..69aa3f992 100644
--- a/Tests/Cuda/WithC/CMakeLists.txt
+++ b/Tests/Cuda/WithC/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.7)
-project(CudaComplex CUDA C)
+project(WithC CUDA C)
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index 59f3e8451..9c4f86a31 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -1,8 +1,8 @@
+ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard)
ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX)
ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
-ADD_TEST_MACRO(CudaOnly.LinkSystemDeviceLibraries CudaOnlyLinkSystemDeviceLibraries)
ADD_TEST_MACRO(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
ADD_TEST_MACRO(CudaOnly.SeparateCompilation CudaOnlySeparateCompilation)
ADD_TEST_MACRO(CudaOnly.WithDefs CudaOnlyWithDefs)
diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt
new file mode 100644
index 000000000..5e6f7abc6
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 3.7)
+project (CircularLinkLine CUDA)
+
+#Goal for this example:
+# Verify that we de-duplicate the device link line
+# Verify that a de-duplicated link line still works with circular static libraries
+
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]")
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CUDA_STANDARD 11)
+
+add_library(CUDACircularDeviceLinking1 STATIC file1.cu)
+add_library(CUDACircularDeviceLinking2 STATIC file2.cu)
+add_library(CUDACircularDeviceLinking3 STATIC file3.cu)
+add_executable(CudaOnlyCircularLinkLine main.cu)
+
+target_link_libraries(CUDACircularDeviceLinking1 PUBLIC CUDACircularDeviceLinking2)
+target_link_libraries(CUDACircularDeviceLinking2 PUBLIC CUDACircularDeviceLinking3)
+target_link_libraries(CUDACircularDeviceLinking3 PUBLIC CUDACircularDeviceLinking1)
+
+target_link_libraries(CudaOnlyCircularLinkLine PRIVATE CUDACircularDeviceLinking3)
+
+
+set_target_properties(CUDACircularDeviceLinking1
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
+
+set_target_properties(CUDACircularDeviceLinking2
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
+
+set_target_properties(CUDACircularDeviceLinking3
+ PROPERTIES
+ CUDA_SEPARABLE_COMPILATION ON)
diff --git a/Tests/CudaOnly/CircularLinkLine/file1.cu b/Tests/CudaOnly/CircularLinkLine/file1.cu
new file mode 100644
index 000000000..88ac4e3cb
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/file1.cu
@@ -0,0 +1,6 @@
+
+extern __device__ int file2_func(int);
+int __device__ file1_func(int x)
+{
+ return file2_func(x);
+}
diff --git a/Tests/CudaOnly/CircularLinkLine/file2.cu b/Tests/CudaOnly/CircularLinkLine/file2.cu
new file mode 100644
index 000000000..b32dbffe4
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/file2.cu
@@ -0,0 +1,6 @@
+
+extern __device__ int file3_func(int);
+int __device__ file2_func(int x)
+{
+ return x + file3_func(x);
+}
diff --git a/Tests/CudaOnly/CircularLinkLine/file3.cu b/Tests/CudaOnly/CircularLinkLine/file3.cu
new file mode 100644
index 000000000..7f67187ed
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/file3.cu
@@ -0,0 +1,8 @@
+
+extern __device__ int file1_func(int);
+int __device__ file3_func(int x)
+{
+ if (x > 0)
+ return file1_func(-x);
+ return x;
+}
diff --git a/Tests/CudaOnly/CircularLinkLine/main.cu b/Tests/CudaOnly/CircularLinkLine/main.cu
new file mode 100644
index 000000000..1c19e8dc3
--- /dev/null
+++ b/Tests/CudaOnly/CircularLinkLine/main.cu
@@ -0,0 +1,5 @@
+
+int main(int argc, char** argv)
+{
+ return 0;
+}
diff --git a/Tests/CudaOnly/EnableStandard/CMakeLists.txt b/Tests/CudaOnly/EnableStandard/CMakeLists.txt
index 35a1deb69..54e2c1413 100644
--- a/Tests/CudaOnly/EnableStandard/CMakeLists.txt
+++ b/Tests/CudaOnly/EnableStandard/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaOnlyEnableStandard CUDA)
+project (EnableStandard CUDA)
#Goal for this example:
#build cuda sources that require C++11 to be enabled.
diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt
index 65d524339..ff6e77c33 100644
--- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt
+++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
-project (CudaOnlyExportPTX CUDA)
+project (ExportPTX CUDA)
#Goal for this example:
# How to generate PTX files instead of OBJECT files
diff --git a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt
index 5b969064f..fbef15f9e 100644
--- a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt
+++ b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaOnlGPUDebugFlag CUDA)
+project (GPUDebugFlag CUDA)
#Goal for this example:
#verify that -G enables gpu debug flags
diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt b/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt
deleted file mode 100644
index 62be1e6f2..000000000
--- a/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-cmake_minimum_required(VERSION 3.8)
-project(CudaOnlyLinkSystemDeviceLibraries CUDA)
-
-string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_35,code=compute_35 -gencode arch=compute_35,code=sm_35")
-set(CMAKE_CUDA_STANDARD 11)
-
-add_executable(CudaOnlyLinkSystemDeviceLibraries main.cu)
-set_target_properties( CudaOnlyLinkSystemDeviceLibraries
- PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
-target_link_libraries( CudaOnlyLinkSystemDeviceLibraries PRIVATE cublas_device)
-
-if(APPLE)
- # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
- set_property(TARGET CudaOnlyLinkSystemDeviceLibraries PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
-endif()
diff --git a/Tests/CudaOnly/PDB/CMakeLists.txt b/Tests/CudaOnly/PDB/CMakeLists.txt
index 34e1e5c35..6ecf98935 100644
--- a/Tests/CudaOnly/PDB/CMakeLists.txt
+++ b/Tests/CudaOnly/PDB/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.11)
-project (CudaOnlyPDB CUDA)
+project (PDB CUDA)
add_executable(CudaOnlyPDB main.cu)
set_target_properties(CudaOnlyPDB PROPERTIES
diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt
index 0c453a995..796e13382 100644
--- a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt
+++ b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaOnlyResolveDeviceSymbols CUDA)
+project (ResolveDeviceSymbols CUDA)
# Find nm and dumpbin
if(CMAKE_NM)
diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
index c934c5190..1e574d6cc 100644
--- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
+++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaOnlySeparateCompilation CUDA)
+project (SeparateCompilation CUDA)
#Goal for this example:
#Build a static library that defines multiple methods and kernels that
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 926d9ed09..e58204dc8 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.7)
-project (CudaOnlyWithDefs CUDA)
+project (WithDefs CUDA)
#verify that we can pass explicit cuda arch flags
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
index 4975feb2d..3bab1fec0 100644
--- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
+++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
@@ -9,17 +9,17 @@ add_custom_command(
)
set_source_files_properties(
- "${TestWorkingDir_BINARY_DIR}/customTarget.c"
+ "${TestWorkingDir_BINARY_DIR}/customTarget1.c"
"${TestWorkingDir_BINARY_DIR}/customTarget2.c"
PROPERTIES GENERATED 1)
add_executable(working "${TestWorkingDir_BINARY_DIR}/working.c"
- "${TestWorkingDir_BINARY_DIR}/customTarget.c")
+ "${TestWorkingDir_BINARY_DIR}/customTarget1.c")
add_custom_target(
Custom ALL
- COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget.c"
- BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget.c"
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget1.c"
+ BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget1.c"
WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}"
)
@@ -42,3 +42,23 @@ add_custom_target(
)
add_dependencies(working2 Custom2)
+
+file(MAKE_DIRECTORY ${TestWorkingDir_BINARY_DIR}/genex)
+add_custom_command(
+ OUTPUT "${TestWorkingDir_BINARY_DIR}/genex/working.c"
+ COMMAND "${CMAKE_COMMAND}" -E copy "${TestWorkingDir_SOURCE_DIR}/working.c.in" "${TestWorkingDir_BINARY_DIR}/genex/working.c"
+ WORKING_DIRECTORY "$<0:not_used/>${TestWorkingDir_BINARY_DIR}/$<1:genex>/"
+ COMMENT "custom command"
+)
+
+add_executable(workinggenex "${TestWorkingDir_BINARY_DIR}/genex/working.c"
+ "${TestWorkingDir_BINARY_DIR}/genex/customTarget.c")
+
+add_custom_target(
+ CustomGenex ALL
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${TestWorkingDir_SOURCE_DIR}/customTarget.c" "${TestWorkingDir_BINARY_DIR}/genex/customTarget.c"
+ BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/genex/customTarget.c"
+ WORKING_DIRECTORY "$<0:not_used/>${TestWorkingDir_BINARY_DIR}/$<1:genex>/"
+)
+
+add_dependencies(workinggenex CustomGenex)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 0f1a556ee..c6b7dbc95 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -155,6 +155,13 @@ add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c)
target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate)
cmake_policy(POP)
+cmake_policy(PUSH)
+cmake_policy(SET CMP0079 NEW)
+add_library(TopDirLib STATIC testTopDirLib.c)
+add_subdirectory(SubDirLinkA)
+add_subdirectory(SubDirLinkB)
+cmake_policy(POP)
+
macro(add_include_lib _libName)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "/* no content */\n")
add_library(${_libName} "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c")
@@ -508,11 +515,12 @@ install(
testLibCycleA testLibCycleB
testLibNoSONAME
cmp0022NEW cmp0022OLD
+ TopDirLib SubDirLinkA
systemlib
EXPORT exp
- RUNTIME DESTINATION $<1:bin>
- LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP
- ARCHIVE DESTINATION $<1:lib>
+ RUNTIME DESTINATION $<1:bin>$<0:/wrong>
+ LIBRARY DESTINATION $<1:lib>$<0:/wrong> NAMELINK_SKIP
+ ARCHIVE DESTINATION $<1:lib>$<0:/wrong>
${maybe_OBJECTS_DESTINATION}
FRAMEWORK DESTINATION Frameworks
BUNDLE DESTINATION Applications
@@ -566,6 +574,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2
testSharedLibDepends renamed_on_export
cmp0022NEW cmp0022OLD
+ TopDirLib SubDirLinkA
systemlib
NAMESPACE bld_
FILE ExportBuildTree.cmake
@@ -597,3 +606,39 @@ install(
)
install(DIRECTORY $<1:include/abs>$<0:/wrong> DESTINATION $<1:include>$<0:/wrong>)
install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs)
+
+
+#------------------------------------------------------------------------------
+# test export of INTERFACE_LINK_OPTIONS
+add_library(testLinkOptions INTERFACE)
+target_link_options(testLinkOptions INTERFACE INTERFACE_FLAG)
+
+install(TARGETS testLinkOptions
+ EXPORT RequiredExp DESTINATION lib)
+export(TARGETS testLinkOptions NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
+
+
+#------------------------------------------------------------------------------
+# test export of INTERFACE_LINK_DIRECTORIES
+add_library(testLinkDirectories INTERFACE)
+target_link_directories(testLinkDirectories INTERFACE
+ $<BUILD_INTERFACE:/interface/build>
+ $<INSTALL_INTERFACE:interface/install>)
+
+install(TARGETS testLinkDirectories
+ EXPORT RequiredExp DESTINATION lib)
+export(TARGETS testLinkDirectories NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
+
+
+#------------------------------------------------------------------------------
+# test export of INTERFACE_LINK_DEPENDS
+if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+ add_library(testLinkDepends INTERFACE)
+ set_property(TARGET testLinkDepends PROPERTY INTERFACE_LINK_DEPENDS
+ $<BUILD_INTERFACE:BUILD_LINK_DEPENDS>
+ $<INSTALL_INTERFACE:INSTALL_LINK_DEPENDS>)
+
+ install(TARGETS testLinkDepends
+ EXPORT RequiredExp DESTINATION lib)
+ export(TARGETS testLinkDepends NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
+endif()
diff --git a/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt b/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt
new file mode 100644
index 000000000..1c3c9dccc
--- /dev/null
+++ b/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_library(SubDirLinkAImported IMPORTED INTERFACE)
+target_compile_definitions(SubDirLinkAImported INTERFACE DEF_SubDirLinkAImportedForExport)
+
+target_link_libraries(TopDirLib PUBLIC SubDirLinkAImported)
+
+add_library(SubDirLinkA STATIC SubDirLinkA.c)
diff --git a/Tests/ExportImport/Export/SubDirLinkA/SubDirLinkA.c b/Tests/ExportImport/Export/SubDirLinkA/SubDirLinkA.c
new file mode 100644
index 000000000..abf76f556
--- /dev/null
+++ b/Tests/ExportImport/Export/SubDirLinkA/SubDirLinkA.c
@@ -0,0 +1,11 @@
+#ifdef DEF_SubDirLinkAImportedForExport
+# error "DEF_SubDirLinkAImportedForExport is defined but should not be!"
+#endif
+#ifndef DEF_SubDirLinkBImportedForExport
+# error "DEF_SubDirLinkBImportedForExport is not defined but should be!"
+#endif
+
+int testSubDirLinkA(void)
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Export/SubDirLinkB/CMakeLists.txt b/Tests/ExportImport/Export/SubDirLinkB/CMakeLists.txt
new file mode 100644
index 000000000..22e168ff8
--- /dev/null
+++ b/Tests/ExportImport/Export/SubDirLinkB/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_library(SubDirLinkBImported IMPORTED INTERFACE)
+target_compile_definitions(SubDirLinkBImported INTERFACE DEF_SubDirLinkBImportedForExport)
+
+target_link_libraries(SubDirLinkA PUBLIC SubDirLinkBImported)
diff --git a/Tests/ExportImport/Export/testTopDirLib.c b/Tests/ExportImport/Export/testTopDirLib.c
new file mode 100644
index 000000000..1ec68de1f
--- /dev/null
+++ b/Tests/ExportImport/Export/testTopDirLib.c
@@ -0,0 +1,11 @@
+#ifndef DEF_SubDirLinkAImportedForExport
+# error "DEF_SubDirLinkAImportedForExport is not defined but should be!"
+#endif
+#ifdef DEF_SubDirLinkBImportedForExport
+# error "DEF_SubDirLinkBImportedForExport is defined but should not be!"
+#endif
+
+int testTopDirLib(void)
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 39a89dc5b..67fcc0292 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -1,3 +1,9 @@
+# Prepare imported targets that the exported project itself imported.
+add_library(SubDirLinkAImported IMPORTED INTERFACE)
+target_compile_definitions(SubDirLinkAImported INTERFACE DEF_SubDirLinkAImportedForImport)
+add_library(SubDirLinkBImported IMPORTED INTERFACE)
+target_compile_definitions(SubDirLinkBImported INTERFACE DEF_SubDirLinkBImportedForImport)
+
# Import targets from the exported build tree.
include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake)
@@ -158,6 +164,11 @@ target_link_libraries(cmp0022OLD_exp_test exp_cmp0022OLD)
add_executable(cmp0022NEW_exp_test cmp0022NEW_test_vs6_2.cpp)
target_link_libraries(cmp0022NEW_exp_test exp_cmp0022NEW)
+add_executable(SubDirLink_bld SubDirLink.c)
+target_link_libraries(SubDirLink_bld PRIVATE bld_TopDirLib bld_SubDirLinkA)
+add_executable(SubDirLink_exp SubDirLink.c)
+target_link_libraries(SubDirLink_exp PRIVATE exp_TopDirLib exp_SubDirLinkA)
+
# Try building a plugin to an executable imported from the build tree.
add_library(imp_mod1b MODULE imp_mod1.c)
target_link_libraries(imp_mod1b bld_testExe2)
@@ -472,3 +483,20 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA
endif()
endif()
endif()
+
+#---------------------------------------------------------------------------------
+# check that imported libraries have the expected INTERFACE_LINK_OPTIONS property
+checkForProperty(bld_testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG")
+checkForProperty(Req::testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG")
+
+#---------------------------------------------------------------------------------
+# check that imported libraries have the expected INTERFACE_LINK_DIRECTORIES property
+checkForProperty(bld_testLinkDirectories "INTERFACE_LINK_DIRECTORIES" "/interface/build")
+checkForProperty(Req::testLinkDirectories "INTERFACE_LINK_DIRECTORIES" "${CMAKE_INSTALL_PREFIX}/interface/install")
+
+#---------------------------------------------------------------------------------
+# check that imported libraries have the expected INTERFACE_LINK_DEPENDS property
+if(CMAKE_GENERATOR MATCHES "Make|Ninja")
+ checkForProperty(bld_testLinkDepends "INTERFACE_LINK_DEPENDS" "BUILD_LINK_DEPENDS")
+ checkForProperty(Req::testLinkDepends "INTERFACE_LINK_DEPENDS" "${CMAKE_INSTALL_PREFIX}/INSTALL_LINK_DEPENDS")
+endif()
diff --git a/Tests/ExportImport/Import/A/SubDirLink.c b/Tests/ExportImport/Import/A/SubDirLink.c
new file mode 100644
index 000000000..eb4b8609a
--- /dev/null
+++ b/Tests/ExportImport/Import/A/SubDirLink.c
@@ -0,0 +1,14 @@
+#ifndef DEF_SubDirLinkAImportedForImport
+# error "DEF_SubDirLinkAImportedForImport is not defined but should be!"
+#endif
+#ifndef DEF_SubDirLinkBImportedForImport
+# error "DEF_SubDirLinkBImportedForImport is not defined but should be!"
+#endif
+
+extern int testTopDirLib(void);
+extern int testSubDirLinkA(void);
+
+int main(void)
+{
+ return (testTopDirLib() + testSubDirLinkA() + 0);
+}
diff --git a/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp b/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp
new file mode 100644
index 000000000..2b18b2e09
--- /dev/null
+++ b/Tests/ExportImport/Import/A/imp_testLinkOptions.cpp
@@ -0,0 +1,8 @@
+
+#include "testSharedLibRequired.h"
+
+int foo()
+{
+ TestSharedLibRequired req;
+ return req.foo();
+}
diff --git a/Tests/FindPackageModeMakefileTest/foo.cpp b/Tests/FindPackageModeMakefileTest/foo.cpp
index 6aea22629..7cb9381ed 100644
--- a/Tests/FindPackageModeMakefileTest/foo.cpp
+++ b/Tests/FindPackageModeMakefileTest/foo.cpp
@@ -1,3 +1,5 @@
+#include "foo.h"
+
int foo()
{
return 1477;
diff --git a/Tests/FindPackageModeMakefileTest/foo.h b/Tests/FindPackageModeMakefileTest/foo.h
index 4ec598ad5..7051edac4 100644
--- a/Tests/FindPackageModeMakefileTest/foo.h
+++ b/Tests/FindPackageModeMakefileTest/foo.h
@@ -1,6 +1,14 @@
#ifndef FOO_H
#define FOO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int foo();
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 08768711c..3fd55413e 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -188,7 +188,7 @@ find_package(ArchC 3.1 EXACT NAMES zot)
find_package(ArchD 4.0 EXACT NAMES zot)
unset(CMAKE_LIBRARY_ARCHITECTURE)
-# Test <Package>_DIR environment variable.
+# Test <PackageName>_DIR environment variable.
# We erase the main prefix path to ensure the env var is used.
set(CMAKE_PREFIX_PATH)
set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
diff --git a/Tests/GoogleTest/Test/CMakeLists.txt b/Tests/GoogleTest/Test/CMakeLists.txt
index f798d313c..baf00d53f 100644
--- a/Tests/GoogleTest/Test/CMakeLists.txt
+++ b/Tests/GoogleTest/Test/CMakeLists.txt
@@ -44,12 +44,13 @@ endif()
set_tests_properties(set2.GoogleTest.ConditionalFail.foo PROPERTIES WILL_FAIL YES)
-# Search specific sources to get the test list
-add_executable(test_gtest2 main2.cxx)
+# Search specific sources to get the test list. Include an empty file
+# to ensure they are handled correctly too.
+add_executable(test_gtest2 main2.cxx empty.cxx)
target_link_libraries(test_gtest2 GTest::Main)
gtest_add_tests(TARGET test_gtest2
TEST_LIST testList
- SOURCES main2.h
+ SOURCES main2.h empty.cxx
)
set(expectedTests
GoogleTest.SomethingElse
diff --git a/Tests/GoogleTest/Test/empty.cxx b/Tests/GoogleTest/Test/empty.cxx
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/GoogleTest/Test/empty.cxx
diff --git a/Tests/ImportedSameName/A/CMakeLists.txt b/Tests/ImportedSameName/A/CMakeLists.txt
new file mode 100644
index 000000000..0a31b40e2
--- /dev/null
+++ b/Tests/ImportedSameName/A/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_library(a STATIC a.c)
+target_compile_definitions(a INTERFACE DEF_A)
+
+add_library(sameName INTERFACE IMPORTED)
+target_link_libraries(sameName INTERFACE a)
+
+add_library(ifaceA INTERFACE)
+target_link_libraries(ifaceA INTERFACE sameName)
diff --git a/Tests/ImportedSameName/A/a.c b/Tests/ImportedSameName/A/a.c
new file mode 100644
index 000000000..4ef36980e
--- /dev/null
+++ b/Tests/ImportedSameName/A/a.c
@@ -0,0 +1,3 @@
+void a(void)
+{
+}
diff --git a/Tests/ImportedSameName/B/CMakeLists.txt b/Tests/ImportedSameName/B/CMakeLists.txt
new file mode 100644
index 000000000..d93032626
--- /dev/null
+++ b/Tests/ImportedSameName/B/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_library(b STATIC b.c)
+target_compile_definitions(b INTERFACE DEF_B)
+
+add_library(sameName INTERFACE IMPORTED)
+target_link_libraries(sameName INTERFACE b)
+
+add_library(ifaceB INTERFACE)
+target_link_libraries(ifaceB INTERFACE sameName)
diff --git a/Tests/ImportedSameName/B/b.c b/Tests/ImportedSameName/B/b.c
new file mode 100644
index 000000000..c7c7df458
--- /dev/null
+++ b/Tests/ImportedSameName/B/b.c
@@ -0,0 +1,3 @@
+void b(void)
+{
+}
diff --git a/Tests/ImportedSameName/CMakeLists.txt b/Tests/ImportedSameName/CMakeLists.txt
new file mode 100644
index 000000000..4292c123f
--- /dev/null
+++ b/Tests/ImportedSameName/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.12)
+project(ImportedSameName C)
+
+add_subdirectory(A)
+add_subdirectory(B)
+
+add_executable(ImportedSameName main.c)
+target_link_libraries(ImportedSameName PRIVATE ifaceA ifaceB)
diff --git a/Tests/ImportedSameName/main.c b/Tests/ImportedSameName/main.c
new file mode 100644
index 000000000..a0cb27fee
--- /dev/null
+++ b/Tests/ImportedSameName/main.c
@@ -0,0 +1,16 @@
+#ifndef DEF_A
+# error "DEF_A not defined"
+#endif
+#ifndef DEF_B
+# error "DEF_B not defined"
+#endif
+
+extern void a(void);
+extern void b(void);
+
+int main(void)
+{
+ a();
+ b();
+ return 0;
+}
diff --git a/Tests/LinkDirectory/External/CMakeLists.txt b/Tests/LinkDirectory/External/CMakeLists.txt
index f7c840f9a..d2a1f9f77 100644
--- a/Tests/LinkDirectory/External/CMakeLists.txt
+++ b/Tests/LinkDirectory/External/CMakeLists.txt
@@ -1,6 +1,20 @@
cmake_minimum_required(VERSION 2.8)
project(LinkDirectoryExternal C)
+
+add_executable(myexe2 myexe.c)
+set_property(TARGET myexe2 PROPERTY OUTPUT_NAME LinkDirectory2)
+target_link_directories(myexe2 PRIVATE lib "${CMAKE_CURRENT_SOURCE_DIR}/../lib")
+target_link_libraries(myexe2 PRIVATE mylibA mylibB)
+
+add_library (mylibs INTERFACE)
+target_link_directories(mylibs INTERFACE lib "${CMAKE_CURRENT_SOURCE_DIR}/../lib")
+target_link_libraries(mylibs INTERFACE mylibA mylibB)
+add_executable(myexe3 myexe.c)
+set_property(TARGET myexe3 PROPERTY OUTPUT_NAME LinkDirectory3)
+target_link_libraries(myexe3 PRIVATE mylibs)
+
+
# Test CMP0015 OLD behavior: -L../lib
cmake_policy(SET CMP0015 OLD)
link_directories(../lib)
diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt
index f764b3a4f..5403d297c 100644
--- a/Tests/MathTest/CMakeLists.txt
+++ b/Tests/MathTest/CMakeLists.txt
@@ -13,14 +13,35 @@ set(expressions
"-1 + +1"
"+1 - -1"
"+1 - - + + -(-3 + - - +1)"
+ "1000 -12*5"
+ "1000 +12*-5"
+ "1000 -12*-5"
)
-set(FILE_EXPRESSIONS "")
-foreach(expression
- ${expressions})
- math(EXPR expr "${expression}")
- string(APPEND FILE_EXPRESSIONS "TEST_EXPRESSION(${expression}, ${expr})\n")
-endforeach()
+set(FILE_EXPRESSIONS "extern void test_expression(int x, int y, const char * text);\n")
+
+
+macro(add_math_test expression)
+ math(EXPR result ${expression} ${ARGV1} ${ARGV2})
+ set(CODE "test_expression(${expression}, ${result}, \"${expression}\");")
+ string(APPEND FILE_EXPRESSIONS "${CODE}\n")
+endmacro()
+
+macro(add_math_tests)
+ foreach (expression ${expressions})
+ add_math_test(${expression} ${ARGV0} ${ARGV1})
+ endforeach ()
+endmacro()
+
+add_math_tests()
+add_math_tests("OUTPUT_FORMAT" "DECIMAL")
+add_math_tests("OUTPUT_FORMAT" "HEXADECIMAL")
+
+# Avoid the test with negative result and hexadecimal formatting
+# therefore more tests with a negative result
+add_math_test("-12*5")
+add_math_test("12*-5")
+
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/MathTestTests.h.in"
diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx
index 124eba46f..fbcddc4ed 100644
--- a/Tests/MathTest/MathTestExec.cxx
+++ b/Tests/MathTest/MathTestExec.cxx
@@ -1,21 +1,43 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
-#define TEST_EXPRESSION(x, y) \
- if ((x) != (y)) { \
- printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in " \
- "CMake returns: %d\n", \
- #x, (x), (y)); \
- res++; \
+int res = 0;
+bool print = false;
+
+void test_expression(int x, int y, const char* text)
+{
+ bool fail = (x) != (y);
+ if (fail) {
+ res++;
+ printf("Problem with EXPR:");
+ }
+ if (fail || print) {
+ printf("Expression: \"%s\" in CMake returns %d", text, (y));
+ if (fail) {
+ printf(" while in C returns: %d", (x));
+ }
+ printf("\n");
}
+}
int main(int argc, char* argv[])
{
- if (argc > 1) {
- printf("Usage: %s\n", argv[0]);
+ if (argc > 2) {
+ printf("Usage: %s [print]\n", argv[0]);
return 1;
}
- int res = 0;
+
+ if (argc > 1) {
+ if (strcmp(argv[1], "print") != 0) {
+ printf("Usage: %s [print]\n", argv[0]);
+ return 1;
+ }
+ print = true;
+ }
+
#include "MathTestTests.h"
+
if (res != 0) {
printf("%s: %d math tests failed\n", argv[0], res);
return 1;
diff --git a/Tests/OutName/CMakeLists.txt b/Tests/OutName/CMakeLists.txt
new file mode 100644
index 000000000..f024defc2
--- /dev/null
+++ b/Tests/OutName/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.12)
+project(OutName C)
+
+add_executable(OutName main.c)
+set_property(TARGET OutName PROPERTY PREFIX exe.)
+set_property(TARGET OutName PROPERTY SUFFIX .exe)
diff --git a/Tests/OutName/main.c b/Tests/OutName/main.c
new file mode 100644
index 000000000..8488f4e58
--- /dev/null
+++ b/Tests/OutName/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/AutogenTest.cmake b/Tests/QtAutogen/AutogenTest.cmake
index 8c0a14fca..3969a8931 100644
--- a/Tests/QtAutogen/AutogenTest.cmake
+++ b/Tests/QtAutogen/AutogenTest.cmake
@@ -6,7 +6,7 @@ if(QT_QMAKE_EXECUTABLE)
list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
endif()
-if (QT_TEST_VERSION STREQUAL 4)
+if (QT_TEST_VERSION EQUAL 4)
find_package(Qt4 REQUIRED)
include(UseQt4)
@@ -21,7 +21,7 @@ if (QT_TEST_VERSION STREQUAL 4)
qt4_generate_moc(${ARGN})
endmacro()
-elseif(QT_TEST_VERSION STREQUAL 5)
+elseif(QT_TEST_VERSION EQUAL 5)
find_package(Qt5Widgets REQUIRED)
set(QT_QTCORE_TARGET Qt5::Core)
diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake
index cd05aebec..01ed7e93c 100644
--- a/Tests/QtAutogen/CommonTests.cmake
+++ b/Tests/QtAutogen/CommonTests.cmake
@@ -12,7 +12,7 @@ if(QT_TEST_ALLOW_QT_MACROS)
endif()
ADD_AUTOGEN_TEST(UicSkipSource)
ADD_AUTOGEN_TEST(RccSkipSource)
-if(NOT QT_TEST_VERSION STREQUAL 4)
+if(QT_TEST_VERSION GREATER 4)
ADD_AUTOGEN_TEST(MocMacroName mocMacroName)
endif()
ADD_AUTOGEN_TEST(MocDepends)
@@ -23,10 +23,13 @@ endif()
if(QT_TEST_ALLOW_QT_MACROS)
ADD_AUTOGEN_TEST(MocCMP0071)
endif()
+if(QT_TEST_VERSION GREATER 4)
+ ADD_AUTOGEN_TEST(MocOsMacros)
+endif()
ADD_AUTOGEN_TEST(UicInclude uicInclude)
ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface)
ADD_AUTOGEN_TEST(ObjectLibrary someProgram)
-if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4))
+if(APPLE AND (QT_TEST_VERSION GREATER 4))
ADD_AUTOGEN_TEST(MacOsFW)
endif()
ADD_AUTOGEN_TEST(Parallel parallel)
@@ -39,7 +42,7 @@ ADD_AUTOGEN_TEST(SameName sameName)
ADD_AUTOGEN_TEST(StaticLibraryCycle slc)
# Rerun tests
ADD_AUTOGEN_TEST(RerunMocBasic)
-if(NOT QT_TEST_VERSION STREQUAL 4)
+if(QT_TEST_VERSION GREATER 4)
ADD_AUTOGEN_TEST(RerunMocPlugin)
endif()
ADD_AUTOGEN_TEST(RerunRccDepends)
diff --git a/Tests/QtAutogen/DefinesTest/CMakeLists.txt b/Tests/QtAutogen/DefinesTest/CMakeLists.txt
index de228454a..3761dd842 100644
--- a/Tests/QtAutogen/DefinesTest/CMakeLists.txt
+++ b/Tests/QtAutogen/DefinesTest/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(DefinesTest)
# Qt4 only definitions test
-if(NOT QT_TEST_VERSION STREQUAL 4)
+if(NOT QT_TEST_VERSION EQUAL 4)
message(ERROR "Invalid Qt test version. This test is for Qt4 only.")
endif()
diff --git a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
index b1c4fc32f..1ad6238df 100644
--- a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
+++ b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt
@@ -9,7 +9,7 @@ set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
set(MOC_INCLUDE_NAME "mocIncludeRelaxed")
include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake)
-# Relaxed ony executable
+# Relaxed only executable
add_executable(mocIncludeRelaxedOnly
RObjA.cpp
RObjB.cpp
diff --git a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
new file mode 100644
index 000000000..e7b670e65
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.11)
+project(MocOsMacros)
+include("../AutogenTest.cmake")
+
+# Tests if moc processes Q_OS_XXX macros
+
+message( "Qt5Core_VERSION: ${Qt5Core_VERSION}" )
+message(
+ "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND: "
+ ${CMAKE_CXX_COMPILER_PREDEFINES_COMMAND} )
+
+# On some platforms (e.g. MAC) Q_OS_XXX requires moc to include moc_predefs.h
+# which is supported since Qt 5.8 and requires
+# CMAKE_CXX_COMPILER_PREDEFINES_COMMAND to be defined.
+if( ( ${Qt5Core_VERSION} VERSION_GREATER_EQUAL "5.8" ) AND
+ DEFINED CMAKE_CXX_COMPILER_PREDEFINES_COMMAND
+)
+ message( "Test enabled!" )
+ message(
+ "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: "
+ ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} )
+
+ set(CMAKE_AUTOMOC True)
+ add_executable(mocOsMacros
+ main.cpp
+ TestClass.cpp
+ TestClass.hpp
+ )
+ target_link_libraries(mocOsMacros PRIVATE ${QT_QTCORE_TARGET})
+else()
+ message( "Test disabled!" )
+endif()
diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.cpp b/Tests/QtAutogen/MocOsMacros/TestClass.cpp
new file mode 100644
index 000000000..340d130b1
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/TestClass.cpp
@@ -0,0 +1,77 @@
+#include "TestClass.hpp"
+#include <iostream>
+
+// -- Mac
+#ifndef Q_OS_MAC
+void TestClass::MacNotDef()
+{
+ std::cout << "MacNotDef\n";
+}
+#else
+void TestClass::MacNotDefElse()
+{
+ std::cout << "MacNotDefElse\n";
+}
+#endif
+
+#ifdef Q_OS_MAC
+void TestClass::MacDef()
+{
+ std::cout << "MacDef\n";
+}
+#else
+void TestClass::MacDefElse()
+{
+ std::cout << "MacDefElse\n";
+}
+#endif
+
+// -- Unix
+#ifndef Q_OS_UNIX
+void TestClass::UnixNotDef()
+{
+ std::cout << "UnixNotDef\n";
+}
+#else
+void TestClass::UnixNotDefElse()
+{
+ std::cout << "UnixNotDefElse\n";
+}
+#endif
+
+#ifdef Q_OS_UNIX
+void TestClass::UnixDef()
+{
+ std::cout << "UnixDef\n";
+}
+#else
+void TestClass::UnixDefElse()
+{
+ std::cout << "UnixDefElse\n";
+}
+#endif
+
+// -- Windows
+#ifndef Q_OS_WIN
+void TestClass::WindowsNotDef()
+{
+ std::cout << "WindowsNotDef\n";
+}
+#else
+void TestClass::WindowsNotDefElse()
+{
+ std::cout << "WindowsNotDefElse\n";
+}
+#endif
+
+#ifdef Q_OS_WIN
+void TestClass::WindowsDef()
+{
+ std::cout << "WindowsDef\n";
+}
+#else
+void TestClass::WindowsDefElse()
+{
+ std::cout << "WindowsDefElse\n";
+}
+#endif
diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.hpp b/Tests/QtAutogen/MocOsMacros/TestClass.hpp
new file mode 100644
index 000000000..53000aa79
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/TestClass.hpp
@@ -0,0 +1,52 @@
+#ifndef TestClass_hpp
+#define TestClass_hpp
+
+#include <QObject>
+#include <QtGlobal>
+
+class TestClass : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+
+// -- Mac
+#ifndef Q_OS_MAC
+ void MacNotDef();
+#else
+ void MacNotDefElse();
+#endif
+
+#ifdef Q_OS_MAC
+ void MacDef();
+#else
+ void MacDefElse();
+#endif
+
+// -- Unix
+#ifndef Q_OS_UNIX
+ void UnixNotDef();
+#else
+ void UnixNotDefElse();
+#endif
+
+#ifdef Q_OS_UNIX
+ void UnixDef();
+#else
+ void UnixDefElse();
+#endif
+
+// -- Windows
+#ifndef Q_OS_WIN
+ void WindowsNotDef();
+#else
+ void WindowsNotDefElse();
+#endif
+
+#ifdef Q_OS_WIN
+ void WindowsDef();
+#else
+ void WindowsDefElse();
+#endif
+};
+
+#endif /* TestClass_hpp */
diff --git a/Tests/QtAutogen/MocOsMacros/main.cpp b/Tests/QtAutogen/MocOsMacros/main.cpp
new file mode 100644
index 000000000..f8eec3cbc
--- /dev/null
+++ b/Tests/QtAutogen/MocOsMacros/main.cpp
@@ -0,0 +1,32 @@
+#include "TestClass.hpp"
+#include <QtGlobal>
+
+int main()
+{
+ TestClass a;
+#ifdef Q_OS_MAC
+ a.MacNotDefElse();
+ a.MacDef();
+#else
+ a.MacNotDef();
+ a.MacDefElse();
+#endif
+
+#ifdef Q_OS_UNIX
+ a.UnixNotDefElse();
+ a.UnixDef();
+#else
+ a.UnixNotDef();
+ a.UnixDefElse();
+#endif
+
+#ifdef Q_OS_WIN
+ a.WindowsNotDefElse();
+ a.WindowsDef();
+#else
+ a.WindowsNotDef();
+ a.WindowsDefElse();
+#endif
+
+ return 0;
+}
diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
index 0bb033929..6fad80c09 100644
--- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
@@ -16,6 +16,7 @@ try_compile(MOC_RERUN
"${mocBasicSrcDir}"
MocBasic
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
index 8a89b3819..b5287c198 100644
--- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
@@ -19,6 +19,7 @@ try_compile(MOC_PLUGIN
"${mocPlugSrcDir}"
MocPlugin
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
index bc0085fc4..ca22aeb21 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.10)
project(MocPlugin)
include("../../AutogenTest.cmake")
-if (NOT QT_TEST_VERSION STREQUAL 5)
- message(SEND_ERROR "Invalid Qt version specified.")
+if (QT_TEST_VERSION LESS 5)
+ message(SEND_ERROR "Qt 5 or higher required.")
endif()
set(CMAKE_AUTOMOC_DEPEND_FILTERS
diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
index f09865d09..4dc24fec0 100644
--- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
@@ -19,6 +19,7 @@ try_compile(RCC_DEPENDS
"${rccDepSD}"
RccConfigChange
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
index 52e2488b8..4268de26e 100644
--- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
@@ -21,6 +21,7 @@ try_compile(RCC_DEPENDS
"${rccDepSD}"
RccDepends
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/SameName/CMakeLists.txt b/Tests/QtAutogen/SameName/CMakeLists.txt
index c7d6e524e..931e40f16 100644
--- a/Tests/QtAutogen/SameName/CMakeLists.txt
+++ b/Tests/QtAutogen/SameName/CMakeLists.txt
@@ -28,7 +28,7 @@ set_target_properties(sameName PROPERTIES
)
# Set different compression levels
-if (QT_TEST_VERSION STREQUAL 4)
+if (QT_TEST_VERSION EQUAL 4)
set(rccCompress "-compress")
else()
set(rccCompress "--compress")
diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake
index bc7c7e294..0e2718807 100644
--- a/Tests/QtAutogen/TestMacros.cmake
+++ b/Tests/QtAutogen/TestMacros.cmake
@@ -4,6 +4,7 @@ if(NOT _isMultiConfig) # Set in Tests/CMakeLists.txt
list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>")
endif()
list(APPEND Autogen_BUILD_OPTIONS
+ "-DCMAKE_AUTOGEN_VERBOSE=1"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
)
@@ -49,7 +50,7 @@ if(NON_ASCII_BDIR)
# Qt4 moc does not support utf8 paths in _parameter files generated by
# qtx_wrap_cpp
# https://bugreports.qt.io/browse/QTBUG-35480
- if(QT_TEST_VERSION STREQUAL 4)
+ if(QT_TEST_VERSION EQUAL 4)
set(QT_TEST_ALLOW_QT_MACROS FALSE)
endif()
# On windows qtx_wrap_cpp also fails in Qt5 when used on a path that
diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
index 3fbb2cf5e..9137f2be6 100644
--- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake
+++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
@@ -5,7 +5,9 @@ add_library(car foo.cxx)
add_library(bar bar.c)
add_library(dog foo.cxx)
target_link_libraries(foo PRIVATE car bar dog debug -lm)
-export(TARGETS bar dog car foo ANDROID_MK
+add_library(foo2 foo.cxx)
+target_link_options(foo2 INTERFACE -lm)
+export(TARGETS bar dog car foo foo2 ANDROID_MK
${build_BINARY_DIR}/Android.mk)
-install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp)
+install(TARGETS bar dog car foo foo2 DESTINATION lib EXPORT myexp)
install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules)
diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
index bbf67a51c..a0e5044b1 100644
--- a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
+++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt
@@ -24,3 +24,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog
LOCAL_EXPORT_LDLIBS := -lm
LOCAL_HAS_CPP := true
include.*PREBUILT_STATIC_LIBRARY.*
+.*
+include.*CLEAR_VARS.*
+LOCAL_MODULE.*foo2
+LOCAL_SRC_FILES.*.*foo2.*
+LOCAL_CPP_FEATURES.*rtti exceptions
+LOCAL_EXPORT_LDFLAGS := -lm
+LOCAL_HAS_CPP := true
+include.*PREBUILT_STATIC_LIBRARY.*
diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
index 3515fb9e9..28b1c210e 100644
--- a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
+++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt
@@ -26,3 +26,11 @@ LOCAL_STATIC_LIBRARIES.*car bar dog
LOCAL_EXPORT_LDLIBS := -lm
LOCAL_HAS_CPP := true
include.*PREBUILT_STATIC_LIBRARY.*
+
+include.*CLEAR_VARS.*
+LOCAL_MODULE.*foo2
+LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo2.*
+LOCAL_CPP_FEATURES.*rtti exceptions
+LOCAL_EXPORT_LDFLAGS := -lm
+LOCAL_HAS_CPP := true
+include.*PREBUILT_STATIC_LIBRARY.*
diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake
new file mode 100644
index 000000000..063a7f3a7
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-COMMAND.cmake
@@ -0,0 +1,5 @@
+if(DEFINED CMP0080_VALUE)
+ cmake_policy(SET CMP0080 ${CMP0080_VALUE})
+endif()
+
+include(BundleUtilities)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface-result.txt
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-result.txt
diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt
new file mode 100644
index 000000000..1454b0c82
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-NEW-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at .*/Modules/BundleUtilities\.cmake:[0-9]+ \(message\):
+ BundleUtilities cannot be included at configure time!
diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake
new file mode 100644
index 000000000..558c16d16
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0080 NEW)
+include(BundleUtilities)
diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake
new file mode 100644
index 000000000..a65d92f11
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0080 OLD)
+include(BundleUtilities)
diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt
new file mode 100644
index 000000000..a1a0e8fe4
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt
@@ -0,0 +1,4 @@
+CMake Warning \(dev\) at .*/Modules/BundleUtilities\.cmake:[0-9]+ \(message\):
+ Policy CMP0080 is not set: BundleUtilities prefers not to be included at
+ configure time\. Run "cmake --help-policy CMP0080" for policy details\. Use
+ the cmake_policy command to set the policy and suppress this warning\.
diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-WARN.cmake b/Tests/RunCMake/BundleUtilities/CMP0080-WARN.cmake
new file mode 100644
index 000000000..45f6f92b9
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMP0080-WARN.cmake
@@ -0,0 +1 @@
+include(BundleUtilities)
diff --git a/Tests/RunCMake/BundleUtilities/CMakeLists.txt b/Tests/RunCMake/BundleUtilities/CMakeLists.txt
new file mode 100644
index 000000000..6dd8cdf55
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake b/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake
new file mode 100644
index 000000000..14aaff197
--- /dev/null
+++ b/Tests/RunCMake/BundleUtilities/RunCMakeTest.cmake
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.4)
+include(RunCMake)
+
+# TODO Migrate Tests/BundleUtilities here
+
+run_cmake(CMP0080-OLD)
+run_cmake(CMP0080-NEW)
+run_cmake(CMP0080-WARN)
+run_cmake_command(CMP0080-COMMAND-OLD ${CMAKE_COMMAND} -DCMP0080_VALUE:STRING=OLD -P ${RunCMake_SOURCE_DIR}/CMP0080-COMMAND.cmake)
+run_cmake_command(CMP0080-COMMAND-NEW ${CMAKE_COMMAND} -DCMP0080_VALUE:STRING=NEW -P ${RunCMake_SOURCE_DIR}/CMP0080-COMMAND.cmake)
+run_cmake_command(CMP0080-COMMAND-WARN ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/CMP0080-COMMAND.cmake)
diff --git a/Tests/RunCMake/Byproducts/CMakeLists.txt b/Tests/RunCMake/Byproducts/CMakeLists.txt
new file mode 100644
index 000000000..bf2ef1506
--- /dev/null
+++ b/Tests/RunCMake/Byproducts/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.10)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Byproducts/CleanByproducts.cmake b/Tests/RunCMake/Byproducts/CleanByproducts.cmake
new file mode 100644
index 000000000..85d958295
--- /dev/null
+++ b/Tests/RunCMake/Byproducts/CleanByproducts.cmake
@@ -0,0 +1,93 @@
+cmake_minimum_required(VERSION 3.10)
+project(CleanByproducts)
+
+# Configurable parameters
+set(TEST_CLEAN_NO_CUSTOM FALSE CACHE BOOL "Value for the CLEAN_NO_CUSTOM PROPERTY")
+set(TEST_BUILD_EVENTS TRUE CACHE BOOL "Create byproducts with build events")
+set(TEST_CUSTOM_TARGET TRUE CACHE BOOL "Create a byproduct with a custom target")
+set(TEST_CUSTOM_COMMAND TRUE CACHE BOOL "Create a byproduct with a custom command")
+
+set_property(DIRECTORY PROPERTY CLEAN_NO_CUSTOM ${TEST_CLEAN_NO_CUSTOM})
+
+macro(add_build_event)
+ set(oneValueArgs EVENT)
+
+ cmake_parse_Arguments(ABE "" "${oneValueArgs}" "" ${ARGN})
+
+ # Create two byproducts and only declare one
+ add_custom_command(TARGET foo
+ ${ABE_EVENT}
+ COMMAND ${CMAKE_COMMAND} -E touch foo.${ABE_EVENT}
+ COMMAND ${CMAKE_COMMAND} -E touch foo.${ABE_EVENT}.notdeclared
+ COMMENT "Creating byproducts with ${ABE_EVENT}"
+ BYPRODUCTS foo.${ABE_EVENT}
+ )
+
+ # The nondeclared byproduct should always be present
+ list(APPEND EXPECTED_PRESENT foo.${ABE_EVENT}.notdeclared)
+
+ # If CLEAN_NO_CUSTOM is set, the declared byproduct should be present
+ if(TEST_CLEAN_NO_CUSTOM)
+ list(APPEND EXPECTED_PRESENT foo.${ABE_EVENT})
+ else()
+ list(APPEND EXPECTED_DELETED foo.${ABE_EVENT})
+ endif()
+endmacro()
+
+add_executable(foo foo.cpp)
+
+# Test build events
+if(TEST_BUILD_EVENTS)
+ add_build_event(EVENT "PRE_BUILD" ENABLE ${TEST_PRE_BUILD})
+ add_build_event(EVENT "PRE_LINK" ENABLE ${TEST_PRE_LINK})
+ add_build_event(EVENT "POST_BUILD" ENABLE ${TEST_POST_BUILD})
+endif()
+
+# Custom command that generates byproducts
+if(TEST_CUSTOM_COMMAND)
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp.in "void bar() {}\n")
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp
+ COMMAND ${CMAKE_COMMAND} -E touch foo.customcommand
+ COMMAND ${CMAKE_COMMAND} -E touch foo.customcommand.notdeclared
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/bar.cpp
+ BYPRODUCTS foo.customcommand
+ COMMENT "Creating byproducts with a custom command"
+ )
+
+ # The nondeclared byproduct should always be present
+ list(APPEND EXPECTED_PRESENT "foo.customcommand.notdeclared")
+
+ # If CLEAN_NO_CUSTOM is set, both the output and byproduct should be present
+ if(TEST_CLEAN_NO_CUSTOM)
+ list(APPEND EXPECTED_PRESENT "bar.cpp")
+ list(APPEND EXPECTED_PRESENT "foo.customcommand")
+ else()
+ list(APPEND EXPECTED_DELETED "bar.cpp")
+ list(APPEND EXPECTED_DELETED "foo.customcommand")
+ endif()
+
+ target_sources(foo PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/bar.cpp")
+endif()
+
+# Custom target that generates byproducts
+if(TEST_CUSTOM_TARGET)
+ add_custom_target(foo_file ALL
+ DEPENDS foo
+ COMMAND ${CMAKE_COMMAND} -E touch foo.customtarget
+ COMMAND ${CMAKE_COMMAND} -E touch foo.customtarget.notdeclared
+ BYPRODUCTS foo.customtarget
+ COMMENT "Creating byproducts with a custom target"
+ )
+
+ # The nondeclared byproduct should always be present
+ list(APPEND EXPECTED_PRESENT "foo.customtarget.notdeclared")
+
+ # If CLEAN_NO_CUSTOM is set, the declared byproduct should be present
+ if(TEST_CLEAN_NO_CUSTOM)
+ list(APPEND EXPECTED_PRESENT "foo.customtarget")
+ else()
+ list(APPEND EXPECTED_DELETED "foo.customtarget")
+ endif()
+endif()
+
+configure_file(files.cmake.in files.cmake)
diff --git a/Tests/RunCMake/Byproducts/RunCMakeTest.cmake b/Tests/RunCMake/Byproducts/RunCMakeTest.cmake
new file mode 100644
index 000000000..a7584ee4b
--- /dev/null
+++ b/Tests/RunCMake/Byproducts/RunCMakeTest.cmake
@@ -0,0 +1,58 @@
+include(RunCMake)
+
+function(run_CleanByproducts case)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CleanByproducts-${case}-build)
+ set(RunCMake_TEST_OPTIONS "${ARGN}")
+
+ run_cmake(CleanByproducts)
+ set(RunCMake_TEST_NO_CLEAN 1)
+
+ run_cmake_command(CleanByProducts-build ${CMAKE_COMMAND} --build .)
+ include("${RunCMake_TEST_BINARY_DIR}/files.cmake")
+
+ message("Checking that all expected files are present")
+ check_files(EXPECTED_PRESENT "${RunCMake_TEST_BINARY_DIR}" TRUE)
+ check_files(EXPECTED_DELETED "${RunCMake_TEST_BINARY_DIR}" TRUE)
+
+ run_cmake_command(CleanByProducts-clean ${CMAKE_COMMAND} --build . --target clean)
+
+ message("Checking that only the expected files are present after cleaning")
+ check_files(EXPECTED_PRESENT "${RunCMake_TEST_BINARY_DIR}" TRUE)
+ check_files(EXPECTED_DELETED "${RunCMake_TEST_BINARY_DIR}" FALSE)
+endfunction()
+
+function(check_files list path has_to_exist)
+ foreach(file IN LISTS ${list})
+ message("Checking ${file}")
+ set(file_exists FALSE)
+ if(EXISTS "${path}/${file}")
+ set(file_exists TRUE)
+ endif()
+
+ if(file_exists AND NOT has_to_exist)
+ message(FATAL_ERROR "${file} should have been deleted")
+ elseif(NOT file_exists AND has_to_exist)
+ message(FATAL_ERROR "${file} does not exist")
+ elseif(file_exists AND has_to_exist)
+ message("${file} found as expected")
+ elseif(NOT file_exists AND NOT has_to_exist)
+ message("${file} deleted as expected")
+ endif()
+
+ endforeach()
+endfunction()
+
+
+# Iterate through all possible test values
+set(counter 0)
+foreach(test_clean_no_custom TRUE FALSE)
+ foreach(test_build_events TRUE FALSE)
+ foreach(test_custom_command TRUE FALSE)
+ foreach(test_custom_target TRUE FALSE)
+ math(EXPR counter "${counter} + 1")
+ message("Test ${counter} - CLEAN_NO_CUSTOM: ${test_clean_no_custom}, Build events: ${test_build_events}, Custom command: ${test_custom_command}, Custom target: ${test_custom_target}")
+ run_CleanByproducts("buildevents${counter}" -DCLEAN_NO_CUSTOM=${test_clean_no_custom} -DTEST_BUILD_EVENTS=${test_build_events} -DTEST_CUSTOM_COMMAND=${test_custom_command} -DTEST_CUSTOM_TARGET=${test_custom_target})
+ endforeach()
+ endforeach()
+ endforeach()
+endforeach()
diff --git a/Tests/RunCMake/Byproducts/files.cmake.in b/Tests/RunCMake/Byproducts/files.cmake.in
new file mode 100644
index 000000000..a7d4831fc
--- /dev/null
+++ b/Tests/RunCMake/Byproducts/files.cmake.in
@@ -0,0 +1,2 @@
+set(EXPECTED_PRESENT "@EXPECTED_PRESENT@")
+set(EXPECTED_DELETED "@EXPECTED_DELETED@")
diff --git a/Tests/RunCMake/Byproducts/foo.cpp b/Tests/RunCMake/Byproducts/foo.cpp
new file mode 100644
index 000000000..d47cb91a6
--- /dev/null
+++ b/Tests/RunCMake/Byproducts/foo.cpp
@@ -0,0 +1,14 @@
+int bar(int y)
+{
+ return y * 6;
+}
+
+int foo(int x)
+{
+ return x * bar(x);
+}
+
+int main()
+{
+ return foo(4);
+}
diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt
new file mode 100644
index 000000000..d0a156cbc
--- /dev/null
+++ b/Tests/RunCMake/CMP0055/CMP0055-OLD-Out-of-Scope-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0055-OLD-Out-of-Scope.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0055 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt
new file mode 100644
index 000000000..937b352da
--- /dev/null
+++ b/Tests/RunCMake/CMP0055/CMP0055-OLD-Reject-Arguments-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0055-OLD-Reject-Arguments.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0055 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt
new file mode 100644
index 000000000..465874736
--- /dev/null
+++ b/Tests/RunCMake/CMP0060/CMP0060-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0060-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0060 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
index f44f84002..456e6a656 100644
--- a/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0069/RunCMakeTest.cmake
@@ -5,6 +5,6 @@ run_cmake(CMP0069-NEW-cmake)
run_cmake(CMP0069-NEW-compiler)
run_cmake(CMP0069-WARN)
-if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
run_cmake(CMP0069-NEW-generator)
endif()
diff --git a/Tests/RunCMake/CMP0081/CMP0081-Common.cmake b/Tests/RunCMake/CMP0081/CMP0081-Common.cmake
new file mode 100644
index 000000000..3ea5277f9
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-Common.cmake
@@ -0,0 +1,5 @@
+
+enable_language(CXX)
+
+add_library(foo SHARED empty.cpp)
+set_target_properties(foo PROPERTIES LINK_DIRECTORIES "../lib")
diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/CMP0081/CMP0081-NEW-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt
+++ b/Tests/RunCMake/CMP0081/CMP0081-NEW-result.txt
diff --git a/Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt b/Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt
new file mode 100644
index 000000000..d31c149bd
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-NEW-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error in CMakeLists.txt:
+ Found relative path while evaluating link directories of "foo":
+
+ "../lib"
diff --git a/Tests/RunCMake/CMP0081/CMP0081-NEW.cmake b/Tests/RunCMake/CMP0081/CMP0081-NEW.cmake
new file mode 100644
index 000000000..9b927a2b4
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-NEW.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0081 NEW)
+
+include (CMP0081-Common.cmake)
diff --git a/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt b/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0081/CMP0081-OLD.cmake b/Tests/RunCMake/CMP0081/CMP0081-OLD.cmake
new file mode 100644
index 000000000..2e91bf6ae
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-OLD.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy(SET CMP0081 OLD)
+
+include (CMP0081-Common.cmake)
diff --git a/Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt b/Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt b/Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt
new file mode 100644
index 000000000..eac064829
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-WARN-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0081 is not set: Relative paths not allowed in LINK_DIRECTORIES
+ target property. Run "cmake --help-policy CMP0081" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ Found relative path while evaluating link directories of "foo":
+
+ "../lib"
+
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0081/CMP0081-WARN.cmake b/Tests/RunCMake/CMP0081/CMP0081-WARN.cmake
new file mode 100644
index 000000000..33bb21db1
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMP0081-WARN.cmake
@@ -0,0 +1,2 @@
+
+include (CMP0081-Common.cmake)
diff --git a/Tests/RunCMake/CMP0081/CMakeLists.txt b/Tests/RunCMake/CMP0081/CMakeLists.txt
new file mode 100644
index 000000000..ef2163c29
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.1)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0081/RunCMakeTest.cmake b/Tests/RunCMake/CMP0081/RunCMakeTest.cmake
new file mode 100644
index 000000000..335d8c5ba
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0081-OLD)
+run_cmake(CMP0081-NEW)
+run_cmake(CMP0081-WARN)
diff --git a/Tests/RunCMake/CMP0081/empty.cpp b/Tests/RunCMake/CMP0081/empty.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/CMP0081/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 61223501a..99f4ae7f4 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -106,6 +106,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
add_RunCMake_test(CMP0068)
endif()
add_RunCMake_test(CMP0069)
+add_RunCMake_test(CMP0081)
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
@@ -143,6 +144,9 @@ endif()
add_RunCMake_test(AndroidTestUtilities)
add_RunCMake_test(BuildDepends)
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
+ add_RunCMake_test(Byproducts)
+endif()
+if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(CompilerChange)
endif()
add_RunCMake_test(CompilerNotFound)
@@ -154,6 +158,9 @@ add_RunCMake_test(FPHSA)
add_RunCMake_test(FindBoost)
add_RunCMake_test(FindLua)
add_RunCMake_test(FindOpenGL)
+if(CMake_TEST_UseSWIG)
+ add_RunCMake_test(UseSWIG)
+endif()
if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
add_RunCMake_test(GenerateExportHeader)
endif()
@@ -239,7 +246,9 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(include_guard)
add_RunCMake_test(list)
+add_RunCMake_test(math)
add_RunCMake_test(message)
+add_RunCMake_test(option)
add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
add_RunCMake_test(project_injected)
add_RunCMake_test(return)
@@ -247,6 +256,7 @@ add_RunCMake_test(separate_arguments)
add_RunCMake_test(set_property)
add_RunCMake_test(string)
add_RunCMake_test(test_include_dirs)
+add_RunCMake_test(BundleUtilities)
function(add_RunCMake_test_try_compile)
if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
@@ -334,6 +344,8 @@ endif()
add_RunCMake_test(File_Generate)
add_RunCMake_test(ExportWithoutLanguage)
add_RunCMake_test(target_link_libraries)
+add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
+add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
add_RunCMake_test(target_compile_features)
add_RunCMake_test(CheckModules)
@@ -356,7 +368,8 @@ add_RunCMake_test(FetchContent)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>)
endif()
-add_RunCMake_test(CTestCommandLine)
+add_executable(print_stdin print_stdin.c)
+add_RunCMake_test(CTestCommandLine -DTEST_PRINT_STDIN=$<TARGET_FILE:print_stdin>)
add_RunCMake_test(CacheNewline)
# Only run this test on unix platforms that support
# symbolic links
@@ -422,7 +435,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
add_RunCMake_test(ctest_labels_for_subprojects)
endif()
-add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ")
+add_RunCMake_test_group(CPack "DEB;RPM;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External")
# add a test to make sure symbols are exported from a shared library
# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
add_RunCMake_test(AutoExportDll)
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
index 447b08bdf..d00ef3b9d 100644
--- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake
+++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake
@@ -1,10 +1,14 @@
cmake_policy(SET CMP0057 NEW)
-function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE)
+function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target)
if(TEST_TYPE IN_LIST types)
set(RunCMake_TEST_NO_CLEAN TRUE)
- set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build")
- set(full_test_name_ "${TEST_NAME}")
+ if(package_target)
+ set(full_test_name_ "${TEST_NAME}-package-target")
+ else()
+ set(full_test_name_ "${TEST_NAME}")
+ endif()
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build")
if(SUBTEST_SUFFIX)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest")
@@ -67,9 +71,19 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK
unset(pack_params_)
endif()
+ if(package_target)
+ set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package)
+ else()
+ set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_})
+ endif()
+
# execute cpack
+ set(SETENV)
+ if(ENVIRONMENT)
+ set(SETENV ${CMAKE_COMMAND} -E env "${ENVIRONMENT}")
+ endif()
execute_process(
- COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_}
+ COMMAND ${SETENV} ${cpack_command_}
WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}"
RESULT_VARIABLE "result_"
OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt"
@@ -113,18 +127,24 @@ endfunction()
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_}")
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false)
+ endforeach()
+endfunction()
+
+function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES)
+ foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true)
endforeach()
endfunction()
function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES)
foreach(suffix_ IN LISTS SUBTEST_SUFFIXES)
foreach(packaging_type_ IN LISTS PACKAGING_TYPES)
- run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}")
+ run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false)
endforeach()
endforeach()
endfunction()
function(run_cpack_source_test TEST_NAME types)
- run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "")
+ run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false)
endfunction()
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index f7c5c8411..9b98ed41f 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -1,7 +1,7 @@
-set(ALL_FILES_GLOB "*.deb")
+set(ALL_FILES_GLOB "*.deb" "*.ddeb")
function(getPackageContent FILE RESULT_VAR)
- execute_process(COMMAND ${DPKG_EXECUTABLE} -c "${FILE}"
+ execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${DPKG_EXECUTABLE} -c "${FILE}"
OUTPUT_VARIABLE package_content_
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/Tests/RunCMake/CPack/External/Helpers.cmake b/Tests/RunCMake/CPack/External/Helpers.cmake
new file mode 100644
index 000000000..2c67e0644
--- /dev/null
+++ b/Tests/RunCMake/CPack/External/Helpers.cmake
@@ -0,0 +1,31 @@
+function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_VAR)
+ set(${RESULT_VAR} "${NAME}-${VERSION}-*.json" PARENT_SCOPE)
+endfunction()
+
+function(getPackageContentList FILE RESULT_VAR)
+ set("${RESULT_VAR}" "" PARENT_SCOPE)
+endfunction()
+
+function(toExpectedContentList FILE_NO CONTENT_VAR)
+ set("${CONTENT_VAR}" "" PARENT_SCOPE)
+endfunction()
+
+set(ALL_FILES_GLOB "*.json")
+
+function(check_ext_json EXPECTED_FILE ACTUAL_FILE)
+ file(READ "${EXPECTED_FILE}" _expected_regex)
+ file(READ "${ACTUAL_FILE}" _actual_contents)
+
+ string(REGEX REPLACE "\n+$" "" _expected_regex "${_expected_regex}")
+ string(REGEX REPLACE "\n+$" "" _actual_contents "${_actual_contents}")
+
+ if(NOT "${_actual_contents}" MATCHES "${_expected_regex}")
+ message(FATAL_ERROR
+ "Output JSON does not match expected regex.\n"
+ "Expected regex:\n"
+ "${_expected_regex}\n"
+ "Actual output:\n"
+ "${_actual_contents}\n"
+ )
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/CPack/External/Prerequirements.cmake b/Tests/RunCMake/CPack/External/Prerequirements.cmake
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/CPack/External/Prerequirements.cmake
diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
index 4a0e4e6d0..f02f9d696 100644
--- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
+++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt
@@ -1 +1 @@
-^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$
+^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 4b7f146fb..33ddb722c 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -6,7 +6,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM" false "MONOLITHIC;COMPONENT")
run_cpack_test(CUSTOM_NAMES "RPM;DEB;TGZ" true "COMPONENT")
-run_cpack_test(DEBUGINFO "RPM" true "COMPONENT")
+run_cpack_test(DEBUGINFO "RPM;DEB" true "COMPONENT")
run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT")
run_cpack_test(DIST "RPM" false "MONOLITHIC")
@@ -18,7 +18,8 @@ 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;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ" false "MONOLITHIC;COMPONENT")
+run_cpack_test(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT")
+run_cpack_test_package_target(MINIMAL "RPM;DEB;7Z;TBZ2;TGZ;TXZ;TZ;ZIP;STGZ;External" false "MONOLITHIC;COMPONENT")
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")
@@ -27,7 +28,11 @@ run_cpack_test(EXTRA_SLASH_IN_PATH "RPM" true "COMPONENT")
run_cpack_source_test(SOURCE_PACKAGE "RPM")
run_cpack_test(SUGGESTS "RPM" false "MONOLITHIC")
run_cpack_test(SYMLINKS "RPM;TGZ" false "MONOLITHIC;COMPONENT")
+set(ENVIRONMENT "SOURCE_DATE_EPOCH=123456789")
+run_cpack_test(TIMESTAMPS "DEB;TGZ" false "COMPONENT")
+unset(ENVIRONMENT)
run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC")
run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC")
run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT")
+run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT")
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 1f5ab8716..345b37fac 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -56,8 +56,12 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
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(NOT PACKAGE_CONTENT STREQUAL "")
+ list(SORT PACKAGE_CONTENT)
+ endif()
+ if(NOT EXPECTED_FILE_CONTENT_${file_no_} STREQUAL "")
+ list(SORT EXPECTED_FILE_CONTENT_${file_no_})
+ endif()
if(PACKAGE_CONTENT STREQUAL EXPECTED_FILE_CONTENT_${file_no_})
set(expected_content_list TRUE)
@@ -88,7 +92,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
# check that there were no extra files generated
foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB)
file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}")
- list(APPEND allFoundFiles_ "${foundAll_}")
+ list(APPEND allFoundFiles_ ${foundAll_})
endforeach()
list(LENGTH foundFiles_ foundFilesCount_)
diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake
index c745828c2..cf2e8ac6b 100644
--- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake
@@ -3,16 +3,39 @@ set(whitespaces_ "[\t\n\r ]*")
set(EXPECTED_FILES_COUNT "5")
set(EXPECTED_FILES_NAME_GENERATOR_SPECIFIC_FORMAT TRUE)
-set(EXPECTED_FILE_1_NAME "Debuginfo")
+if(GENERATOR_TYPE STREQUAL "RPM")
+ set(NAME "Debuginfo")
+ set(DEBUG_SUFFIX "debuginfo")
+ set(PKG "rpm")
+ set(DEBUG_PKG "rpm")
+elseif(GENERATOR_TYPE STREQUAL "DEB")
+ set(NAME "debuginfo")
+ set(DEBUG_SUFFIX "dbgsym")
+ set(PKG "deb")
+ set(DEBUG_PKG "ddeb")
+endif()
+
+set(EXPECTED_FILE_1_NAME "${NAME}")
set(EXPECTED_FILE_1_COMPONENT "applications")
set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog")
-set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.rpm")
+
+set(EXPECTED_FILE_2 "TestDinfo-pkg*-headers.${PKG}")
set(EXPECTED_FILE_CONTENT_2_LIST "/bar;/bar/CMakeLists.txt")
-set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.rpm")
+
+set(EXPECTED_FILE_3 "TestDinfo-pkg*-libs.${PKG}")
set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so")
-set(EXPECTED_FILE_4_NAME "Debuginfo")
-set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo")
-set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*")
-set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm")
-set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*")
+set(EXPECTED_FILE_4 "${NAME}-applications-${DEBUG_SUFFIX}*.${DEBUG_PKG}")
+if(GENERATOR_TYPE STREQUAL "RPM")
+ set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*")
+elseif(GENERATOR_TYPE STREQUAL "DEB")
+ set(EXPECTED_FILE_CONTENT_4 ".*/usr/lib/debug/.build-id/.*\.debug.*")
+endif()
+
+if(GENERATOR_TYPE STREQUAL "RPM")
+ set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm")
+ set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*")
+elseif(GENERATOR_TYPE STREQUAL "DEB")
+ set(EXPECTED_FILE_5 "TestDinfo-pkg-libs-dbgsym.ddeb")
+ set(EXPECTED_FILE_CONTENT_5 ".*/usr/lib/debug/.build-id/.*\.debug.*")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
index 71457d4ee..161a36a85 100644
--- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
+++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake
@@ -29,12 +29,16 @@ install(TARGETS test_lib DESTINATION bas COMPONENT libs)
set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON)
+set(CPACK_DEBIAN_APPLICATIONS_FILE_NAME "DEB-DEFAULT")
+set(CPACK_DEBIAN_APPLICATIONS_DEBUGINFO_PACKAGE ON)
# test that components with debuginfo enabled still honor
# CPACK_PACKAGE_FILE_NAME setting
set(CPACK_RPM_PACKAGE_NAME "Debuginfo")
set(CPACK_PACKAGE_FILE_NAME "TestDinfo-pkg")
set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON)
+set(CPACK_DEBIAN_PACKAGE_NAME "Debuginfo")
+set(CPACK_DEBIAN_LIBS_DEBUGINFO_PACKAGE ON)
# test debuginfo package rename
set(CPACK_RPM_DEBUGINFO_FILE_NAME
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/ExpectedFiles.cmake
new file mode 100644
index 000000000..91608c9fe
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/ExpectedFiles.cmake
@@ -0,0 +1,7 @@
+if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$"
+ OR RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package")
+ set(EXPECTED_FILES_COUNT "1")
+ set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt")
+else()
+ set(EXPECTED_FILES_COUNT "0")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/VerifyResult.cmake
new file mode 100644
index 000000000..bc19d7efb
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/VerifyResult.cmake
@@ -0,0 +1,3 @@
+if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)")
+ check_ext_json("${src_dir}/tests/EXTERNAL/expected-json-1.0.txt" "${FOUND_FILE_1}")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/bad_major-stderr.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/bad_major-stderr.txt
new file mode 100644
index 000000000..f2e160e20
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/bad_major-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/Internal/CPack/CPackExternal\.cmake:[0-9]+ \(message\):
+ Could not find a suitable version in CPACK_EXTERNAL_REQUESTED_VERSIONS
+
+
+CPack Error: Error while executing CPackExternal\.cmake
+CPack Error: Cannot initialize the generator External
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/bad_minor-stderr.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/bad_minor-stderr.txt
new file mode 100644
index 000000000..f2e160e20
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/bad_minor-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/Internal/CPack/CPackExternal\.cmake:[0-9]+ \(message\):
+ Could not find a suitable version in CPACK_EXTERNAL_REQUESTED_VERSIONS
+
+
+CPack Error: Error while executing CPackExternal\.cmake
+CPack Error: Cannot initialize the generator External
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
new file mode 100644
index 000000000..e308ccb5d
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
@@ -0,0 +1,24 @@
+message("This script could run an external packaging tool")
+
+function(expect_variable VAR)
+ if(NOT ${VAR})
+ message(FATAL_ERROR "${VAR} is unexpectedly not set")
+ endif()
+endfunction()
+
+function(expect_file FILE)
+ if(NOT EXISTS "${FILE}")
+ message(FATAL_ERROR "${FILE} is unexpectedly missing")
+ endif()
+endfunction()
+
+expect_variable(CPACK_COMPONENTS_ALL)
+expect_variable(CPACK_TOPLEVEL_DIRECTORY)
+expect_variable(CPACK_TEMPORARY_DIRECTORY)
+expect_variable(CPACK_PACKAGE_DIRECTORY)
+expect_variable(CPACK_PACKAGE_FILE_NAME)
+
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt)
+expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt)
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt
new file mode 100644
index 000000000..18bf61784
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/expected-json-1.0.txt
@@ -0,0 +1,176 @@
+^\{
+ "componentGroups" :[ ]
+ \{
+ "f12" :[ ]
+ \{
+ "components" :[ ]
+ \[
+ "f1",
+ "f2"
+ \],
+ "description" : "Component group for files 1 and 2",
+ "displayName" : "Files 1 and 2",
+ "isBold" : false,
+ "isExpandedByDefault" : false,
+ "name" : "f12",
+ "parentGroup" : "f1234",
+ "subgroups" : \[\]
+ \},
+ "f1234" :[ ]
+ \{
+ "components" : \[\],
+ "description" : "Component group for all files",
+ "displayName" : "Files 1-4",
+ "isBold" : false,
+ "isExpandedByDefault" : false,
+ "name" : "f1234",
+ "subgroups" :[ ]
+ \[
+ "f12",
+ "f34"
+ \]
+ \},
+ "f34" :[ ]
+ \{
+ "components" :[ ]
+ \[
+ "f3",
+ "f4"
+ \],
+ "description" : "Component group for files 3 and 4",
+ "displayName" : "Files 3 and 4",
+ "isBold" : false,
+ "isExpandedByDefault" : false,
+ "name" : "f34",
+ "parentGroup" : "f1234",
+ "subgroups" : \[\]
+ \}
+ \},
+ "components" :[ ]
+ \{
+ "f1" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" : \[\],
+ "description" : "Component for file 1",
+ "displayName" : "File 1",
+ "group" : "f12",
+ "installationTypes" :[ ]
+ \[
+ "full",
+ "f12"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f1"
+ \},
+ "f2" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" :[ ]
+ \[
+ "f1"
+ \],
+ "description" : "Component for file 2",
+ "displayName" : "File 2",
+ "group" : "f12",
+ "installationTypes" :[ ]
+ \[
+ "full",
+ "f12"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f2"
+ \},
+ "f3" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" :[ ]
+ \[
+ "f1",
+ "f2"
+ \],
+ "description" : "Component for file 3",
+ "displayName" : "File 3",
+ "group" : "f34",
+ "installationTypes" :[ ]
+ \[
+ "full"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f3"
+ \},
+ "f4" :[ ]
+ \{
+ "archiveFile" : "",
+ "dependencies" :[ ]
+ \[
+ "f2",
+ "f3",
+ "f1"
+ \],
+ "description" : "Component for file 4",
+ "displayName" : "File 4",
+ "group" : "f34",
+ "installationTypes" :[ ]
+ \[
+ "full"
+ \],
+ "isDisabledByDefault" : false,
+ "isDownloaded" : false,
+ "isHidden" : false,
+ "isRequired" : false,
+ "name" : "f4"
+ \}
+ \},
+ "errorOnAbsoluteInstallDestination" : false,
+ "formatVersionMajor" : 1,
+ "formatVersionMinor" : 0,
+ "installationTypes" :[ ]
+ \{
+ "f12" :[ ]
+ \{
+ "displayName" : "Only files 1 and 2",
+ "index" : 2,
+ "name" : "f12"
+ \},
+ "full" :[ ]
+ \{
+ "displayName" : "Full installation",
+ "index" : 1,
+ "name" : "full"
+ \}
+ \},
+ "packageDescriptionFile" : ".*/Templates/CPack\.GenericDescription\.txt",
+ "packageDescriptionSummary" : "EXTERNAL-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type built using CMake",
+ "packageName" : "external",
+ "packageVersion" : "0\.1\.1",
+ "projects" :[ ]
+ \[
+ \{
+ "component" : "ALL",
+ "components" :[ ]
+ \[
+ "f1",
+ "f2",
+ "f3",
+ "f4"
+ \],
+ "directory" : ".*/Tests/RunCMake/External/CPack/EXTERNAL-build-(none|good(_multi)?|invalid_good)-subtest",
+ "installationTypes" : \[\],
+ "projectName" : "EXTERNAL-(none|good(_multi)?|invalid_good)-subtest-(MONOLITHIC|COMPONENT)-type",
+ "subDirectory" : "/"
+ \}
+ \],
+ "setDestdir" : false,
+ "stripFiles" : false,
+ "warnOnAbsoluteInstallDestination" : false
+\}$
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/invalid_bad-stderr.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/invalid_bad-stderr.txt
new file mode 100644
index 000000000..f2e160e20
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/invalid_bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/Internal/CPack/CPackExternal\.cmake:[0-9]+ \(message\):
+ Could not find a suitable version in CPACK_EXTERNAL_REQUESTED_VERSIONS
+
+
+CPack Error: Error while executing CPackExternal\.cmake
+CPack Error: Cannot initialize the generator External
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stderr.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stderr.txt
new file mode 100644
index 000000000..40f2743e2
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stderr.txt
@@ -0,0 +1 @@
+^This script could run an external packaging tool$
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake
new file mode 100644
index 000000000..bc9766b15
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/test.cmake
@@ -0,0 +1,86 @@
+include(CPackComponent)
+
+if(RunCMake_SUBTEST_SUFFIX STREQUAL "none")
+ unset(CPACK_EXTERNAL_REQUESTED_VERSIONS)
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good")
+ set(CPACK_EXTERNAL_REQUESTED_VERSIONS "1.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "good_multi")
+ set(CPACK_EXTERNAL_REQUESTED_VERSIONS "1.0;2.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_major")
+ set(CPACK_EXTERNAL_REQUESTED_VERSIONS "2.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "bad_minor")
+ set(CPACK_EXTERNAL_REQUESTED_VERSIONS "1.1")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good")
+ set(CPACK_EXTERNAL_REQUESTED_VERSIONS "1;1.0")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad")
+ set(CPACK_EXTERNAL_REQUESTED_VERSIONS "1")
+elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package")
+ set(CPACK_EXTERNAL_ENABLE_STAGING 1)
+ set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake")
+endif()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" test2)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" test3)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" test4)
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" DESTINATION share/cpack-test COMPONENT f1)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f2.txt" DESTINATION share/cpack-test COMPONENT f2)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f3.txt" DESTINATION share/cpack-test COMPONENT f3)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/f4.txt" DESTINATION share/cpack-test COMPONENT f4)
+
+cpack_add_component(f1
+ DISPLAY_NAME "File 1"
+ DESCRIPTION "Component for file 1"
+ GROUP f12
+ INSTALL_TYPES full f12
+)
+
+cpack_add_component(f2
+ DISPLAY_NAME "File 2"
+ DESCRIPTION "Component for file 2"
+ GROUP f12
+ DEPENDS f1
+ INSTALL_TYPES full f12
+)
+
+cpack_add_component(f3
+ DISPLAY_NAME "File 3"
+ DESCRIPTION "Component for file 3"
+ GROUP f34
+ DEPENDS f1 f2
+ INSTALL_TYPES full
+)
+
+cpack_add_component(f4
+ DISPLAY_NAME "File 4"
+ DESCRIPTION "Component for file 4"
+ GROUP f34
+ DEPENDS f2 f3 f1
+ INSTALL_TYPES full
+)
+
+cpack_add_component_group(f12
+ DISPLAY_NAME "Files 1 and 2"
+ DESCRIPTION "Component group for files 1 and 2"
+ PARENT_GROUP f1234
+)
+
+cpack_add_component_group(f34
+ DISPLAY_NAME "Files 3 and 4"
+ DESCRIPTION "Component group for files 3 and 4"
+ PARENT_GROUP f1234
+)
+
+cpack_add_component_group(f1234
+ DISPLAY_NAME "Files 1-4"
+ DESCRIPTION "Component group for all files"
+)
+
+cpack_add_install_type(full
+ DISPLAY_NAME "Full installation"
+)
+
+cpack_add_install_type(f12
+ DISPLAY_NAME "Only files 1 and 2"
+)
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
index 18ef63cd8..b4bdb61b6 100644
--- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/VerifyResult.cmake
@@ -1,7 +1,7 @@
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_}'")
+ message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'; does not match '${REGEX}'")
endif()
endfunction()
@@ -24,3 +24,15 @@ checkPackageInfo_("name" "${FOUND_FILE_3}" ".*${name_}${whitespaces_}:${whitespa
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")
+
+# check package summaries (not available in DEB)
+if(GENERATOR_TYPE STREQUAL "RPM")
+ checkPackageInfo_("summary" "${FOUND_FILE_1}" ".*Summary${whitespaces_}:${whitespaces_}Global summary")
+ checkPackageInfo_("summary" "${FOUND_FILE_2}" ".*Summary${whitespaces_}:${whitespaces_}Summary for pkg_2")
+ checkPackageInfo_("summary" "${FOUND_FILE_3}" ".*Summary${whitespaces_}:${whitespaces_}Global summary")
+endif()
+
+# check package description
+checkPackageInfo_("description" "${FOUND_FILE_1}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_1")
+checkPackageInfo_("description" "${FOUND_FILE_2}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_2")
+checkPackageInfo_("description" "${FOUND_FILE_3}" ".*Description${whitespaces_}:${whitespaces_}Description for pkg_3")
diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
index 8719c0b5e..dc61d0abb 100644
--- a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
+++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake
@@ -11,6 +11,13 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
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")
+
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PACKAGE_SUMMARY "Global summary") # not used for DEB
+ set(CPACK_${GENERATOR_TYPE}${generator_type_suffix_}_PKG_2_PACKAGE_SUMMARY "Summary for pkg_2") # not used for DEB
+
+ set(CPACK_COMPONENT_PKG_1_DESCRIPTION "Description for pkg_1")
+ set(CPACK_COMPONENT_PKG_2_DESCRIPTION "Description for pkg_2")
+ set(CPACK_COMPONENT_PKG_3_DESCRIPTION "Description for pkg_3")
endif()
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)
diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake
new file mode 100644
index 000000000..d1a3a5fb2
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake
new file mode 100644
index 000000000..e7e2645aa
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/VerifyResult.cmake
@@ -0,0 +1,58 @@
+macro(getFileMetadata_ FILE RESULT_VAR)
+ if(GENERATOR_TYPE STREQUAL "TGZ")
+ # getPackageContent defined for archives omit the metadata (non-verbose)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E env TZ=Etc/UTC ${CMAKE_COMMAND} -E tar -xtvf ${FILE}
+ OUTPUT_VARIABLE ${RESULT_VAR}
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ getPackageContent("${FILE}" ${RESULT_VAR})
+ endif()
+endmacro()
+
+function(checkContentTimestamp FILE REGEX)
+ getFileMetadata_("${FILE}" METADATA_)
+
+ if(NOT METADATA_ MATCHES "${REGEX}")
+ string(REPLACE "\n" "\n " metadata_indented "${METADATA_}")
+ message(FATAL_ERROR
+ "Wrong timestamps in file:\n"
+ " ${FILE}\n"
+ "Expected timestamps to match:\n"
+ " ${REGEX}\n"
+ "Actual timestamps:\n"
+ " ${metadata_indented}")
+ endif()
+endfunction()
+
+function(checkTimestamp FILE_NAME)
+ file(READ ${FILE_NAME} ACTUAL_TIMESTAMP OFFSET 4 LIMIT 4 HEX)
+
+ if(NOT ACTUAL_TIMESTAMP STREQUAL "00000000")
+ message(FATAL_ERROR "${FILE_NAME} contains a timestamp [0x${ACTUAL_TIMESTAMP}]")
+ endif()
+endfunction()
+
+# Expected timestamp is UNIX time 123456789
+if(GENERATOR_TYPE STREQUAL "TGZ")
+ set(EXPECTED_TIMESTAMP "29 Nov +1973")
+ set(EXPECTED_FILES foo/ foo/CMakeLists.txt)
+else()
+ set(EXPECTED_TIMESTAMP "1973-11-29 21:33")
+ set(EXPECTED_FILES ./usr/ ./usr/foo/ ./usr/foo/CMakeLists.txt)
+endif()
+
+set(EXPECTED_METADATA)
+foreach(FILE ${EXPECTED_FILES})
+ list(APPEND EXPECTED_METADATA ".* ${EXPECTED_TIMESTAMP} ${FILE}")
+endforeach()
+list(JOIN EXPECTED_METADATA ".*" EXPECTED_REGEX)
+checkContentTimestamp("${FOUND_FILE_1}" "${EXPECTED_REGEX}")
+
+if(GENERATOR_TYPE STREQUAL "TGZ")
+ checkTimestamp("${FOUND_FILE_1}")
+else()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${FOUND_FILE_1}")
+ checkTimestamp("data.tar.gz")
+ checkTimestamp("control.tar.gz")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake
new file mode 100644
index 000000000..a19385214
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/TIMESTAMPS/test.cmake
@@ -0,0 +1,3 @@
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
+
+set(CPACK_COMPONENTS_ALL test)
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 9e8d050a5..750ae5026 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -161,3 +161,15 @@ endfunction()
if(TEST_AFFINITY)
run_TestAffinity()
endif()
+
+function(run_TestStdin)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestStdin)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+ add_test(TestStdin \"${TEST_PRINT_STDIN}\")
+ ")
+ run_cmake_command(TestStdin ${CMAKE_CTEST_COMMAND} -V)
+endfunction()
+run_TestStdin()
diff --git a/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt b/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt
new file mode 100644
index 000000000..d83b50a68
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt
@@ -0,0 +1 @@
+Content for TestStdin
diff --git a/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt b/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt
new file mode 100644
index 000000000..d83b50a68
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt
@@ -0,0 +1 @@
+Content for TestStdin
diff --git a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
index e14556944..b7d524ccf 100644
--- a/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CheckIPOSupported/RunCMakeTest.cmake
@@ -8,6 +8,6 @@ run_cmake(not-supported-by-compiler)
run_cmake(save-to-result)
run_cmake(cmp0069-is-old)
-if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 ")
run_cmake(not-supported-by-generator)
endif()
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/CommandLine/B-no-arg-result.txt
index d00491fd7..d00491fd7 100644
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
+++ b/Tests/RunCMake/CommandLine/B-no-arg-result.txt
diff --git a/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt
new file mode 100644
index 000000000..2309c5edd
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No build directory specified for -B
diff --git a/Tests/RunCMake/CommandLine/B-no-arg2-result.txt b/Tests/RunCMake/CommandLine/B-no-arg2-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt b/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt
new file mode 100644
index 000000000..2309c5edd
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/B-no-arg2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No build directory specified for -B
diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake
index d7e652de7..5df5f2fb7 100644
--- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake
+++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-create-check.cmake
@@ -1,6 +1,10 @@
-if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L)
- set(RunCMake_TEST_FAILED "Symlink 'L' incorrectly not created!")
-endif()
-if(EXISTS ${RunCMake_TEST_BINARY_DIR}/L)
- set(RunCMake_TEST_FAILED "Symlink 'L' not broken!")
+if(${actual_stderr_var} MATCHES "operation not permitted")
+ unset(msg)
+else()
+ if(NOT IS_SYMLINK ${RunCMake_TEST_BINARY_DIR}/L)
+ set(RunCMake_TEST_FAILED "Symlink 'L' incorrectly not created!")
+ endif()
+ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/L)
+ set(RunCMake_TEST_FAILED "Symlink 'L' not broken!")
+ endif()
endif()
diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake
index c078ae8fc..d37df0169 100644
--- a/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake
+++ b/Tests/RunCMake/CommandLine/E_create_symlink-broken-replace-check.cmake
@@ -1,3 +1,7 @@
-if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L)
- set(RunCMake_TEST_FAILED "Symlink 'L' not replaced correctly!")
+if(${actual_stderr_var} MATCHES "operation not permitted")
+ unset(msg)
+else()
+ if(NOT IS_DIRECTORY ${RunCMake_TEST_BINARY_DIR}/L)
+ set(RunCMake_TEST_FAILED "Symlink 'L' not replaced correctly!")
+ endif()
endif()
diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
new file mode 100644
index 000000000..0ca5a0a0b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/ExplicitDirs/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+add_custom_command(
+ OUTPUT output.txt
+ COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
+ )
+add_custom_target(CustomTarget ALL DEPENDS output.txt)
+add_custom_target(CustomTarget2 ALL DEPENDS output.txt)
+add_custom_target(CustomTarget3 ALL DEPENDS output.txt)
diff --git a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt
index 1cd34697b..f1dafc886 100644
--- a/Tests/RunCMake/CommandLine/NoArgs-stdout.txt
+++ b/Tests/RunCMake/CommandLine/NoArgs-stdout.txt
@@ -2,6 +2,7 @@
cmake \[options\] <path-to-source>
cmake \[options\] <path-to-existing-build>
+ cmake \[options\] -S <path-to-source> -B <path-to-build>
Specify a source directory to \(re-\)generate a build system for it in the
current working directory. Specify an existing build directory to
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 3bb2a89f5..9859df142 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.1)
include(RunCMake)
run_cmake_command(NoArgs ${CMAKE_COMMAND})
+run_cmake_command(Wizard ${CMAKE_COMMAND} -i)
run_cmake_command(C-no-arg ${CMAKE_COMMAND} -C)
run_cmake_command(C-no-file ${CMAKE_COMMAND} -C nosuchcachefile.txt)
run_cmake_command(cache-no-file ${CMAKE_COMMAND} nosuchsubdir/CMakeCache.txt)
@@ -47,6 +48,31 @@ run_cmake_command(cache-bad-entry
run_cmake_command(cache-empty-entry
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/)
+function(run_ExplicitDirs)
+ set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
+ set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
+
+ file(REMOVE_RECURSE "${binary_dir}")
+ file(MAKE_DIRECTORY "${binary_dir}")
+ run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir})
+ run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} )
+ run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S )
+ run_cmake_command(S-no-arg2 ${CMAKE_COMMAND} -S -T)
+ run_cmake_command(S-B ${CMAKE_COMMAND} -S ${source_dir} -B ${binary_dir})
+
+ # make sure that -B can explicitly construct build directories
+ file(REMOVE_RECURSE "${binary_dir}")
+ run_cmake_command(B-arg ${CMAKE_COMMAND} -B ${binary_dir} ${source_dir})
+ file(REMOVE_RECURSE "${binary_dir}")
+ run_cmake_command(B-arg-reverse-order ${CMAKE_COMMAND} ${source_dir} -B${binary_dir})
+ run_cmake_command(B-no-arg ${CMAKE_COMMAND} -B )
+ run_cmake_command(B-no-arg2 ${CMAKE_COMMAND} -B -T)
+ file(REMOVE_RECURSE "${binary_dir}")
+ run_cmake_command(B-S ${CMAKE_COMMAND} -B${binary_dir} -S${source_dir})
+
+endfunction()
+run_ExplicitDirs()
+
function(run_BuildDir)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build)
@@ -101,32 +127,35 @@ if(RunCMake_GENERATOR STREQUAL "Ninja")
unset(RunCMake_TEST_NO_CLEAN)
endif()
-if(UNIX)
- run_cmake_command(E_create_symlink-no-arg
- ${CMAKE_COMMAND} -E create_symlink
- )
- run_cmake_command(E_create_symlink-missing-dir
- ${CMAKE_COMMAND} -E create_symlink T missing-dir/L
- )
+run_cmake_command(E_create_symlink-no-arg
+ ${CMAKE_COMMAND} -E create_symlink
+ )
+run_cmake_command(E_create_symlink-missing-dir
+ ${CMAKE_COMMAND} -E create_symlink T missing-dir/L
+ )
- # Use a single build tree for a few tests without cleaning.
- set(RunCMake_TEST_BINARY_DIR
- ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build)
- set(RunCMake_TEST_NO_CLEAN 1)
- file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
- run_cmake_command(E_create_symlink-broken-create
- ${CMAKE_COMMAND} -E create_symlink T L
- )
- run_cmake_command(E_create_symlink-broken-replace
- ${CMAKE_COMMAND} -E create_symlink . L
- )
- unset(RunCMake_TEST_BINARY_DIR)
- unset(RunCMake_TEST_NO_CLEAN)
+# Use a single build tree for a few tests without cleaning.
+# These tests are special on Windows since it will only fail if the user
+# running the test does not have the priveldge to create symlinks. If this
+# happens we clear the msg in the -check.cmake and say that the test passes
+set(RunCMake_DEFAULT_stderr "(operation not permitted)?")
+set(RunCMake_TEST_BINARY_DIR
+ ${RunCMake_BINARY_DIR}/E_create_symlink-broken-build)
+set(RunCMake_TEST_NO_CLEAN 1)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+run_cmake_command(E_create_symlink-broken-create
+ ${CMAKE_COMMAND} -E create_symlink T L
+ )
+run_cmake_command(E_create_symlink-broken-replace
+ ${CMAKE_COMMAND} -E create_symlink . L
+ )
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_DEFAULT_stderr)
- run_cmake_command(E_create_symlink-no-replace-dir
- ${CMAKE_COMMAND} -E create_symlink T .
- )
-endif()
+run_cmake_command(E_create_symlink-no-replace-dir
+ ${CMAKE_COMMAND} -E create_symlink T .
+ )
set(in ${RunCMake_SOURCE_DIR}/copy_input)
set(out ${RunCMake_BINARY_DIR}/copy_output)
diff --git a/Tests/RunCMake/CommandLine/S-no-arg-result.txt b/Tests/RunCMake/CommandLine/S-no-arg-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt
new file mode 100644
index 000000000..d1a2ce34f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No source directory specified for -S
diff --git a/Tests/RunCMake/CommandLine/S-no-arg2-result.txt b/Tests/RunCMake/CommandLine/S-no-arg2-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt b/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt
new file mode 100644
index 000000000..d1a2ce34f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/S-no-arg2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: No source directory specified for -S
diff --git a/Tests/RunCMake/CommandLine/Wizard-result.txt b/Tests/RunCMake/CommandLine/Wizard-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wizard-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Wizard-stderr.txt b/Tests/RunCMake/CommandLine/Wizard-stderr.txt
new file mode 100644
index 000000000..f757aff90
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wizard-stderr.txt
@@ -0,0 +1 @@
+^The "cmake -i" wizard mode is no longer supported\.
diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt
new file mode 100644
index 000000000..ff3e5c18e
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\):
+ error: ExternalProject module must be explicitly included before using
+ ExternalProject_Add function
+Call Stack \(most recent call first\):
+ .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_parse_arguments\)
+ IncludeScope-Add.cmake:[0-9]+ \(ExternalProject_Add\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake b/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake
new file mode 100644
index 000000000..1061ffddc
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add.cmake
@@ -0,0 +1,12 @@
+function(IncludeScope_IncludeOnly)
+ include(ExternalProject)
+endfunction()
+
+IncludeScope_IncludeOnly()
+
+ExternalProject_Add(MyProj
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+)
diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt
new file mode 100644
index 000000000..cbad4be61
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at .*/Modules/ExternalProject.cmake:[0-9]+ \(message\):
+ error: ExternalProject module must be explicitly included before using
+ ExternalProject_Add_Step function
+Call Stack \(most recent call first\):
+ .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_parse_arguments\)
+ IncludeScope-Add_Step.cmake:[0-9]+ \(ExternalProject_Add_Step\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake
new file mode 100644
index 000000000..2a820f8f2
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/IncludeScope-Add_Step.cmake
@@ -0,0 +1,13 @@
+function(IncludeScope_DefineProj)
+ include(ExternalProject)
+ ExternalProject_Add(MyProj
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ )
+endfunction()
+
+IncludeScope_DefineProj()
+
+ExternalProject_Add_Step(MyProj extraStep COMMENT "Foo")
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index 09607f68d..bf11381a8 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -1,5 +1,7 @@
include(RunCMake)
+run_cmake(IncludeScope-Add)
+run_cmake(IncludeScope-Add_Step)
run_cmake(NoOptions)
run_cmake(SourceEmpty)
run_cmake(SourceMissing)
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
index 115056831..24e720229 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
@@ -1,10 +1,12 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.12)
project(FindPkgConfig_IMPORTED_TARGET C)
find_package(PkgConfig REQUIRED)
pkg_check_modules(NCURSES IMPORTED_TARGET QUIET ncurses)
+message(STATUS "source: ${CMAKE_CURRENT_SOURCE_DIR} bin ${CMAKE_CURRENT_BINARY_DIR}")
+
if (NCURSES_FOUND)
set(tgt PkgConfig::NCURSES)
if (NOT TARGET ${tgt})
@@ -66,6 +68,16 @@ if (NOT TARGET PkgConfig::FakePackage1)
message(FATAL_ERROR "No import target for fake package 1 with prefix path")
endif()
+# find targets in subdir and check their visibility
+add_subdirectory(target_subdir)
+if (TARGET PkgConfig::FakePackage1_dir)
+ message(FATAL_ERROR "imported target PkgConfig::FakePackage1_dir is visible outside it's directory")
+endif()
+
+if (NOT TARGET PkgConfig::FakePackage1_global)
+ message(FATAL_ERROR "imported target PkgConfig::FakePackage1_global is not visible outside it's directory")
+endif()
+
# And now do the same for the NO_CMAKE_ENVIRONMENT_PATH - ENV{CMAKE_PREFIX_PATH}
# combination
unset(CMAKE_PREFIX_PATH)
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake
new file mode 100644
index 000000000..2a505c6a5
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake
@@ -0,0 +1,83 @@
+cmake_minimum_required(VERSION 3.12)
+
+project(FindPkgConfig_IMPORTED_TARGET C)
+
+find_package(PkgConfig REQUIRED)
+
+message(STATUS "source: ${CMAKE_CURRENT_SOURCE_DIR} bin ${CMAKE_CURRENT_BINARY_DIR}")
+
+# Setup for the remaining package tests below
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+set(fakePkgDir ${CMAKE_CURRENT_BINARY_DIR}/pc-fakepackage)
+file(WRITE ${fakePkgDir}/lib/libcmakeinternalfakepackage.a "")
+file(WRITE ${fakePkgDir}/lib/cmakeinternalfakepackage.lib "")
+file(WRITE ${fakePkgDir}/lib/pkgconfig/cmakeinternalfakepackage.pc
+"Name: CMakeInternalFakePackage
+Description: Dummy package for FindPkgConfig VERSION_OPERATORS test
+Version: 8.9
+Libs: -lcmakeinternalfakepackage
+")
+
+# Always find the .pc file in the calls further below so that we can test that
+# the import target find_library() calls handle the NO...PATH options correctly
+set(ENV{PKG_CONFIG_PATH} ${fakePkgDir}/lib/pkgconfig)
+
+pkg_check_modules(FakePackageGE REQUIRED QUIET "cmakeinternalfakepackage >= 8")
+if (NOT FakePackageGE_FOUND)
+ message(FATAL_ERROR "fake package >= 8 not found")
+endif()
+
+pkg_check_modules(FakePackageGE_FAIL QUIET "cmakeinternalfakepackage >= 8.10")
+if (FakePackageGE_FAIL_FOUND)
+ message(FATAL_ERROR "fake package >= 8.10 found")
+endif()
+
+pkg_check_modules(FakePackageLE REQUIRED QUIET "cmakeinternalfakepackage<=9")
+if (NOT FakePackageLE_FOUND)
+ message(FATAL_ERROR "fake package <= 9 not found")
+endif()
+
+pkg_check_modules(FakePackageLE_FAIL QUIET "cmakeinternalfakepackage <= 8.1")
+if (FakePackageLE_FAIL_FOUND)
+ message(FATAL_ERROR "fake package <= 8.1 found")
+endif()
+
+pkg_check_modules(FakePackageGT REQUIRED QUIET "cmakeinternalfakepackage > 8")
+if (NOT FakePackageGT_FOUND)
+ message(FATAL_ERROR "fake package > 8 not found")
+endif()
+
+pkg_check_modules(FakePackageGT_FAIL QUIET "cmakeinternalfakepackage > 8.9")
+if (FakePackageGT_FAIL_FOUND)
+ message(FATAL_ERROR "fake package > 8.9 found")
+endif()
+
+pkg_check_modules(FakePackageLT REQUIRED QUIET "cmakeinternalfakepackage<9")
+if (NOT FakePackageLT_FOUND)
+ message(FATAL_ERROR "fake package < 9 not found")
+endif()
+
+pkg_check_modules(FakePackageLT_FAIL QUIET "cmakeinternalfakepackage < 8.9")
+if (FakePackageLT_FAIL_FOUND)
+ message(FATAL_ERROR "fake package < 8.9 found")
+endif()
+
+pkg_check_modules(FakePackageEQ REQUIRED QUIET "cmakeinternalfakepackage=8.9")
+if (NOT FakePackageEQ_FOUND)
+ message(FATAL_ERROR "fake package = 8.9 not found")
+endif()
+
+pkg_check_modules(FakePackageEQ_FAIL QUIET "cmakeinternalfakepackage = 8.8")
+if (FakePackageEQ_FAIL_FOUND)
+ message(FATAL_ERROR "fake package = 8.8 found")
+endif()
+
+pkg_check_modules(FakePackageEQ_INV QUIET "cmakeinternalfakepackage == 8.9")
+if (FakePackageEQ_FAIL_FOUND)
+ message(FATAL_ERROR "fake package == 8.9 found")
+endif()
+
+pkg_check_modules(FakePackageLLT_INV QUIET "cmakeinternalfakepackage <<= 9")
+if (FakePackageLLT_FAIL_FOUND)
+ message(FATAL_ERROR "fake package <<= 9 found")
+endif()
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index e12b52fe4..671ff518b 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -16,4 +16,5 @@ if (PKG_CONFIG_FOUND)
run_cmake(FindPkgConfig_GET_VARIABLE)
run_cmake(FindPkgConfig_cache_variables)
run_cmake(FindPkgConfig_IMPORTED_TARGET)
+ run_cmake(FindPkgConfig_VERSION_OPERATORS)
endif ()
diff --git a/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt
new file mode 100644
index 000000000..2171ef6d8
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/target_subdir/CMakeLists.txt
@@ -0,0 +1,5 @@
+# a target with visibility only in this directory
+pkg_check_modules(FakePackage1_dir REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakepackage1)
+
+# the same with global visibility
+pkg_check_modules(FakePackage1_global REQUIRED QUIET IMPORTED_TARGET GLOBAL cmakeinternalfakepackage1)
diff --git a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake
index b544ba640..e00af581b 100644
--- a/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GNUInstallDirs/RunCMakeTest.cmake
@@ -1,6 +1,6 @@
include(RunCMake)
-if(SYSTEM_NAME MATCHES "^(.*BSD|DragonFly)$")
+if(SYSTEM_NAME MATCHES "^(([^k].*)?BSD|DragonFly)$")
set(EXPECT_BSD 1)
endif()
diff --git a/Tests/RunCMake/LinkStatic/LinkOptionsLib.c b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c
new file mode 100644
index 000000000..9bbd24cd8
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
index 0d2949211..d3a8afb21 100644
--- a/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
+++ b/Tests/RunCMake/LinkStatic/RunCMakeTest.cmake
@@ -1,3 +1,30 @@
include(RunCMake)
run_cmake(LINK_SEARCH_STATIC)
+
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ # Intel compiler does not reject bad flags or objects!
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(STATIC_LIBRARY_OPTIONS)
+
+ run_cmake_target(STATIC_LIBRARY_OPTIONS basic StaticLinkOptions)
+ run_cmake_target(STATIC_LIBRARY_OPTIONS genex StaticLinkOptions_genex --config Release)
+ run_cmake_target(STATIC_LIBRARY_OPTIONS shared SharedLinkOptions)
+
+ unset(RunCMake_TEST_OPTIONS)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
new file mode 100644
index 000000000..858ce06f7
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake
new file mode 100644
index 000000000..a686de945
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-genex-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
new file mode 100644
index 000000000..8c1e96e61
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-check.cmake
@@ -0,0 +1,4 @@
+
+if (actual_stdout MATCHES "BADFLAG")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected flag 'BADFLAG'.")
+endif()
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
new file mode 100644
index 000000000..587af1d96
--- /dev/null
+++ b/Tests/RunCMake/LinkStatic/STATIC_LIBRARY_OPTIONS.cmake
@@ -0,0 +1,21 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+add_library(StaticLinkOptions STATIC LinkOptionsLib.c)
+set_property(TARGET StaticLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj})
+
+# static library with generator expression
+add_library(StaticLinkOptions_genex STATIC LinkOptionsLib.c)
+set_property(TARGET StaticLinkOptions_genex PROPERTY STATIC_LIBRARY_OPTIONS
+ $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+# shared library do not use property STATIC_LIBRARY_OPTIONS
+add_library(SharedLinkOptions SHARED LinkOptionsLib.c)
+set_property(TARGET SharedLinkOptions PROPERTY STATIC_LIBRARY_OPTIONS ${pre}BADFLAG${obj})
diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt
new file mode 100644
index 000000000..9a606ee60
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CMP0058-OLD-by-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0058-OLD-by.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0058 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt
new file mode 100644
index 000000000..ba6e5da4e
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CMP0058-OLD-no-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0058-OLD-no.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0058 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake
new file mode 100644
index 000000000..505f75094
--- /dev/null
+++ b/Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.12)
+project(Test LANGUAGES C)
+
+configure_file(PreventConfigureFileDupBuildRule.cmake PreventTargetAliasesDupBuildRule.cmake @ONLY)
+add_subdirectory(SubDirConfigureFileDup)
diff --git a/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake
new file mode 100644
index 000000000..da6f86a73
--- /dev/null
+++ b/Tests/RunCMake/Ninja/PreventTargetAliasesDupBuildRule.cmake
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.12)
+project(Test LANGUAGES C)
+
+# fake launcher executable
+set(input_launcher_executable ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fake_launcher_executable "")
+
+# application and executable name
+set(application_target "HelloApp")
+set(application_name "Hello")
+set(executable_name "Hello")
+
+# target built in "<root>/bin"
+add_executable(${application_target} hello.c)
+set_target_properties(${application_target} PROPERTIES
+ OUTPUT_NAME ${executable_name}
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin
+ )
+
+# configured launcher in "<root>"
+set(configured_launcher_executable "${CMAKE_CURRENT_BINARY_DIR}/${application_name}")
+
+# create command to copy the launcher
+add_custom_command(
+ DEPENDS
+ ${input_launcher_executable}
+ OUTPUT
+ ${configured_launcher_executable}
+ COMMAND
+ ${CMAKE_COMMAND} -E copy ${input_launcher_executable} ${configured_launcher_executable}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT
+ "Configuring application launcher: ${application_name}"
+ )
+
+add_custom_target(Configure${application_name}Launcher ALL
+ DEPENDS
+ ${application_target}
+ ${input_launcher_executable}
+ ${configured_launcher_executable}
+ )
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index b6e6cd4fc..9e1e9a5fd 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -205,15 +205,16 @@ function(run_sub_cmake test ninja_output_path_prefix)
set(cmd_prefix "")
set(cmd_suffix "")
endif()
+ set(fs_delay 3) # We assume the system as 1 sec timestamp resolution.
file(WRITE "${top_build_ninja}" "\
subninja ${escaped_ninja_output_path_prefix}/build.ninja
default ${escaped_ninja_output_path_prefix}/all
-# Sleep for 1 second before to regenerate to make sure the timestamp of
+# Sleep for long enough before regenerating to make sure the timestamp of
# the top build.ninja will be strictly greater than the timestamp of the
-# sub/build.ninja file. We assume the system as 1 sec timestamp resolution.
+# sub/build.ninja file.
rule RERUN
- command = ${cmd_prefix}\"${escaped_CMAKE_COMMAND}\" -E sleep 1 && \"${escaped_CMAKE_COMMAND}\" -E touch \"${escaped_top_build_ninja}\"${cmd_suffix}
+ command = ${cmd_prefix}\"${escaped_CMAKE_COMMAND}\" -E sleep ${fs_delay} && \"${escaped_CMAKE_COMMAND}\" -E touch \"${escaped_top_build_ninja}\"${cmd_suffix}
description = Testing regeneration
generator = 1
@@ -239,7 +240,7 @@ build build.ninja: RERUN ${escaped_build_ninja_dep} || ${escaped_ninja_output_pa
# Test regeneration rules run in order.
set(main_cmakelists "${RunCMake_SOURCE_DIR}/CMakeLists.txt")
- sleep(1) # Assume the system as 1 sec timestamp resolution.
+ sleep(${fs_delay})
touch("${main_cmakelists}")
touch("${build_ninja_dep}")
run_ninja("${top_build_dir}")
@@ -278,3 +279,17 @@ foreach(ninja_output_path_prefix "sub space" "sub")
run_sub_cmake(SubDirPrefix "${ninja_output_path_prefix}")
run_sub_cmake(CustomCommandWorkingDirectory "${ninja_output_path_prefix}")
endforeach(ninja_output_path_prefix)
+
+function (run_PreventTargetAliasesDupBuildRule)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventTargetAliasesDupBuildRule-build)
+ run_cmake(PreventTargetAliasesDupBuildRule)
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err)
+endfunction ()
+run_PreventTargetAliasesDupBuildRule()
+
+function (run_PreventConfigureFileDupBuildRule)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventConfigureFileDupBuildRule-build)
+ run_cmake(PreventConfigureFileDupBuildRule)
+ run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err)
+endfunction()
+run_PreventConfigureFileDupBuildRule()
diff --git a/Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt
new file mode 100644
index 000000000..433f77bf3
--- /dev/null
+++ b/Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt
@@ -0,0 +1 @@
+configure_file(../PreventConfigureFileDupBuildRule.cmake PreventTargetAliasesDupBuildRule.cmake @ONLY)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 69c96cc3d..c076ad9b2 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -65,6 +65,13 @@ function(run_cmake test)
else()
set(maybe_timeout "")
endif()
+ if(RunCMake-stdin-file AND EXISTS ${top_src}/${RunCMake-stdin-file})
+ set(maybe_input_file INPUT_FILE ${top_src}/${RunCMake-stdin-file})
+ elseif(EXISTS ${top_src}/${test}-stdin.txt)
+ set(maybe_input_file INPUT_FILE ${top_src}/${test}-stdin.txt)
+ else()
+ set(maybe_input_file "")
+ endif()
if(RunCMake_TEST_COMMAND)
execute_process(
COMMAND ${RunCMake_TEST_COMMAND}
@@ -74,6 +81,7 @@ function(run_cmake test)
RESULT_VARIABLE actual_result
ENCODING UTF8
${maybe_timeout}
+ ${maybe_input_file}
)
else()
if(RunCMake_GENERATOR_INSTANCE)
@@ -96,6 +104,7 @@ function(run_cmake test)
RESULT_VARIABLE actual_result
ENCODING UTF8
${maybe_timeout}
+ ${maybe_input_file}
)
endif()
set(msg "")
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt
new file mode 100644
index 000000000..7f248ae17
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt
@@ -0,0 +1,2 @@
+^-->value<--
+-->value<--$
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake
new file mode 100644
index 000000000..b81fd56eb
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0053 NEW)
+
+set($ value)
+set(dollar $)
+message("-->${${dollar}}<--")
+message("-->${$}<--")
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
new file mode 100644
index 000000000..aecd4d333
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt
@@ -0,0 +1,24 @@
+^CMake Deprecation Warning at CMP0053-Dollar-OLD.cmake:1 \(cmake_policy\):
+ The OLD behavior for policy CMP0053 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+-->value<--
+CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\):
+ Syntax error in cmake code at
+
+ .*CMP0053-Dollar-OLD.cmake:6
+
+ when parsing string
+
+ -->\${\$}<--
+
+ syntax error, unexpected \$, expecting } \(7\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake
new file mode 100644
index 000000000..647f4648b
--- /dev/null
+++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0053 OLD)
+
+set($ value)
+set(dollar $)
+message("-->${${dollar}}<--")
+message("-->${$}<--")
diff --git a/Tests/RunCMake/Syntax/QueryCache-stderr.txt b/Tests/RunCMake/Syntax/QueryCache-stderr.txt
new file mode 100644
index 000000000..db6b2b7d6
--- /dev/null
+++ b/Tests/RunCMake/Syntax/QueryCache-stderr.txt
@@ -0,0 +1,2 @@
+-->cache value<--
+-->local value<--
diff --git a/Tests/RunCMake/Syntax/QueryCache.cmake b/Tests/RunCMake/Syntax/QueryCache.cmake
new file mode 100644
index 000000000..20c648e60
--- /dev/null
+++ b/Tests/RunCMake/Syntax/QueryCache.cmake
@@ -0,0 +1,6 @@
+
+set(query_var "cache value" CACHE STRING "")
+set(query_var "local value")
+
+message("-->$CACHE{query_var}<--")
+message("-->${query_var}<--")
diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
index b8f5fd02a..8d74dc163 100644
--- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake
@@ -111,6 +111,11 @@ run_cmake(CMP0053-NameWithNewlineQuoted)
run_cmake(CMP0053-NameWithCarriageReturnQuoted)
run_cmake(CMP0053-NameWithEscapedSpacesQuoted)
run_cmake(CMP0053-NameWithEscapedTabsQuoted)
+run_cmake(CMP0053-Dollar-OLD)
+run_cmake(CMP0053-Dollar-NEW)
+
+# Variable special types
+run_cmake(QueryCache)
# Function and macro tests.
run_cmake(FunctionUnmatched)
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 5af6fcd8c..2441a9cad 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -24,6 +24,8 @@
\* CMP0068
\* CMP0069
\* CMP0073
+ \* CMP0076
+ \* CMP0081
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt
index d47dd4de3..d47dd4de3 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface-stderr.txt
+++ b/Tests/RunCMake/TargetSources/CMP0076-OLD-stderr.txt
diff --git a/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake
new file mode 100644
index 000000000..4d8c268ef
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-OLD.cmake
@@ -0,0 +1,10 @@
+cmake_policy(SET CMP0076 OLD)
+
+add_library(iface INTERFACE)
+target_sources(iface INTERFACE empty_1.cpp)
+
+get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES)
+message(STATUS "iface: ${iface_sources}")
+
+add_executable(main main.cpp)
+target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt
new file mode 100644
index 000000000..217c7626a
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN-stderr.txt
@@ -0,0 +1,21 @@
+CMake Warning \(dev\) at CMP0076-WARN/CMakeLists.txt:2 \(target_sources\):
+ Policy CMP0076 is not set: target_sources\(\) command converts relative paths
+ to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+
+ An interface source of target "publiclib" has a relative path.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at CMP0076-WARN/CMakeLists.txt:2 \(target_sources\):
+ Policy CMP0076 is not set: target_sources\(\) command converts relative paths
+ to absolute. Run "cmake --help-policy CMP0076" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+
+ A private source from a directory other than that of target "publiclib" has
+ a relative path.
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error in CMakeLists.txt:
+ Target "publiclib" contains relative path in its INTERFACE_SOURCES:
+
+ "CMP0076-WARN/subdir_empty_1.cpp"
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake
new file mode 100644
index 000000000..2e0733112
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.12)
+
+add_library(publiclib)
+
+add_subdirectory(CMP0076-WARN)
+
+add_executable(main main.cpp)
+target_link_libraries(main publiclib)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt
new file mode 100644
index 000000000..f9c7d6d5e
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+target_sources(publiclib INTERFACE CMP0076-WARN/subdir_empty_1.cpp
+ PRIVATE empty_1.cpp)
diff --git a/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0076-WARN/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt
new file mode 100644
index 000000000..4581d8a88
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface-stdout.txt
@@ -0,0 +1 @@
+-- iface: .*Tests/RunCMake/TargetSources/empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
index 8bb6149d9..0d3e9a456 100644
--- a/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
+++ b/Tests/RunCMake/TargetSources/RelativePathInInterface.cmake
@@ -1,6 +1,10 @@
+cmake_policy(SET CMP0076 NEW)
add_library(iface INTERFACE)
target_sources(iface INTERFACE empty_1.cpp)
+get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES)
+message(STATUS "iface: ${iface_sources}")
+
add_executable(main main.cpp)
target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt
new file mode 100644
index 000000000..7f480829f
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx-stdout.txt
@@ -0,0 +1 @@
+-- genexlib: \$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp>;\$<1:.*Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/../empty_1.cpp>;\$<1:empty_2.cpp>
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake
new file mode 100644
index 000000000..1cdc2a785
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx.cmake
@@ -0,0 +1,10 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(genexlib)
+add_subdirectory(RelativePathInSubdirGenEx)
+
+get_property(genexlib_sources TARGET genexlib PROPERTY SOURCES)
+message(STATUS "genexlib: ${genexlib_sources}")
+
+add_executable(genexmain main.cpp)
+target_link_libraries(genexmain genexlib)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt
new file mode 100644
index 000000000..3bcf454da
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+target_sources(genexlib PUBLIC $<1:${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp>
+ $<1:${CMAKE_CURRENT_LIST_DIR}/../empty_1.cpp>
+ PRIVATE $<1:empty_2.cpp>)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirGenEx/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt
new file mode 100644
index 000000000..aa4851ffa
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude-stdout.txt
@@ -0,0 +1 @@
+-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp;empty_1.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake
new file mode 100644
index 000000000..4acbecacc
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(privatelib)
+
+include("RelativePathInSubdirInclude/CMakeLists.txt")
+
+get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES)
+message(STATUS "privatelib: ${privatelib_sources}")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt
new file mode 100644
index 000000000..3dcb13545
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/CMakeLists.txt
@@ -0,0 +1,3 @@
+
+target_sources(privatelib PRIVATE "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_1.cpp"
+ empty_1.cpp)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInclude/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt
new file mode 100644
index 000000000..5990a0599
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface-stdout.txt
@@ -0,0 +1 @@
+-- iface: .*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake
new file mode 100644
index 000000000..3652b4f64
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface.cmake
@@ -0,0 +1,11 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(iface INTERFACE)
+
+add_subdirectory(RelativePathInSubdirInterface)
+
+get_property(iface_sources TARGET iface PROPERTY INTERFACE_SOURCES)
+message(STATUS "iface: ${iface_sources}")
+
+add_executable(main main.cpp)
+target_link_libraries(main iface)
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt
new file mode 100644
index 000000000..02e69669e
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+target_sources(iface INTERFACE subdir_empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp"
+ ../empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirInterface/subdir_empty_2.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt
new file mode 100644
index 000000000..fa5bcbfee
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate-stdout.txt
@@ -0,0 +1 @@
+-- privatelib: .*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_1.cpp;.*Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/../empty_2.cpp
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake
new file mode 100644
index 000000000..d0d3dc441
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0076 NEW)
+
+add_library(privatelib)
+
+add_subdirectory(RelativePathInSubdirPrivate)
+
+get_property(privatelib_sources TARGET privatelib PROPERTY SOURCES)
+message(STATUS "privatelib: ${privatelib_sources}")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt
new file mode 100644
index 000000000..56ee853e1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+target_sources(privatelib PRIVATE subdir_empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/subdir_empty_2.cpp"
+ ../empty_1.cpp
+ "${CMAKE_CURRENT_LIST_DIR}/../empty_2.cpp")
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_1.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
new file mode 100644
index 000000000..11ec041d1
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/RelativePathInSubdirPrivate/subdir_empty_2.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int empty()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index 36d01de6f..bee8c4e38 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -6,5 +6,11 @@ endif()
run_cmake(OriginDebug)
run_cmake(CMP0026-LOCATION)
+run_cmake(CMP0076-OLD)
+run_cmake(CMP0076-WARN)
run_cmake(RelativePathInInterface)
+run_cmake(RelativePathInSubdirGenEx)
+run_cmake(RelativePathInSubdirInterface)
+run_cmake(RelativePathInSubdirPrivate)
+run_cmake(RelativePathInSubdirInclude)
run_cmake(ExportBuild)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt
new file mode 100644
index 000000000..d4fa6e4b8
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW-stdout.txt
@@ -0,0 +1,2 @@
+-- PREFIX='_'
+-- TARGET NAME='example'
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake
new file mode 100644
index 000000000..ce77218c8
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0078 NEW)
+include(CMP0078-common.cmake)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt
new file mode 100644
index 000000000..62f5371e1
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD-stdout.txt
@@ -0,0 +1,2 @@
+-- PREFIX=''
+-- TARGET NAME='_example'
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake
new file mode 100644
index 000000000..2c4d142d5
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0078 OLD)
+include(CMP0078-common.cmake)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt
new file mode 100644
index 000000000..bc8da4c29
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at .*/Modules/UseSWIG.cmake:[0-9]+ \(message\):
+ Policy CMP0078 is not set. Run "cmake --help-policy CMP0078" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+Call Stack \(most recent call first\):
+ CMP0078-common.cmake:6 \(swig_add_library\)
+ CMP0078-WARN.cmake:1 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt
new file mode 100644
index 000000000..62f5371e1
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stdout.txt
@@ -0,0 +1,2 @@
+-- PREFIX=''
+-- TARGET NAME='_example'
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake
new file mode 100644
index 000000000..86b21a585
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN.cmake
@@ -0,0 +1 @@
+include(CMP0078-common.cmake)
diff --git a/Tests/RunCMake/UseSWIG/CMP0078-common.cmake b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake
new file mode 100644
index 000000000..6cf39dcf8
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMP0078-common.cmake
@@ -0,0 +1,10 @@
+
+set(SWIG_EXECUTABLE "swig")
+set(SWIG_DIR "/swig")
+include(UseSWIG)
+
+swig_add_library(example LANGUAGE python TYPE MODULE SOURCES example.i)
+
+get_property(prefix TARGET ${SWIG_MODULE_example_REAL_NAME} PROPERTY PREFIX)
+message(STATUS "PREFIX='${prefix}'")
+message(STATUS "TARGET NAME='${SWIG_MODULE_example_REAL_NAME}'")
diff --git a/Tests/RunCMake/UseSWIG/CMakeLists.txt b/Tests/RunCMake/UseSWIG/CMakeLists.txt
new file mode 100644
index 000000000..d1b0d2c3e
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.10)
+project(${RunCMake_TEST} C)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
new file mode 100644
index 000000000..b96622ae3
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0078-WARN)
+run_cmake(CMP0078-OLD)
+run_cmake(CMP0078-NEW)
diff --git a/Tests/RunCMake/UseSWIG/example.i b/Tests/RunCMake/UseSWIG/example.i
new file mode 100644
index 000000000..86625aa3a
--- /dev/null
+++ b/Tests/RunCMake/UseSWIG/example.i
@@ -0,0 +1,2 @@
+/* File : example.i */
+%module example
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 0d178cee6..4bfb2f2e9 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -7,7 +7,10 @@ run_cmake(VsTargetsFileReferences)
run_cmake(VsCustomProps)
run_cmake(VsDebuggerWorkingDir)
run_cmake(VsDebuggerCommand)
+run_cmake(VsDebuggerCommandArguments)
+run_cmake(VsDebuggerEnvironment)
run_cmake(VsCSharpCustomTags)
run_cmake(VsCSharpReferenceProps)
run_cmake(VsCSharpWithoutSources)
run_cmake(VsSdkDirectories)
+run_cmake(VsGlobals)
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake
index 0ded7806d..440f9f263 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake
@@ -9,7 +9,7 @@ set(debuggerCommandSet FALSE)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^ *<LocalDebuggerCommand[^>]*>([^<>]+)</LocalDebuggerCommand>$")
- if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command foo")
message(STATUS "foo.vcxproj has debugger command set")
set(debuggerCommandSet TRUE)
endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake
index e29adc4f0..5dcb6d131 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake
@@ -2,4 +2,4 @@ enable_language(CXX)
add_library(foo foo.cpp)
set_target_properties(foo PROPERTIES
- VS_DEBUGGER_COMMAND "my-debugger-command")
+ VS_DEBUGGER_COMMAND "my-debugger-command $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake
new file mode 100644
index 000000000..b2e0a4372
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments-check.cmake
@@ -0,0 +1,22 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(debuggerCommandArgumentsSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<LocalDebuggerCommandArguments[^>]*>([^<>]+)</LocalDebuggerCommandArguments>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command-arguments foo")
+ message(STATUS "foo.vcxproj has debugger command arguments set")
+ set(debuggerCommandArgumentsSet TRUE)
+ endif()
+ endif()
+endforeach()
+
+if(NOT debuggerCommandArgumentsSet)
+ set(RunCMake_TEST_FAILED "LocalDebuggerCommandArguments not found or not set correctly.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake
new file mode 100644
index 000000000..aa87cdc4d
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerCommandArguments.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+add_library(foo foo.cpp)
+
+set_target_properties(foo PROPERTIES
+ VS_DEBUGGER_COMMAND_ARGUMENTS "my-debugger-command-arguments $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake
new file mode 100644
index 000000000..2427ad454
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment-check.cmake
@@ -0,0 +1,22 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(debuggerEnvironmentSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<LocalDebuggerEnvironment[^>]*>([^<>]+)</LocalDebuggerEnvironment>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-environment foo")
+ message(STATUS "foo.vcxproj has debugger environment set")
+ set(debuggerEnvironmentSet TRUE)
+ endif()
+ endif()
+endforeach()
+
+if(NOT debuggerEnvironmentSet)
+ set(RunCMake_TEST_FAILED "LocalDebuggerEnvironment not found or not set correctly.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake
new file mode 100644
index 000000000..d5bec4c56
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsDebuggerEnvironment.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+add_library(foo foo.cpp)
+
+set_target_properties(foo PROPERTIES
+ VS_DEBUGGER_ENVIRONMENT "my-debugger-environment $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake
index 637c68c60..6a142f81e 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir-check.cmake
@@ -9,7 +9,7 @@ set(debuggerWorkDirSet FALSE)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^ *<LocalDebuggerWorkingDirectory[^>]*>([^<>]+)</LocalDebuggerWorkingDirectory>$")
- if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory")
+ if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-directory foo")
message(STATUS "foo.vcxproj has debugger working dir set")
set(debuggerWorkDirSet TRUE)
endif()
diff --git a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake
index a277c6575..36daed00e 100644
--- a/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake
+++ b/Tests/RunCMake/VS10Project/VsDebuggerWorkingDir.cmake
@@ -2,4 +2,4 @@ enable_language(CXX)
add_library(foo foo.cpp)
set_target_properties(foo PROPERTIES
- VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory")
+ VS_DEBUGGER_WORKING_DIRECTORY "my-debugger-directory $<TARGET_PROPERTY:foo,NAME>")
diff --git a/Tests/RunCMake/VS10Project/VsGlobals-check.cmake b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake
new file mode 100644
index 000000000..0e7fd45c1
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsGlobals-check.cmake
@@ -0,0 +1,44 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(InsideGlobals FALSE)
+set(DefaultLanguageSet FALSE)
+set(MinimumVisualStudioVersionSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$")
+ set(InsideGlobals TRUE)
+ elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$")
+ if("${CMAKE_MATCH_1}" STREQUAL "en-US")
+ if(InsideGlobals)
+ message(STATUS "foo.vcxproj has correct DefaultLanguage global property")
+ set(DefaultLanguageSet TRUE)
+ else()
+ message(STATUS "DefaultLanguage is set but not within \"Globals\" property group")
+ endif()
+ endif()
+ elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$")
+ if("${CMAKE_MATCH_1}" STREQUAL "14.0")
+ if(InsideGlobals)
+ message(STATUS "foo.vcxproj has correct MinimumVisualStudioVersion global property")
+ set(MinimumVisualStudioVersionSet TRUE)
+ else()
+ message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group")
+ endif()
+ endif()
+ endif()
+endforeach()
+
+if(NOT DefaultLanguageSet)
+ set(RunCMake_TEST_FAILED "DefaultLanguageSet not found or not set correctly.")
+ return()
+endif()
+
+if(NOT MinimumVisualStudioVersionSet)
+ set(RunCMake_TEST_FAILED "MinimumVisualStudioVersionSet not found or not set correctly.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsGlobals.cmake b/Tests/RunCMake/VS10Project/VsGlobals.cmake
new file mode 100644
index 000000000..a3ed5afa9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsGlobals.cmake
@@ -0,0 +1,8 @@
+enable_language(CXX)
+
+set(CMAKE_VS_GLOBALS
+ "DefaultLanguage=en-US"
+ "MinimumVisualStudioVersion=14.0"
+)
+
+add_library(foo foo.cpp)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt
new file mode 100644
index 000000000..34ac57d20
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0063-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0063 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 1150666d5..fb0400560 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -219,6 +219,7 @@ endfunction()
if(NOT XCODE_VERSION VERSION_LESS 7)
XcodeSchemaGeneration()
+ run_cmake(XcodeSchemaProperty)
endif()
if(XCODE_VERSION VERSION_GREATER_EQUAL 8)
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
new file mode 100644
index 000000000..f675d819a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -0,0 +1,33 @@
+function(check_property property matcher)
+ set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${property}.xcscheme")
+ file(STRINGS ${schema} actual-${property}
+ REGEX "${matcher}" LIMIT_COUNT 1)
+ if(NOT actual-${property})
+ message(SEND_ERROR "Xcode schema property ${property}: Could not find ${matcher} in schema ${schema}")
+ endif()
+endfunction()
+
+check_property("ADDRESS_SANITIZER" "enableAddressSanitizer")
+check_property("ADDRESS_SANITIZER_USE_AFTER_RETURN" "enableASanStackUseAfterReturn")
+check_property("THREAD_SANITIZER" "enableThreadSanitizer")
+check_property("THREAD_SANITIZER_STOP" "stopOnEveryThreadSanitizerIssue")
+check_property("UNDEFINED_BEHAVIOUR_SANITIZER" "enableUBSanitizer")
+check_property("UNDEFINED_BEHAVIOUR_SANITIZER_STOP" "stopOnEveryUBSanitizerIssue")
+check_property("DISABLE_MAIN_THREAD_CHECKER" "disableMainThreadChecker")
+check_property("MAIN_THREAD_CHECKER_STOP" "stopOnEveryMainThreadCheckerIssue")
+
+check_property("MALLOC_SCRIBBLE" "MallocScribble")
+check_property("MALLOC_GUARD_EDGES" "MallocGuardEdges")
+check_property("GUARD_MALLOC" "DYLD_INSERT_LIBRARIES")
+check_property("ZOMBIE_OBJECTS" "NSZombieEnabled")
+check_property("MALLOC_STACK" "MallocStackLogging")
+check_property("DYNAMIC_LINKER_API_USAGE" "DYLD_PRINT_APIS")
+check_property("DYNAMIC_LIBRARY_LOADS" "DYLD_PRINT_LIBRARIES")
+
+check_property("EXECUTABLE" "myExecutable")
+check_property("ARGUMENTS" [=["--foo"]=])
+check_property("ARGUMENTS" [=["--bar=baz"]=])
+check_property("ENVIRONMENT" [=[key="FOO"]=])
+check_property("ENVIRONMENT" [=[value="foo"]=])
+check_property("ENVIRONMENT" [=[key="BAR"]=])
+check_property("ENVIRONMENT" [=[value="bar"]=])
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
new file mode 100644
index 000000000..2b72a64f1
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(CMAKE_XCODE_GENERATE_SCHEME ON)
+
+project(XcodeSchemaProperty CXX)
+
+function(create_scheme_for_variable variable)
+ set(CMAKE_XCODE_SCHEME_${variable} ON)
+ add_executable(${variable} main.cpp)
+endfunction()
+
+create_scheme_for_variable(ADDRESS_SANITIZER)
+create_scheme_for_variable(ADDRESS_SANITIZER_USE_AFTER_RETURN)
+create_scheme_for_variable(THREAD_SANITIZER)
+create_scheme_for_variable(THREAD_SANITIZER_STOP)
+create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER)
+create_scheme_for_variable(UNDEFINED_BEHAVIOUR_SANITIZER_STOP)
+create_scheme_for_variable(DISABLE_MAIN_THREAD_CHECKER)
+create_scheme_for_variable(MAIN_THREAD_CHECKER_STOP)
+
+create_scheme_for_variable(MALLOC_SCRIBBLE)
+create_scheme_for_variable(MALLOC_GUARD_EDGES)
+create_scheme_for_variable(GUARD_MALLOC)
+create_scheme_for_variable(ZOMBIE_OBJECTS)
+create_scheme_for_variable(MALLOC_STACK)
+create_scheme_for_variable(DYNAMIC_LINKER_API_USAGE)
+create_scheme_for_variable(DYNAMIC_LIBRARY_LOADS)
+
+function(create_scheme_for_property property value)
+ set(XCODE_SCHEME_${property} ON)
+ add_executable(${property} main.cpp)
+ set_target_properties(${property} PROPERTIES XCODE_SCHEME_${property} "${value}")
+endfunction()
+
+create_scheme_for_property(EXECUTABLE myExecutable)
+create_scheme_for_property(ARGUMENTS "--foo;--bar=baz")
+create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar")
diff --git a/Tests/RunCMake/add_link_options/CMakeLists.txt b/Tests/RunCMake/add_link_options/CMakeLists.txt
new file mode 100644
index 000000000..14ef56e8e
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake
new file mode 100644
index 000000000..d0ef8de85
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion-build-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake
new file mode 100644
index 000000000..7316ef52b
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_SHELL_expansion.cmake
@@ -0,0 +1,4 @@
+
+set (LINKER_OPTION "LINKER:SHELL:-foo bar")
+
+include ("LINKER_expansion-list.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake
new file mode 100644
index 000000000..d0ef8de85
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-build-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
new file mode 100644
index 000000000..34dcc6756
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-list.cmake
@@ -0,0 +1,36 @@
+
+enable_language(C)
+
+add_executable(dump dump.c)
+
+add_link_options("${LINKER_OPTION}")
+
+# ensure no temp file will be used
+string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+
+add_library(example SHARED LinkOptionsLib.c)
+# use LAUNCH facility to dump linker command
+set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+
+add_dependencies (example dump)
+
+# generate reference for LINKER flag
+if (CMAKE_C_LINKER_WRAPPER_FLAG)
+ set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG})
+ list(GET linker_flag -1 linker_space)
+ if (linker_space STREQUAL " ")
+ list(REMOVE_AT linker_flag -1)
+ else()
+ set(linker_space)
+ endif()
+ list (JOIN linker_flag " " linker_flag)
+ if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP)
+ string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar")
+ else()
+ set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar")
+ endif()
+else()
+ set(linker_flag "-foo bar")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}")
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake
new file mode 100644
index 000000000..bebd6c736
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion-validation.cmake
@@ -0,0 +1,15 @@
+
+if (actual_stdout MATCHES "(LINKER|SHELL):")
+ set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.")
+ return()
+endif()
+
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt")
+ set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.")
+ return()
+endif()
+file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag)
+
+if (NOT actual_stdout MATCHES "${linker_flag}")
+ set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINKER_expansion.cmake b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake
new file mode 100644
index 000000000..42b286d2d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINKER_expansion.cmake
@@ -0,0 +1,4 @@
+
+set (LINKER_OPTION "LINKER:-foo,bar")
+
+include ("LINKER_expansion-list.cmake")
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake
new file mode 100644
index 000000000..4a22d7e6d
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_EXECUTABLE_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_EXECUTABLE_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_(SHARED|MODULE)_RELEASE")
+ set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|MODULE)_RELEASE'.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-exe-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake
new file mode 100644
index 000000000..d695761c9
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_MODULE_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_MODULE_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_(SHARED|EXECUTABLE)_RELEASE")
+ set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(SHARED|EXECUTABLE)_RELEASE'.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-mod-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake
new file mode 100644
index 000000000..eaac8e372
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_SHARED_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_SHARED_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_(MODULE|EXECUTABLE)_RELEASE")
+ set (RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_(MODULE|EXECUTABLE)_RELEASE'.")
+endif()
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake
new file mode 100644
index 000000000..802ff4f42
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LINK_OPTIONS.cmake
@@ -0,0 +1,17 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_SHARED_RELEASE${obj}>)
+add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>,$<CONFIG:Release>>:${pre}BADFLAG_MODULE_RELEASE${obj}>)
+add_link_options($<$<AND:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>,$<CONFIG:Release>>:${pre}BADFLAG_EXECUTABLE_RELEASE${obj}>)
+
+add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
+
+add_library(LinkOptions_mod MODULE LinkOptionsLib.c)
+
+add_executable(LinkOptions_exe LinkOptionsExe.c)
diff --git a/Tests/RunCMake/add_link_options/LinkOptionsExe.c b/Tests/RunCMake/add_link_options/LinkOptionsExe.c
new file mode 100644
index 000000000..8488f4e58
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LinkOptionsExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_link_options/LinkOptionsLib.c b/Tests/RunCMake/add_link_options/LinkOptionsLib.c
new file mode 100644
index 000000000..9bbd24cd8
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_link_options/RunCMakeTest.cmake b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake
new file mode 100644
index 000000000..4f5df724e
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/RunCMakeTest.cmake
@@ -0,0 +1,38 @@
+
+include(RunCMake)
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ # Intel compiler does not reject bad flags or objects!
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(LINK_OPTIONS)
+
+ run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
+ run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
+ run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)
+
+ unset(RunCMake_TEST_OPTIONS)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
+
+run_cmake(bad_SHELL_usage)
+
+if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
+ run_cmake(LINKER_expansion)
+ run_cmake_target(LINKER_expansion build all)
+
+ run_cmake(LINKER_SHELL_expansion)
+ run_cmake_target(LINKER_SHELL_expansion build all)
+endif()
diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt
new file mode 100644
index 000000000..02d09f316
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at bad_SHELL_usage.cmake:6 \(add_library\):
+ 'SHELL:' prefix is not supported as part of 'LINKER:' arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake
new file mode 100644
index 000000000..324893ddf
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/bad_SHELL_usage.cmake
@@ -0,0 +1,6 @@
+
+enable_language(C)
+
+add_link_options("LINKER:-foo,SHELL:-bar")
+
+add_library(example SHARED LinkOptionsLib.c)
diff --git a/Tests/RunCMake/add_link_options/dump.c b/Tests/RunCMake/add_link_options/dump.c
new file mode 100644
index 000000000..8baa313fd
--- /dev/null
+++ b/Tests/RunCMake/add_link_options/dump.c
@@ -0,0 +1,13 @@
+
+#include "stdio.h"
+
+int main(int argc, char* argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ printf("%s ", argv[i]);
+ printf("\n");
+
+ return 0;
+}
diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt
index 28e0e7235..1938da37f 100644
--- a/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt
+++ b/Tests/RunCMake/build_command/CMP0061-OLD-make-stderr.txt
@@ -1,4 +1,15 @@
-^[^
+^CMake Deprecation Warning at CMP0061-OLD-make.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0061 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+[^
]+ --build \. --config "Release" -- -i
[^
]+ --build \. --config "Release" --target "MyTarget" -- -i
diff --git a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt
index 1dde84379..85bbdf175 100644
--- a/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt
+++ b/Tests/RunCMake/build_command/CMP0061-OLD-other-stderr.txt
@@ -1,4 +1,15 @@
-^[^
+^CMake Deprecation Warning at CMP0061-OLD-other.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0061 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
++
+[^
]+ --build \. --config "Release"
[^
]+ --build \. --config "Release" --target "MyTarget"
diff --git a/Tests/RunCMake/configure_file/DirInput-stderr.txt b/Tests/RunCMake/configure_file/DirInput-stderr.txt
index 2e0cd144c..165ad80eb 100644
--- a/Tests/RunCMake/configure_file/DirInput-stderr.txt
+++ b/Tests/RunCMake/configure_file/DirInput-stderr.txt
@@ -1,7 +1,7 @@
CMake Error at DirInput.cmake:[0-9]+ \(configure_file\):
configure_file input location
- .*/Tests/RunCMake/configure_file/.
+ .*/Tests/RunCMake/configure_file
is a directory but a file was expected.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt
deleted file mode 100644
index b57e2deb7..000000000
--- a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-(-1|255)
diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt
index b57e2deb7..b57e2deb7 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-result.txt
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
new file mode 100644
index 000000000..a8f10b558
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
@@ -0,0 +1 @@
+ *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
new file mode 100644
index 000000000..11a4edf1a
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
@@ -0,0 +1 @@
+Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___Configure.xml&build=test-build-name&site=test-site&stamp=.*-Experimental&subproject=mysubproj&MD5=.* Size: .*
diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt
index b57e2deb7..b57e2deb7 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-result.txt
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
new file mode 100644
index 000000000..a8f10b558
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
@@ -0,0 +1 @@
+ *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
new file mode 100644
index 000000000..929b2549c
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
@@ -0,0 +1 @@
+Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___RunCMakeTest.cmake&MD5=.* Size: .*
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index ed0e66642..952368d83 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -30,6 +30,8 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
run_ctest_submit(CDashSubmitQuiet QUIET)
+run_ctest_submit_debug(CDashSubmitVerbose)
+run_ctest_submit_debug(FILESNoBuildId FILES ${CMAKE_CURRENT_LIST_FILE})
run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")
diff --git a/Tests/RunCMake/ctest_submit/test.cmake.in b/Tests/RunCMake/ctest_submit/test.cmake.in
index ba826f1b3..35cd16a98 100644
--- a/Tests/RunCMake/ctest_submit/test.cmake.in
+++ b/Tests/RunCMake/ctest_submit/test.cmake.in
@@ -9,6 +9,7 @@ set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+set_property(GLOBAL PROPERTY SubProject "mysubproj")
ctest_start(Experimental)
ctest_configure()
diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
new file mode 100644
index 000000000..cb3c99f5e
--- /dev/null
+++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
@@ -0,0 +1,6 @@
+-- PROG_ABS='PROG_ABS-NOTFOUND'
+-- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND'
+-- PROG_CWD='PROG_CWD-NOTFOUND'
+-- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND'
+-- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD'
+-- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD'
diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake
new file mode 100644
index 000000000..9a42c5e17
--- /dev/null
+++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake
@@ -0,0 +1,63 @@
+# testNoSuchFile should only be found if the file absolute path is
+# incorrectly prepended with the search path.
+
+function(strip_windows_path_prefix p outvar)
+ if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ string(REGEX REPLACE "^.:" "" p "${p}")
+ endif()
+ set(${outvar} "${p}" PARENT_SCOPE)
+endfunction()
+
+strip_windows_path_prefix("${CMAKE_CURRENT_SOURCE_DIR}" srcdir)
+
+file(MAKE_DIRECTORY "tmp${srcdir}")
+configure_file(testCWD "tmp${srcdir}/testNoSuchFile" COPYONLY)
+
+find_program(PROG_ABS
+ NAMES "${srcdir}/testNoSuchFile"
+ PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp"
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_ABS='${PROG_ABS}'")
+
+find_program(PROG_ABS_NPD
+ NAMES "${srcdir}/testNoSuchFile"
+ PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp"
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_ABS_NPD='${PROG_ABS_NPD}'")
+
+# ./testCWD should not be found without '.' being in the path list.
+
+configure_file(testCWD testCWD COPYONLY)
+
+find_program(PROG_CWD
+ NAMES testCWD
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD='${PROG_CWD}'")
+
+find_program(PROG_CWD_NPD
+ NAMES testCWD
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_NPD='${PROG_CWD_NPD}'")
+
+# Confirm that adding '.' to path does locate ./testCWD.
+
+find_program(PROG_CWD_DOT
+ NAMES testCWD
+ PATHS .
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_DOT='${PROG_CWD_DOT}'")
+
+find_program(PROG_CWD_DOT_NPD
+ NAMES testCWD
+ PATHS .
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_DOT_NPD='${PROG_CWD_DOT_NPD}'")
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
index 89307c1ae..6903f057b 100644
--- a/Tests/RunCMake/find_program/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(EnvAndHints)
run_cmake(DirsPerName)
run_cmake(NamesPerDir)
+run_cmake(RelAndAbsPath)
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
run_cmake(WindowsCom)
diff --git a/Tests/RunCMake/find_program/testCWD b/Tests/RunCMake/find_program/testCWD
new file mode 100755
index 000000000..1a2485251
--- /dev/null
+++ b/Tests/RunCMake/find_program/testCWD
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/Tests/RunCMake/install/CMP0062-OLD-stderr.txt b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt
new file mode 100644
index 000000000..de0b70ffc
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0062-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0062 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake
new file mode 100644
index 000000000..c14998ecf
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^dir;dir/empty.txt$]])
diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake
new file mode 100644
index 000000000..e57aab005
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake
@@ -0,0 +1 @@
+install(DIRECTORY dir/ noexist/ DESTINATION dir OPTIONAL)
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake
new file mode 100644
index 000000000..7a20edc36
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^dir1;dir1/empty\.c;dir1/empty\.h;dir2;dir2/pattern;dir2/pattern/empty\.txt;dir3;dir3/empty\.c;dir3/empty\.h;dir3/empty\.txt;dir4;dir4/empty\.c;dir4/empty\.h;dir4/empty\.txt;empty$]])
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake
new file mode 100644
index 000000000..74d804351
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake
@@ -0,0 +1,36 @@
+install(
+ DIRECTORY pattern/
+ DESTINATION dir1
+ FILES_MATCHING
+ PATTERN "*.h"
+ REGEX "\\.c$"
+ )
+
+# FIXME: If/when CMake gains a good way to read file permissions, we should
+# check that these permissions were set correctly.
+install(
+ DIRECTORY pattern
+ DESTINATION dir2
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE
+ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ PATTERN "*.h" EXCLUDE
+ REGEX "\\.c$" EXCLUDE
+ )
+
+install(
+ DIRECTORY pattern/
+ DESTINATION dir3
+ PATTERN "*.h"
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ )
+
+install(
+ DIRECTORY pattern/
+ DESTINATION dir4
+ USE_SOURCE_PERMISSIONS
+ )
+
+install(
+ DIRECTORY
+ DESTINATION empty
+ )
diff --git a/Tests/RunCMake/install/Deprecated-all-check.cmake b/Tests/RunCMake/install/Deprecated-all-check.cmake
new file mode 100644
index 000000000..9ea33a6b4
--- /dev/null
+++ b/Tests/RunCMake/install/Deprecated-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;scripts1;scripts1/script;scripts1/script\.bat;scripts2;scripts2/script;scripts2/script\.bat;scripts3;scripts3/script;scripts3/script\.bat;src;src/empty\.c;src/obj1\.c;src/obj\2.c$]])
diff --git a/Tests/RunCMake/install/Deprecated.cmake b/Tests/RunCMake/install/Deprecated.cmake
new file mode 100644
index 000000000..c435cb507
--- /dev/null
+++ b/Tests/RunCMake/install/Deprecated.cmake
@@ -0,0 +1,13 @@
+enable_language(C)
+
+add_executable(myexe main.c)
+
+install_files(/src FILES empty.c)
+install_files(/src .c obj1)
+install_files(/src "^obj2.c$")
+
+install_targets(/bin myexe)
+
+install_programs(/scripts1 FILES script script.bat)
+install_programs(/scripts2 script script.bat)
+install_programs(/scripts3 "^script(\.bat)?$")
diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake
new file mode 100644
index 000000000..2997a8d4e
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/main.c$]])
diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake
new file mode 100644
index 000000000..812bf4f02
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake
@@ -0,0 +1 @@
+install(FILES main.c noexist.c DESTINATION src OPTIONAL)
diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake
new file mode 100644
index 000000000..b8ba6d0d5
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/empty.c]])
diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake
new file mode 100644
index 000000000..999c271f9
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake
@@ -0,0 +1,5 @@
+install(
+ FILES empty.c
+ DESTINATION src
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ )
diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake
new file mode 100644
index 000000000..27ff68387
--- /dev/null
+++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+set(CMAKE_INSTALL_MFC_LIBRARIES 1)
+set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
+set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
+set(CMAKE_INSTALL_OPENMP_LIBRARIES 1)
+include(InstallRequiredSystemLibraries)
+
+# FIXME: This test emits warnings because InstallRequiredSystemLibraries
+# doesn't currently work properly. The warnings have been suppressed in
+# InstallRequiredSystemLibraries-stderr.txt. This needs to be fixed.
diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake
new file mode 100644
index 000000000..16ff1e1c1
--- /dev/null
+++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;postinstall;preinstall]])
diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake
new file mode 100644
index 000000000..357c68872
--- /dev/null
+++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+add_executable(myexe main.c)
+set_property(TARGET myexe PROPERTY PRE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/preinstall.cmake")
+set_property(TARGET myexe PROPERTY POST_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/postinstall.cmake")
+
+install(TARGETS myexe DESTINATION bin)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index f004ce920..ec022caa9 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -70,7 +70,27 @@ if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}
run_install_test(FILES-TARGET_OBJECTS)
endif()
+run_install_test(TARGETS-InstallFromSubDir)
+run_install_test(TARGETS-OPTIONAL)
+run_install_test(FILES-OPTIONAL)
+run_install_test(DIRECTORY-OPTIONAL)
+
+set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug")
+run_install_test(TARGETS-OUTPUT_NAME)
+unset(RunCMake_TEST_OPTIONS)
+
+run_install_test(Deprecated)
+run_install_test(PRE_POST_INSTALL_SCRIPT)
+run_install_test(SCRIPT)
+run_install_test(TARGETS-CONFIGURATIONS)
+run_install_test(DIRECTORY-PATTERN)
+run_install_test(TARGETS-Parts)
+run_install_test(FILES-PERMISSIONS)
+run_install_test(TARGETS-RPATH)
+run_install_test(InstallRequiredSystemLibraries)
+
set(run_install_test_components 1)
run_install_test(FILES-EXCLUDE_FROM_ALL)
run_install_test(TARGETS-EXCLUDE_FROM_ALL)
run_install_test(TARGETS-NAMELINK_COMPONENT)
+run_install_test(SCRIPT-COMPONENT)
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake
new file mode 100644
index 000000000..48d8e1aec
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake
new file mode 100644
index 000000000..48d8e1aec
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake
new file mode 100644
index 000000000..e09a102af
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake
@@ -0,0 +1 @@
+check_installed([[^$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake
new file mode 100644
index 000000000..aaa9bd45a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake
@@ -0,0 +1,5 @@
+install(
+ SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
+ CODE "write_empty_file(empty2.txt)"
+ COMPONENT dev
+ )
diff --git a/Tests/RunCMake/install/SCRIPT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-all-check.cmake
new file mode 100644
index 000000000..48d8e1aec
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT.cmake b/Tests/RunCMake/install/SCRIPT.cmake
new file mode 100644
index 000000000..f857b5437
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT.cmake
@@ -0,0 +1,4 @@
+install(
+ SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
+ CODE "write_empty_file(empty2.txt)"
+ )
diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake
new file mode 100644
index 000000000..2866e7fb9
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/main-d.c$]])
diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake
new file mode 100644
index 000000000..5531cd2ff
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake
@@ -0,0 +1,2 @@
+install(FILES main.c DESTINATION src CONFIGURATIONS Debug RENAME main-d.c)
+install(FILES main.c DESTINATION src CONFIGURATIONS Release RENAME main-r.c)
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake
new file mode 100644
index 000000000..1d747c301
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;bin/subexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake
new file mode 100644
index 000000000..8615d6ecb
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(myexe main.c)
+add_subdirectory(TARGETS-InstallFromSubDir)
+install(TARGETS myexe subexe DESTINATION bin)
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt
new file mode 100644
index 000000000..477d9381f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(subexe ../main.c)
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake
new file mode 100644
index 000000000..bcf71ddfe
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt
new file mode 100644
index 000000000..86e3ec076
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-stderr.txt
@@ -0,0 +1 @@
+^WARNING: Target "notall" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it\. CMake does not define behavior for this case\.$
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake
new file mode 100644
index 000000000..d3c5cdae2
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(myexe main.c)
+add_executable(notall EXCLUDE_FROM_ALL main.c)
+install(TARGETS myexe notall DESTINATION bin OPTIONAL)
diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake
new file mode 100644
index 000000000..5daecc815
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake
@@ -0,0 +1,13 @@
+if(WIN32)
+ set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]])
+ set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]])
+ set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]])
+
+ check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$")
+elseif(CYGWIN)
+ check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]])
+elseif(APPLE)
+ check_installed([[^bin;bin/libtest4lib\.dylib;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]])
+else()
+ check_installed([[^bin;bin/libtest4lib\.so;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]])
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake
new file mode 100644
index 000000000..67e706941
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake
@@ -0,0 +1,27 @@
+enable_language(C)
+
+add_executable(test1 main.c)
+set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out)
+set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel)
+
+add_executable(test2 main.c)
+set_property(TARGET test2 PROPERTY OUTPUT_NAME test2out)
+set_property(TARGET test2 PROPERTY DEBUG_OUTPUT_NAME test2deb)
+
+add_executable(test3 main.c)
+set_property(TARGET test3 PROPERTY RUNTIME_OUTPUT_NAME test3exc)
+
+add_library(test4 SHARED obj1.c)
+set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4lib)
+
+add_library(test5 STATIC obj1.c)
+set_property(TARGET test5 PROPERTY ARCHIVE_OUTPUT_NAME test5ar)
+
+install(TARGETS
+ test1
+ test2
+ test3
+ test4
+ test5
+ DESTINATION bin
+ )
diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake
new file mode 100644
index 000000000..6245839fc
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]])
diff --git a/Tests/RunCMake/install/TARGETS-Parts.cmake b/Tests/RunCMake/install/TARGETS-Parts.cmake
new file mode 100644
index 000000000..2a46ab9a9
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Parts.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+add_library(mylib STATIC obj1.c)
+set_property(TARGET mylib PROPERTY PUBLIC_HEADER obj1.h)
+install(TARGETS mylib
+ ARCHIVE DESTINATION lib
+ PUBLIC_HEADER DESTINATION include
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake
new file mode 100644
index 000000000..fa52d65cf
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake
@@ -0,0 +1,14 @@
+execute_process(
+ COMMAND "${CMAKE_INSTALL_PREFIX}/bin/myexe"
+ RESULT_VARIABLE MYEXE_RESULT
+ OUTPUT_VARIABLE MYEXE_OUTPUT
+ ERROR_VARIABLE MYEXE_ERROR
+ )
+
+if(NOT MYEXE_RESULT EQUAL "0")
+ set(RunCMake_TEST_FAILED "myexe returned [${MYEXE_RESULT}], was expecting [0]")
+elseif(NOT MYEXE_OUTPUT STREQUAL "")
+ set(RunCMake_TEST_FAILED "myexe printed nonempty output:\n${MYEXE_OUTPUT}")
+elseif(NOT MYEXE_ERROR STREQUAL "")
+ set(RunCMake_TEST_FAILED "myexe printed nonempty error:\n${MYEXE_ERROR}")
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-RPATH.cmake b/Tests/RunCMake/install/TARGETS-RPATH.cmake
new file mode 100644
index 000000000..b75deffff
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RPATH.cmake
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.9)
+
+enable_language(C)
+
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+add_library(mylib SHARED obj1.c)
+add_executable(myexe testobj1.c)
+target_link_libraries(myexe mylib)
+set_property(TARGET myexe PROPERTY INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/root-all/bin")
+set_target_properties(mylib PROPERTIES VERSION 1.0 SOVERSION 1)
+
+install(TARGETS mylib myexe
+ DESTINATION bin
+ )
diff --git a/Tests/RunCMake/install/install_script.cmake b/Tests/RunCMake/install/install_script.cmake
new file mode 100644
index 000000000..1f8522c70
--- /dev/null
+++ b/Tests/RunCMake/install/install_script.cmake
@@ -0,0 +1,5 @@
+function(write_empty_file FILENAME)
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/${FILENAME}" "")
+endfunction()
+
+write_empty_file(empty1.txt)
diff --git a/Tests/RunCMake/install/obj1.c b/Tests/RunCMake/install/obj1.c
index 2411aab79..70007df8a 100644
--- a/Tests/RunCMake/install/obj1.c
+++ b/Tests/RunCMake/install/obj1.c
@@ -1,4 +1,7 @@
-int obj1(void)
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int obj1(void)
{
return 0;
}
diff --git a/Tests/RunCMake/install/obj1.h b/Tests/RunCMake/install/obj1.h
new file mode 100644
index 000000000..d88d5d2b9
--- /dev/null
+++ b/Tests/RunCMake/install/obj1.h
@@ -0,0 +1,6 @@
+#ifndef OBJ1_H
+#define OBJ1_H
+
+int obj1(void);
+
+#endif /* OBJ1_H */
diff --git a/Tests/RunCMake/install/pattern/empty.c b/Tests/RunCMake/install/pattern/empty.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.c
diff --git a/Tests/RunCMake/install/pattern/empty.h b/Tests/RunCMake/install/pattern/empty.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.h
diff --git a/Tests/RunCMake/install/pattern/empty.txt b/Tests/RunCMake/install/pattern/empty.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.txt
diff --git a/Tests/RunCMake/install/postinstall.cmake b/Tests/RunCMake/install/postinstall.cmake
new file mode 100644
index 000000000..7607f40e1
--- /dev/null
+++ b/Tests/RunCMake/install/postinstall.cmake
@@ -0,0 +1 @@
+file(WRITE "${CMAKE_INSTALL_PREFIX}/postinstall" "postinstall")
diff --git a/Tests/RunCMake/install/preinstall.cmake b/Tests/RunCMake/install/preinstall.cmake
new file mode 100644
index 000000000..4b28d1626
--- /dev/null
+++ b/Tests/RunCMake/install/preinstall.cmake
@@ -0,0 +1 @@
+file(WRITE "${CMAKE_INSTALL_PREFIX}/preinstall" "preinstall")
diff --git a/Tests/SimpleInstall/scripts/sample_script b/Tests/RunCMake/install/script
index 81f9f5315..81f9f5315 100755
--- a/Tests/SimpleInstall/scripts/sample_script
+++ b/Tests/RunCMake/install/script
diff --git a/Tests/SimpleInstall/scripts/sample_script.bat b/Tests/RunCMake/install/script.bat
index 64a77b5b0..64a77b5b0 100755
--- a/Tests/SimpleInstall/scripts/sample_script.bat
+++ b/Tests/RunCMake/install/script.bat
diff --git a/Tests/RunCMake/install/testobj1.c b/Tests/RunCMake/install/testobj1.c
new file mode 100644
index 000000000..081ef2027
--- /dev/null
+++ b/Tests/RunCMake/install/testobj1.c
@@ -0,0 +1,9 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ int obj1(void);
+
+int main(void)
+{
+ return obj1();
+}
diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt
index 6e15c0b43..9b9c5e0af 100644
--- a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt
+++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt
@@ -1,4 +1,4 @@
^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\):
- list index: 3 out of range \(-3, 2\)
+ list index: 4 out of range \(-3, 3\)
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake
index 4103d974b..12ac114cb 100644
--- a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake
+++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake
@@ -1,2 +1,2 @@
set(mylist alpha bravo charlie)
-list(INSERT mylist 3 delta)
+list(INSERT mylist 4 delta)
diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake
index bdc23a4f6..a8a0b5717 100644
--- a/Tests/RunCMake/list/RunCMakeTest.cmake
+++ b/Tests/RunCMake/list/RunCMakeTest.cmake
@@ -20,7 +20,6 @@ run_cmake(JOIN-TooManyArguments)
run_cmake(LENGTH-TooManyArguments)
run_cmake(REMOVE_DUPLICATES-TooManyArguments)
run_cmake(REVERSE-TooManyArguments)
-run_cmake(SORT-TooManyArguments)
run_cmake(SUBLIST-TooManyArguments)
run_cmake(FILTER-NotList)
@@ -84,3 +83,16 @@ run_cmake(TRANSFORM-GENEX_STRIP)
run_cmake(TRANSFORM-APPEND)
run_cmake(TRANSFORM-PREPEND)
run_cmake(TRANSFORM-REPLACE)
+
+# argument tests
+run_cmake(SORT-WrongOption)
+run_cmake(SORT-BadCaseOption)
+run_cmake(SORT-BadCompareOption)
+run_cmake(SORT-BadOrderOption)
+run_cmake(SORT-DuplicateOrderOption)
+run_cmake(SORT-DuplicateCompareOption)
+run_cmake(SORT-DuplicateCaseOption)
+run_cmake(SORT-NoCaseOption)
+
+# Successful tests
+run_cmake(SORT)
diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-result.txt b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCaseOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt
new file mode 100644
index 000000000..87dd50283
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCaseOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-BadCaseOption.cmake:1 \(list\):
+ list sub-command SORT value "BAD_CASE_OPTION" for option "CASE" is invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-BadCaseOption.cmake b/Tests/RunCMake/list/SORT-BadCaseOption.cmake
new file mode 100644
index 000000000..ac5c102b6
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCaseOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist CASE BAD_CASE_OPTION)
diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-result.txt b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCompareOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt
new file mode 100644
index 000000000..51b4de291
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCompareOption-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SORT-BadCompareOption.cmake:1 \(list\):
+ list sub-command SORT value "BAD_COMPARE_OPTION" for option "COMPARE" is
+ invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-BadCompareOption.cmake b/Tests/RunCMake/list/SORT-BadCompareOption.cmake
new file mode 100644
index 000000000..d5c632e39
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadCompareOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist COMPARE BAD_COMPARE_OPTION)
diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-result.txt b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadOrderOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt
new file mode 100644
index 000000000..7984e5c92
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadOrderOption-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SORT-BadOrderOption.cmake:1 \(list\):
+ list sub-command SORT value "BAD_ODER_OPTION" for option "ORDER" is
+ invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-BadOrderOption.cmake b/Tests/RunCMake/list/SORT-BadOrderOption.cmake
new file mode 100644
index 000000000..e23219772
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-BadOrderOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist ORDER BAD_ODER_OPTION)
diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt
new file mode 100644
index 000000000..b893f50eb
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-DuplicateCaseOption.cmake:2 \(list\):
+ list sub-command SORT option "CASE" has been specified multiple times.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake
new file mode 100644
index 000000000..ba52b2410
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCaseOption.cmake
@@ -0,0 +1,2 @@
+set (mylist a b c)
+list(SORT mylist CASE INSENSITIVE CASE INSENSITIVE )
diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt
new file mode 100644
index 000000000..83624be42
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-DuplicateCompareOption.cmake:2 \(list\):
+ list sub-command SORT option "COMPARE" has been specified multiple times.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake
new file mode 100644
index 000000000..fd2e31d1e
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateCompareOption.cmake
@@ -0,0 +1,2 @@
+set (mylist a b c)
+list(SORT mylist COMPARE STRING COMPARE STRING)
diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt
new file mode 100644
index 000000000..9e95178a2
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-DuplicateOrderOption.cmake:2 \(list\):
+ list sub-command SORT option "ORDER" has been specified multiple times.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake
new file mode 100644
index 000000000..26d9c7d8a
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-DuplicateOrderOption.cmake
@@ -0,0 +1,2 @@
+set (mylist a b c)
+list(SORT mylist ORDER ASCENDING ORDER ASCENDING)
diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-result.txt b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-NoCaseOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt
new file mode 100644
index 000000000..5c63e77a3
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-NoCaseOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-NoCaseOption.cmake:1 \(list\):
+ list sub-command SORT missing argument for option "CASE".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-NoCaseOption.cmake b/Tests/RunCMake/list/SORT-NoCaseOption.cmake
new file mode 100644
index 000000000..57cc4292c
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-NoCaseOption.cmake
@@ -0,0 +1 @@
+list(SORT mylist CASE)
diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt
deleted file mode 100644
index d3fad6068..000000000
--- a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-^CMake Error at SORT-TooManyArguments.cmake:1 \(list\):
- list sub-command SORT only takes one argument.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-WrongOption-result.txt b/Tests/RunCMake/list/SORT-WrongOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-WrongOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/SORT-WrongOption-stderr.txt b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt
new file mode 100644
index 000000000..597cb298d
--- /dev/null
+++ b/Tests/RunCMake/list/SORT-WrongOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at SORT-WrongOption.cmake:1 \(list\):
+ list sub-command SORT option "one_too_many" is unknown.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/list/SORT-TooManyArguments.cmake b/Tests/RunCMake/list/SORT-WrongOption.cmake
index 81b195d67..81b195d67 100644
--- a/Tests/RunCMake/list/SORT-TooManyArguments.cmake
+++ b/Tests/RunCMake/list/SORT-WrongOption.cmake
diff --git a/Tests/RunCMake/list/SORT.cmake b/Tests/RunCMake/list/SORT.cmake
new file mode 100644
index 000000000..4a9e064dd
--- /dev/null
+++ b/Tests/RunCMake/list/SORT.cmake
@@ -0,0 +1,114 @@
+set(source_unsorted
+ c/B.h
+ a/c.h
+ B/a.h
+ )
+
+## Test with default options
+set(expected
+ B/a.h
+ a/c.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)")
+endif ()
+
+
+## Test CASE INSENSITIVE ORDER ASCENDING COMPARE STRING
+set(expected
+ a/c.h
+ B/a.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE INSENSITIVE ORDER DESCENDING COMPARE STRING
+set(expected
+ c/B.h
+ B/a.h
+ a/c.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE SENSITIVE ORDER ASCENDING COMPARE STRING
+set(expected
+ B/a.h
+ a/c.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE SENSITIVE ORDER DESCENDING COMPARE STRING
+set(expected
+ c/B.h
+ a/c.h
+ B/a.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)")
+endif ()
+
+## Test CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME
+set(expected
+ B/a.h
+ c/B.h
+ a/c.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)")
+endif ()
+
+## Test CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME
+set(expected
+ a/c.h
+ c/B.h
+ B/a.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)")
+endif ()
+
+## Test CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME
+set(expected
+ c/B.h
+ B/a.h
+ a/c.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)")
+endif ()
+
+## Test CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME
+set(expected
+ a/c.h
+ B/a.h
+ c/B.h
+ )
+set(list ${source_unsorted})
+list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)
+if (NOT expected STREQUAL list)
+ message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)")
+endif ()
diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt
new file mode 100644
index 000000000..12cd3c775
--- /dev/null
+++ b/Tests/RunCMake/math/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/math/MATH-DivideByZero-result.txt b/Tests/RunCMake/math/MATH-DivideByZero-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt
new file mode 100644
index 000000000..66ad6332f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-DivideByZero.cmake:1 \(math\):
+ math cannot evaluate the expression: "100/0": divide by zero.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-DivideByZero.cmake b/Tests/RunCMake/math/MATH-DivideByZero.cmake
new file mode 100644
index 000000000..3ac161e11
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero.cmake
@@ -0,0 +1 @@
+math(EXPR var "100/0")
diff --git a/Tests/RunCMake/math/MATH-DoubleOption-result.txt b/Tests/RunCMake/math/MATH-DoubleOption-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt
new file mode 100644
index 000000000..767a060fc
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-DoubleOption.cmake:1 \(math\):
+ math EXPR called with incorrect arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-DoubleOption.cmake b/Tests/RunCMake/math/MATH-DoubleOption.cmake
new file mode 100644
index 000000000..7bcb78ec2
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT HEXADECIMAL)
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-result.txt b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
new file mode 100644
index 000000000..9e73ed5b2
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at MATH-InvalidExpression.cmake:1 \(math\):
+ math cannot parse the expression: "INVALID": syntax error, unexpected \$end,
+ expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression.cmake b/Tests/RunCMake/math/MATH-InvalidExpression.cmake
new file mode 100644
index 000000000..6e37128d7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression.cmake
@@ -0,0 +1 @@
+math(EXPR var "INVALID")
diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt
new file mode 100644
index 000000000..732ce6f16
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\):
+ Unexpected character in expression at position 1: '
+
+ Unexpected character in expression at position 7: '
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake
new file mode 100644
index 000000000..d1be218c8
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake
@@ -0,0 +1,4 @@
+math(EXPR var "'2*1-1'")
+if(NOT var EQUAL 1)
+ message(FATAL_ERROR "Expression did not evaluate to 1")
+endif()
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-result.txt b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt
new file mode 100644
index 000000000..fdcfecf7f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-TooManyArguments.cmake:1 \(math\):
+ math EXPR called with incorrect arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments.cmake b/Tests/RunCMake/math/MATH-TooManyArguments.cmake
new file mode 100644
index 000000000..969dc80f0
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT )
diff --git a/Tests/RunCMake/math/MATH-WrongArgument-result.txt b/Tests/RunCMake/math/MATH-WrongArgument-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt
new file mode 100644
index 000000000..bbe54bf1f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-WrongArgument.cmake:1 \(math\):
+ math sub-command EXPR option "OUT" is unknown.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-WrongArgument.cmake b/Tests/RunCMake/math/MATH-WrongArgument.cmake
new file mode 100644
index 000000000..fb6d2e725
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUT HEX )
diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake
new file mode 100644
index 000000000..a5f50cd90
--- /dev/null
+++ b/Tests/RunCMake/math/MATH.cmake
@@ -0,0 +1,12 @@
+macro(math_test expression expected)
+ math(EXPR evaluated ${expression} ${ARGN})
+ if (NOT evaluated STREQUAL ${expected})
+ message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}")
+ endif ()
+endmacro()
+
+
+math_test("100 * 10" 1000)
+math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL)
+math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL)
+math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL)
diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake
new file mode 100644
index 000000000..a4d5c31df
--- /dev/null
+++ b/Tests/RunCMake/math/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+run_cmake(MATH)
+run_cmake(MATH-WrongArgument)
+run_cmake(MATH-DoubleOption)
+run_cmake(MATH-TooManyArguments)
+run_cmake(MATH-InvalidExpression)
+run_cmake(MATH-ToleratedExpression)
+run_cmake(MATH-DivideByZero)
diff --git a/Tests/RunCMake/option/CMP0077-NEW.cmake b/Tests/RunCMake/option/CMP0077-NEW.cmake
new file mode 100644
index 000000000..d4c518b1e
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-NEW.cmake
@@ -0,0 +1,14 @@
+
+#Verify that option DOESN'T overwrite existing normal variable when the policy
+#is set to NEW
+cmake_policy(SET CMP0077 NEW)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option failed to overwrite existing normal variable")
+endif()
+
+get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
+if(_exists_in_cache)
+ message(FATAL_ERROR "value should not exist in cache as it was already a local variable")
+endif()
diff --git a/Tests/RunCMake/option/CMP0077-OLD.cmake b/Tests/RunCMake/option/CMP0077-OLD.cmake
new file mode 100644
index 000000000..4c52d4b92
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-OLD.cmake
@@ -0,0 +1,9 @@
+
+#Verify that option overwrites existing normal variable when the policy
+#is set to OLD
+cmake_policy(SET CMP0077 OLD)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(NOT OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option failed to overwrite existing normal variable")
+endif()
diff --git a/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake
new file mode 100644
index 000000000..f62a85370
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-SECOND-PASS.cmake
@@ -0,0 +1,14 @@
+
+#Verify that when both a cache and local version of a value exist that CMake
+#doesn't produce a CMP0077 warning and that we get the expected values.
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
+if(OPT_LOCAL_VAR)
+ message(FATAL_ERROR "option improperly set a cache variable that already exists")
+endif()
+
+get_property(_exists_in_cache CACHE OPT_LOCAL_VAR PROPERTY VALUE SET)
+if(NOT _exists_in_cache)
+ message(FATAL_ERROR "value should exist in cache")
+endif()
diff --git a/Tests/RunCMake/option/CMP0077-WARN-stderr.txt b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt
new file mode 100644
index 000000000..0d02ffbf7
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-WARN-stderr.txt
@@ -0,0 +1,7 @@
+CMake Warning \(dev\) at CMP0077-WARN.cmake:5 \(option\):
+ Policy CMP0077 is not set: option\(\) honors normal variables. Run "cmake
+ --help-policy CMP0077" for policy details. Use the cmake_policy command to
+ set the policy and suppress this warning.
+
+ For compatibility with older versions of CMake, option is clearing the
+ normal variable 'OPT_LOCAL_VAR'.
diff --git a/Tests/RunCMake/option/CMP0077-WARN.cmake b/Tests/RunCMake/option/CMP0077-WARN.cmake
new file mode 100644
index 000000000..7f994569f
--- /dev/null
+++ b/Tests/RunCMake/option/CMP0077-WARN.cmake
@@ -0,0 +1,5 @@
+
+#Verify that option overwrites existing normal variable when the policy
+#is set to OLD
+set(OPT_LOCAL_VAR FALSE)
+option(OPT_LOCAL_VAR "TEST_VAR" ON)
diff --git a/Tests/RunCMake/option/CMakeLists.txt b/Tests/RunCMake/option/CMakeLists.txt
new file mode 100644
index 000000000..11dc49a05
--- /dev/null
+++ b/Tests/RunCMake/option/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.12)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/option/RunCMakeTest.cmake b/Tests/RunCMake/option/RunCMakeTest.cmake
new file mode 100644
index 000000000..979afa1ce
--- /dev/null
+++ b/Tests/RunCMake/option/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(CMP0077-OLD)
+run_cmake(CMP0077-NEW)
+run_cmake(CMP0077-WARN)
+run_cmake(CMP0077-SECOND-PASS)
diff --git a/Tests/RunCMake/print_stdin.c b/Tests/RunCMake/print_stdin.c
new file mode 100644
index 000000000..e083e6297
--- /dev/null
+++ b/Tests/RunCMake/print_stdin.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int main()
+{
+ char buf[1024];
+ size_t nIn = sizeof(buf);
+ while (nIn == sizeof(buf)) {
+ nIn = fread(buf, 1, sizeof(buf), stdin);
+ if (nIn > 0) {
+ size_t nOut;
+ nOut = fwrite(buf, 1, nIn, stdout);
+ if (nOut != nIn) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/Tests/RunCMake/project/ProjectTwice.cmake b/Tests/RunCMake/project/ProjectTwice.cmake
new file mode 100644
index 000000000..d053834dc
--- /dev/null
+++ b/Tests/RunCMake/project/ProjectTwice.cmake
@@ -0,0 +1,26 @@
+cmake_policy(SET CMP0048 NEW)
+project(ProjectTwiceTestFirst
+ VERSION 1.2.3.4
+ DESCRIPTION "Test Project"
+ HOMEPAGE_URL "http://example.com"
+ LANGUAGES NONE
+)
+
+project(ProjectTwiceTestSecond LANGUAGES NONE)
+
+foreach(var
+ PROJECT_VERSION
+ PROJECT_VERSION_MAJOR
+ PROJECT_VERSION_MINOR
+ PROJECT_VERSION_PATCH
+ PROJECT_VERSION_TWEAK
+ PROJECT_DESCRIPTION
+ PROJECT_HOMEPAGE_URL
+)
+ if(${var})
+ message(SEND_ERROR "${var} set but should be empty")
+ endif()
+ if(CMAKE_${var})
+ message(SEND_ERROR "CMAKE_${var} set but should be empty")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake
index e9fb929ff..3a8ad4bbf 100644
--- a/Tests/RunCMake/project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/project/RunCMakeTest.cmake
@@ -15,6 +15,7 @@ run_cmake(ProjectDescriptionNoArg2)
run_cmake(ProjectHomepage)
run_cmake(ProjectHomepage2)
run_cmake(ProjectHomepageNoArg)
+run_cmake(ProjectTwice)
run_cmake(VersionAndLanguagesEmpty)
run_cmake(VersionEmpty)
run_cmake(VersionInvalid)
diff --git a/Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt b/Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt
new file mode 100644
index 000000000..580c3734f
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_DIRECTORIES-stdout.txt
@@ -0,0 +1,2 @@
+-- Target LINK_DIRECTORIES is 'a;b;c;d;;e'
+-- Directory LINK_DIRECTORIES is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake b/Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake
new file mode 100644
index 000000000..8529ef5b2
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_DIRECTORIES.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(LINK_DIRECTORIES)
+test_directory_property(LINK_DIRECTORIES)
diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt
new file mode 100644
index 000000000..033792a47
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_OPTIONS-stdout.txt
@@ -0,0 +1,2 @@
+-- Target LINK_OPTIONS is 'a;b;c;d;;e'
+-- Directory LINK_OPTIONS is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/LINK_OPTIONS.cmake b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake
new file mode 100644
index 000000000..6daf41b49
--- /dev/null
+++ b/Tests/RunCMake/set_property/LINK_OPTIONS.cmake
@@ -0,0 +1,3 @@
+include(Common.cmake)
+test_target_property(LINK_OPTIONS)
+test_directory_property(LINK_OPTIONS)
diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake
index b966e899a..8d4614c5d 100644
--- a/Tests/RunCMake/set_property/RunCMakeTest.cmake
+++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake
@@ -5,6 +5,8 @@ run_cmake(COMPILE_FEATURES)
run_cmake(COMPILE_OPTIONS)
run_cmake(IMPORTED_GLOBAL)
run_cmake(INCLUDE_DIRECTORIES)
+run_cmake(LINK_OPTIONS)
+run_cmake(LINK_DIRECTORIES)
run_cmake(LINK_LIBRARIES)
run_cmake(SOURCES)
run_cmake(TYPE)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt
new file mode 100644
index 000000000..89cd80633
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt
@@ -0,0 +1 @@
+-- INTERFACE_LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>'
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake
new file mode 100644
index 000000000..82486c42c
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0079 NEW)
+include(CMP0079-iface-common.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt
new file mode 100644
index 000000000..e575e1675
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt
@@ -0,0 +1 @@
+-- INTERFACE_LINK_LIBRARIES='foo'
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake
new file mode 100644
index 000000000..e04a2bb53
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0079 OLD)
+include(CMP0079-iface-common.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt
new file mode 100644
index 000000000..6dd7d3069
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt
@@ -0,0 +1,17 @@
+^CMake Warning \(dev\) at CMP0079-iface/CMakeLists.txt:[0-9]+ \(target_link_libraries\):
+ Policy CMP0079 is not set: target_link_libraries allows use with targets in
+ other directories. Run "cmake --help-policy CMP0079" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ Target
+
+ top
+
+ is not created in this directory. For compatibility with older versions of
+ CMake, link library
+
+ foo
+
+ will be looked up in the directory in which the target was created rather
+ than in this calling directory.
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt
new file mode 100644
index 000000000..e575e1675
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt
@@ -0,0 +1 @@
+-- INTERFACE_LINK_LIBRARIES='foo'
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake
new file mode 100644
index 000000000..2041893c8
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake
@@ -0,0 +1 @@
+include(CMP0079-iface-common.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake
new file mode 100644
index 000000000..3982ff264
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+
+add_executable(top empty.c)
+add_subdirectory(CMP0079-iface)
+get_property(libs TARGET top PROPERTY INTERFACE_LINK_LIBRARIES)
+message(STATUS "INTERFACE_LINK_LIBRARIES='${libs}'")
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt
new file mode 100644
index 000000000..4b15b329b
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt
@@ -0,0 +1 @@
+target_link_libraries(top INTERFACE foo)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt
new file mode 100644
index 000000000..b9fe3f694
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at CMP0079-link-NEW-bogus.cmake:[0-9]+ \(add_executable\):
+ Target "top" links to target "foo::@<0xdeadbeef>" but the target was not
+ found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or
+ an ALIAS target is missing\?
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake
new file mode 100644
index 000000000..8622f14e7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0028 NEW)
+cmake_policy(SET CMP0079 NEW)
+enable_language(C)
+
+add_executable(top empty.c)
+set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "foo::@<0xdeadbeef>")
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt
new file mode 100644
index 000000000..84b30bd0a
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt
@@ -0,0 +1 @@
+-- LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>'
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake
new file mode 100644
index 000000000..72e457494
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0079 NEW)
+include(CMP0079-link-common.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt
new file mode 100644
index 000000000..0b4c4c683
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\):
+ Attempt to add link library "foo" to target "top" which is not built in
+ this directory.
+
+ This is allowed only when policy CMP0079 is set to NEW.$
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake
new file mode 100644
index 000000000..caa7231b7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0079 OLD)
+include(CMP0079-link-common.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt
new file mode 100644
index 000000000..0b4c4c683
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\):
+ Attempt to add link library "foo" to target "top" which is not built in
+ this directory.
+
+ This is allowed only when policy CMP0079 is set to NEW.$
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake
new file mode 100644
index 000000000..e83818a9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake
@@ -0,0 +1 @@
+include(CMP0079-link-common.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake
new file mode 100644
index 000000000..4f9454f0a
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+
+add_executable(top empty.c)
+add_subdirectory(CMP0079-link)
+get_property(libs TARGET top PROPERTY LINK_LIBRARIES)
+message(STATUS "LINK_LIBRARIES='${libs}'")
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt
new file mode 100644
index 000000000..8b2b3c94f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt
@@ -0,0 +1 @@
+target_link_libraries(top PUBLIC foo)
diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt
index 12cd3c775..8f85fbf54 100644
--- a/Tests/RunCMake/target_link_libraries/CMakeLists.txt
+++ b/Tests/RunCMake/target_link_libraries/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 2.8.4)
project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
index 97b0888a7..a041d6d4e 100644
--- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -4,11 +4,17 @@ run_cmake(CMP0023-WARN)
run_cmake(CMP0023-NEW)
run_cmake(CMP0023-WARN-2)
run_cmake(CMP0023-NEW-2)
+run_cmake(CMP0079-iface-WARN)
+run_cmake(CMP0079-iface-OLD)
+run_cmake(CMP0079-iface-NEW)
+run_cmake(CMP0079-link-WARN)
+run_cmake(CMP0079-link-OLD)
+run_cmake(CMP0079-link-NEW)
+run_cmake(CMP0079-link-NEW-bogus)
run_cmake(ImportedTarget)
run_cmake(ImportedTargetFailure)
run_cmake(MixedSignature)
run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses)
-run_cmake(SubDirTarget)
run_cmake(SharedDepNotTarget)
run_cmake(StaticPrivateDepNotExported)
run_cmake(StaticPrivateDepNotTarget)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
deleted file mode 100644
index 5cd1f23d7..000000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\):
- Attempt to add link library "m" to target "subexe" which is not built in
- this directory.
-Call Stack \(most recent call first\):
- CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
deleted file mode 100644
index 32431cecc..000000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-enable_language(C)
-add_subdirectory(SubDirTarget)
-target_link_libraries(subexe m)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
deleted file mode 100644
index b0b23809a..000000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_executable(subexe ../empty.c)
diff --git a/Tests/RunCMake/target_link_options/CMakeLists.txt b/Tests/RunCMake/target_link_options/CMakeLists.txt
new file mode 100644
index 000000000..14ef56e8e
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(${RunCMake_TEST} LANGUAGES NONE)
+
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake
new file mode 100644
index 000000000..d0ef8de85
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake
new file mode 100644
index 000000000..d0ef8de85
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion-LINKER_SHELL-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/LINKER_expansion-validation.cmake")
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake
new file mode 100644
index 000000000..1af8f13a3
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion-validation.cmake
@@ -0,0 +1,15 @@
+
+if (actual_stdout MATCHES "LINKER:")
+ set (RunCMake_TEST_FAILED "LINKER: prefix was not expanded.")
+ return()
+endif()
+
+if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/LINKER.txt")
+ set (RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/LINKER.txt: Reference file not found.")
+ return()
+endif()
+file(READ "${RunCMake_TEST_BINARY_DIR}/LINKER.txt" linker_flag)
+
+if (NOT actual_stdout MATCHES "${linker_flag}")
+ set (RunCMake_TEST_FAILED "LINKER: was not expanded correctly.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINKER_expansion.cmake b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake
new file mode 100644
index 000000000..b3448679d
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINKER_expansion.cmake
@@ -0,0 +1,49 @@
+
+enable_language(C)
+
+add_executable(dump dump.c)
+
+# ensure no temp file will be used
+string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
+
+
+# Use LINKER alone
+add_library(linker SHARED LinkOptionsLib.c)
+target_link_options(linker PRIVATE "LINKER:-foo,bar")
+
+# use LAUNCH facility to dump linker command
+set_property(TARGET linker PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+
+add_dependencies (linker dump)
+
+
+# Use LINKER with SHELL
+add_library(linker_shell SHARED LinkOptionsLib.c)
+target_link_options(linker_shell PRIVATE "LINKER:SHELL:-foo bar")
+
+# use LAUNCH facility to dump linker command
+set_property(TARGET linker_shell PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
+
+add_dependencies (linker_shell dump)
+
+
+# generate reference for LINKER flag
+if (CMAKE_C_LINKER_WRAPPER_FLAG)
+ set(linker_flag ${CMAKE_C_LINKER_WRAPPER_FLAG})
+ list(GET linker_flag -1 linker_space)
+ if (linker_space STREQUAL " ")
+ list(REMOVE_AT linker_flag -1)
+ else()
+ set(linker_space)
+ endif()
+ list (JOIN linker_flag " " linker_flag)
+ if (CMAKE_C_LINKER_WRAPPER_FLAG_SEP)
+ string (APPEND linker_flag "${linker_space}" "-foo${CMAKE_C_LINKER_WRAPPER_FLAG_SEP}bar")
+ else()
+ set (linker_flag "${linker_flag}${linker_space}-foo ${linker_flag}${linker_space}bar")
+ endif()
+else()
+ set(linker_flag "-foo bar")
+endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LINKER.txt" "${linker_flag}")
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake
new file mode 100644
index 000000000..779950610
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_PRIVATE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_PRIVATE'.")
+endif()
+if (actual_stdout MATCHES "BADFLAG_INTERFACE")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected 'BADFLAG_INTERFACE'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake
new file mode 100644
index 000000000..a686de945
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-exe-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake
new file mode 100644
index 000000000..6c5ffdb36
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake
new file mode 100644
index 000000000..6c5ffdb36
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-check.cmake
@@ -0,0 +1,4 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_INTERFACE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_INTERFACE'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-interface-static-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake
new file mode 100644
index 000000000..a686de945
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-mod-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake
new file mode 100644
index 000000000..a686de945
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-check.cmake
@@ -0,0 +1,7 @@
+
+if (NOT actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_RELEASE'.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt
new file mode 100644
index 000000000..8d98f9deb
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-shared-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake
new file mode 100644
index 000000000..b68e45175
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-check.cmake
@@ -0,0 +1,7 @@
+
+if (actual_stdout MATCHES "BADFLAG_RELEASE")
+ set (RunCMake_TEST_FAILED "Found 'BADFLAG_RELEASE' which was not expected.")
+endif()
+if (actual_stdout MATCHES "SHELL:")
+ string (APPEND RunCMake_TEST_FAILED "\nFound unexpected prefix 'SHELL:'.")
+endif()
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS-static-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
new file mode 100644
index 000000000..bb048412e
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LINK_OPTIONS.cmake
@@ -0,0 +1,55 @@
+
+enable_language(C)
+
+set(obj "${CMAKE_C_OUTPUT_EXTENSION}")
+if(BORLAND)
+ set(pre -)
+endif()
+
+# basic configuration
+add_library(LinkOptions SHARED LinkOptionsLib.c)
+target_link_options(LinkOptions
+ PRIVATE ${pre}BADFLAG_PRIVATE${obj}
+ INTERFACE ${pre}BADFLAG_INTERFACE${obj})
+
+
+# INTERFACE_LINK_OPTIONS
+add_library(LinkOptions_producer SHARED LinkOptionsLib.c)
+target_link_options(LinkOptions_producer
+ INTERFACE ${pre}BADFLAG_INTERFACE${obj})
+
+add_executable(LinkOptions_consumer LinkOptionsExe.c)
+target_link_libraries(LinkOptions_consumer PRIVATE LinkOptions_producer)
+
+
+# static library with INTERFACE_LINK_OPTIONS
+add_library(LinkOptions_producer_static STATIC LinkOptionsLib.c)
+target_link_options(LinkOptions_producer_static
+ INTERFACE ${pre}BADFLAG_INTERFACE${obj})
+
+add_executable(LinkOptions_consumer_static LinkOptionsExe.c)
+target_link_libraries(LinkOptions_consumer_static PRIVATE LinkOptions_producer_static)
+
+
+# static library with generator expression
+add_library(LinkOptions_static STATIC LinkOptionsLib.c)
+target_link_options(LinkOptions_static PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+
+# shared library with generator expression
+add_library(LinkOptions_shared SHARED LinkOptionsLib.c)
+target_link_options(LinkOptions_shared PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>
+ "SHELL:" # produces no options
+ )
+
+
+# module library with generator expression
+add_library(LinkOptions_mod MODULE LinkOptionsLib.c)
+target_link_options(LinkOptions_mod PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>)
+
+
+# executable with generator expression
+add_executable(LinkOptions_exe LinkOptionsExe.c)
+target_link_options(LinkOptions_exe PRIVATE $<$<CONFIG:Release>:${pre}BADFLAG_RELEASE${obj}>)
diff --git a/Tests/RunCMake/target_link_options/LinkOptionsExe.c b/Tests/RunCMake/target_link_options/LinkOptionsExe.c
new file mode 100644
index 000000000..8488f4e58
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LinkOptionsExe.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/target_link_options/LinkOptionsLib.c b/Tests/RunCMake/target_link_options/LinkOptionsLib.c
new file mode 100644
index 000000000..9bbd24cd8
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/LinkOptionsLib.c
@@ -0,0 +1,7 @@
+#if defined(_WIN32)
+__declspec(dllexport)
+#endif
+ int flags_lib(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
new file mode 100644
index 000000000..1eaa5d2ff
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake
@@ -0,0 +1,41 @@
+
+include(RunCMake)
+
+macro(run_cmake_target test subtest target)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN})
+
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endmacro()
+
+if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
+ # Intel compiler does not reject bad flags or objects!
+ set(RunCMake_TEST_OUTPUT_MERGE TRUE)
+ if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+
+ run_cmake(LINK_OPTIONS)
+
+ run_cmake_target(LINK_OPTIONS basic LinkOptions)
+ run_cmake_target(LINK_OPTIONS interface LinkOptions_consumer)
+ run_cmake_target(LINK_OPTIONS interface-static LinkOptions_consumer_static)
+ run_cmake_target(LINK_OPTIONS static LinkOptions_static --config Release)
+ run_cmake_target(LINK_OPTIONS shared LinkOptions_shared --config Release)
+ run_cmake_target(LINK_OPTIONS mod LinkOptions_mod --config Release)
+ run_cmake_target(LINK_OPTIONS exe LinkOptions_exe --config Release)
+
+ unset(RunCMake_TEST_OPTIONS)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+endif()
+
+run_cmake(bad_SHELL_usage)
+
+if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)")
+ run_cmake(LINKER_expansion)
+
+ run_cmake_target(LINKER_expansion LINKER linker)
+ run_cmake_target(LINKER_expansion LINKER_SHELL linker_shell)
+endif()
diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt
new file mode 100644
index 000000000..bffd80a00
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at bad_SHELL_usage.cmake:4 \(add_library\):
+ 'SHELL:' prefix is not supported as part of 'LINKER:' arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:5 \(include\)
diff --git a/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake
new file mode 100644
index 000000000..b0adf1936
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/bad_SHELL_usage.cmake
@@ -0,0 +1,5 @@
+
+enable_language(C)
+
+add_library(example SHARED LinkOptionsLib.c)
+target_link_options(example PRIVATE "LINKER:-foo,SHELL:-bar")
diff --git a/Tests/RunCMake/target_link_options/dump.c b/Tests/RunCMake/target_link_options/dump.c
new file mode 100644
index 000000000..8baa313fd
--- /dev/null
+++ b/Tests/RunCMake/target_link_options/dump.c
@@ -0,0 +1,13 @@
+
+#include "stdio.h"
+
+int main(int argc, char* argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++)
+ printf("%s ", argv[i]);
+ printf("\n");
+
+ return 0;
+}
diff --git a/Tests/RunCMake/try_compile/CMP0056-stderr.txt b/Tests/RunCMake/try_compile/CMP0056-stderr.txt
index 5c1f0e4cf..de442059d 100644
--- a/Tests/RunCMake/try_compile/CMP0056-stderr.txt
+++ b/Tests/RunCMake/try_compile/CMP0056-stderr.txt
@@ -10,4 +10,15 @@ CMake Warning \(dev\) at CMP0056.cmake:[0-9]+ \(try_compile\):
caller link flags \(e.g. CMAKE_EXE_LINKER_FLAGS\) in the test project.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
-This warning is for project developers. Use -Wno-dev to suppress it.$
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Deprecation Warning at CMP0056.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0056 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
deleted file mode 100644
index a07f687d0..000000000
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ /dev/null
@@ -1,398 +0,0 @@
-cmake_minimum_required (VERSION 3.9)
-project (TestSimpleInstall)
-set(CMAKE_VERBOSE_MAKEFILE 1)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/bin")
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib/static")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib")
-
-# Skip generating the rpath pointing at the build tree to make sure
-# the executable is installed with the proper rpath in the install
-# tree.
-set(CMAKE_SKIP_BUILD_RPATH 1)
-
-# Make sure the executable can run from the install tree.
-set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
-# Skip the dependency that causes a build when installing. This
-# avoids infinite loops when the post-build rule below installs.
-set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
-set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
-
-set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
-
-set(EXTRA_INSTALL_FLAGS)
-message("Extra install: ${EXTRA_INSTALL_FLAGS}")
-
-if(STAGE2)
- set(LIBPATHS
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib
- )
- set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel)
- set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
- set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX})
-
- # Make sure the install script ran.
- set(CMAKE_INSTALL_SCRIPT_DID_RUN 0)
- include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL)
- if(CMAKE_INSTALL_SCRIPT_DID_RUN)
- message(STATUS "Stage 1 did run install script 2.")
- else()
- message(SEND_ERROR "Stage 1 did not run install script 2.")
- endif()
-
- if(CYGWIN OR MINGW)
- set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin")
- endif()
- message("Search for library in: ${LIBPATHS}")
-
- set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
-
- find_library(TEST1_LIBRARY
- NAMES ${t1NAMES}
- PATHS ${LIBPATHS}
- DOC "First library")
- find_library(TEST2_LIBRARY
- NAMES ${t2NAMES}
- PATHS ${LIBPATHS}
- DOC "Second library")
- find_library(TEST4_LIBRARY
- NAMES ${t4NAMES}
- PATHS ${LIBPATHS}
- DOC "Fourth library")
-
- # Test importing a library found on disk.
- add_library(lib_test4 UNKNOWN IMPORTED)
- set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY})
-
- include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include)
- add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h)
- target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4)
- set(install_target SimpleInstExeS2)
-
- if("${TEST1_LIBRARY}" MATCHES "static")
- message(STATUS "test1 correctly found in lib/static")
- else()
- message(SEND_ERROR "test1 not found in lib/static!")
- endif()
-
- # Check for failure of configuration-specific installation.
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
- message(FATAL_ERROR "Debug-configuration file installed for Release!")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
- message(FATAL_ERROR "Release-configuration file installed for Debug!")
- endif()
-
- # Check for failure of directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt")
- message(FATAL_ERROR "Directory installation installed CMakeLists.txt.")
- endif()
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install alternate TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx")
- message(FATAL_ERROR "Directory installation installed alternate TSD.cxx")
- endif()
-
- # Check that scripts properly installed.
- if(WIN32 AND NOT CYGWIN)
- set(BAT .bat)
- else()
- set(BAT)
- endif()
- foreach(loc share share/old1 share/old2 share/old3 share/alt)
- set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}")
- execute_process(
- COMMAND ${CUR_SCRIPT}
- RESULT_VARIABLE SAMPLE_SCRIPT_RESULT
- OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT
- )
- if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0")
- message(FATAL_ERROR
- "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]")
- endif()
- if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
- message(FATAL_ERROR
- "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]")
- endif()
- endforeach()
-
- # Check for failure of empty directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
- message(FATAL_ERROR "Empty directory installation did not install.")
- endif()
- file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*")
- if(EMPTY_FILES)
- message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].")
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstExeS2 PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- install_targets(/MyTest/bin SimpleInstExeS2)
-
-# try to import the exported targets again
- set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
- find_package(SimpleInstallS1 REQUIRED)
- get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED)
- if(NOT simpleInstallImported)
- message(FATAL_ERROR "Target S1_SimpleInstall could not be imported")
- endif()
-
-else()
- # Wipe out the install directory to do a fresh test.
- file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest)
-
- # this is stage 1, so create libraries and modules and install everything
- add_library(test1 STATIC lib1.cxx)
- add_library(test2 SHARED lib2.cxx)
- add_library(test3 MODULE lib3.cxx)
- add_library(test4 SHARED lib4.cxx)
-
- # Test <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME properties.
- set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out)
- set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out)
-
- add_executable (SimpleInstall inst.cxx foo.c foo.h)
- target_link_libraries(SimpleInstall test1 test2 test4)
- set(install_target SimpleInstall)
-
- set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
- # Disable VERSION test until it is implemented in the Xcode generator.
- if(NOT XCODE)
- set_target_properties(SimpleInstall PROPERTIES VERSION 1.2)
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstall PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- # Test per-configuration output name.
- set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel)
- set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h)
-
- if(CMAKE_GENERATOR MATCHES "Makefiles")
- add_subdirectory(TestSubDir)
- add_dependencies(SimpleInstall TSD)
- endif()
-
- add_dependencies(SimpleInstall test3)
- add_dependencies(test2 test3)
- add_dependencies(test4 test2)
-
- install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1
- RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll
- LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll
- ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib
- PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development
- )
-
- install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- RUNTIME DESTINATION MyTest/bin
- LIBRARY DESTINATION MyTest/lib
- ARCHIVE DESTINATION MyTest/lib/static
- OPTIONAL # for coverage...target should always exist
- )
- install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
- install(FILES lib2.h
- DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
- COMPONENT Development
- PERMISSIONS OWNER_READ OWNER_WRITE
- RENAME lib2renamed.h
- )
-
- # Test old-style install commands.
- install_files(/MyTest/include FILES lib3.h)
- install_files(/MyTest/include/old .h lib3)
- install_files(/MyTest/include/old "^lib2.h$")
- install_programs(/MyTest/share/old1 FILES
- scripts/sample_script scripts/sample_script.bat)
- install_programs(/MyTest/share/old2
- scripts/sample_script scripts/sample_script.bat)
-
-# "export" the targets collected in "SimpleInstallS1"
- install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake
- DESTINATION MyTest/lib
- NAMESPACE S1_ )
-
- export(TARGETS SimpleInstall test1 test2 test3
- FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake"
- NAMESPACE S2_ )
-
- add_subdirectory(scripts)
-
- # Test optional installation.
- install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL)
-
- # Test configuration-specific installation.
- install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
- DESTINATION MyTest/include/Release
- )
- install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug
- DESTINATION MyTest/include/Debug
- )
-
- # Test directory installation.
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- install(
- DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
- )
-
- # Alternate directory installation for coverage.
- install(
- DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- COMPONENT Development
- USE_SOURCE_PERMISSIONS
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- )
- install(
- DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- FILES_MATCHING PATTERN "*.h"
- )
-
- # Test empty directory installation.
- install(DIRECTORY DESTINATION MyTest/share/empty)
-
- # Test optional directory installation.
- install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL)
-
- # Test user-specified install scripts, with and without COMPONENT.
- install(
- SCRIPT InstallScript1.cmake
- CODE "set(INSTALL_CODE_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake
- )
- install(
- SCRIPT InstallScript3.cmake
- CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake
- COMPONENT Development
- )
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES
- "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
-
- set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
- set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake)
- set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3
- INSTALL_NAME_DIR @executable_path/../lib)
-endif()
-
-get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
-if(_isMultiConfig)
- set(SI_CONFIG --config $<CONFIGURATION>)
-else()
- set(SI_CONFIG)
-endif()
-
-# Dummy test of CPack
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack")
-set(CPACK_PACKAGE_VENDOR "Kitware")
-set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake")
-
-if(WIN32 AND NOT UNIX)
- find_program(NSIS_MAKENSIS NAMES makensis
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
- DOC "Where is makensis.exe located"
- )
- if(NOT NSIS_MAKENSIS)
- set(CPACK_GENERATOR TGZ)
- endif()
-endif()
-if(UNIX AND NOT APPLE)
- set(CPACK_GENERATOR "TGZ;STGZ;TZ")
- # find_program(found_compress
- # NAMES compress)
- # if(found_compress)
- # find_program(file_command NAMES file)
- # if(NOT file_command)
- # set(file_command file)
- # endif()
- # execute_process(COMMAND ${file_command} ${found_compress}
- # OUTPUT_VARIABLE output)
- # set(SKIP_TZ FALSE)
- # if("${output}" MATCHES "script")
- # set(SKIP_TZ TRUE)
- # endif()
- # if("${output}" MATCHES "dummy.sh")
- # set(SKIP_TZ TRUE)
- # endif()
- # if(NOT SKIP_TZ)
- # message("compress found and it was not a script")
- # message("output from file command: [${output}]")
- # list(APPEND CPACK_GENERATOR "TZ")
- # else()
- # message("compress found, but it was a script so don't use it")
- # message("output from file command: [${output}]")
- # endif()
- # endif()
- find_program(found_bz2
- NAMES bzip2)
- if(found_bz2)
- list(APPEND CPACK_GENERATOR "TBZ2")
- endif()
-endif()
-
-set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
-set(CMAKE_INSTALL_MFC_LIBRARIES 1)
-set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
-set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
-set(CMAKE_INSTALL_OPENMP_LIBRARIES 1)
-include(InstallRequiredSystemLibraries)
-
-if(CTEST_TEST_CPACK)
- set(package_command COMMAND
- ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG}
- )
-
- # Avoid settings that require the .zip file command line tools...
- # (just build an NSIS installer without component support)
- #
- set(CPACK_BINARY_ZIP OFF)
- set(CPACK_MONOLITHIC_INSTALL ON)
-else()
- set(package_command)
-endif()
-
-include(CPack)
-
-set(install_command COMMAND
- ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG}
- )
-
-add_custom_command(
- TARGET ${install_target}
- POST_BUILD
- ${install_command}
- ${package_command}
- COMMENT "Install Project"
- )
diff --git a/Tests/SimpleInstall/InstallScript1.cmake b/Tests/SimpleInstall/InstallScript1.cmake
deleted file mode 100644
index ef9da5761..000000000
--- a/Tests/SimpleInstall/InstallScript1.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-message("This is install script 1.")
-set(INSTALL_SCRIPT_1_DID_RUN 1)
-if(INSTALL_CODE_DID_RUN)
- message(FATAL_ERROR "Install script 1 did not run before install code.")
-endif()
diff --git a/Tests/SimpleInstall/InstallScript2.cmake b/Tests/SimpleInstall/InstallScript2.cmake
deleted file mode 100644
index c1d20a3a6..000000000
--- a/Tests/SimpleInstall/InstallScript2.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-message("This is install script 2.")
-if(INSTALL_SCRIPT_1_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 1 did not run before install script 2.")
-endif()
-if(INSTALL_CODE_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 2 did not run after install code.")
-endif()
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake"
- "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstall/InstallScript3.cmake b/Tests/SimpleInstall/InstallScript3.cmake
deleted file mode 100644
index 64851564d..000000000
--- a/Tests/SimpleInstall/InstallScript3.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-message("This is install script 3.")
-set(INSTALL_SCRIPT_3_DID_RUN 1)
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message(FATAL_ERROR "Install script 3 did not run before install code with component.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
diff --git a/Tests/SimpleInstall/InstallScript4.cmake b/Tests/SimpleInstall/InstallScript4.cmake
deleted file mode 100644
index 34d0a73bb..000000000
--- a/Tests/SimpleInstall/InstallScript4.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-message("This is install script 4.")
-if(INSTALL_SCRIPT_3_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 3 did not run before install script 4.")
-endif()
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 4 did not run after install with component code.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
-
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake"
- "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstall/PackageScript.cmake b/Tests/SimpleInstall/PackageScript.cmake
deleted file mode 100644
index 53b790932..000000000
--- a/Tests/SimpleInstall/PackageScript.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-message("This is packaging script")
-message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt")
-
-file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "")
-get_cmake_property(res VARIABLES)
-foreach(var ${res})
- file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt
- "${var} \"${${var}}\"\n")
-endforeach()
-
diff --git a/Tests/SimpleInstall/PostInstall.cmake b/Tests/SimpleInstall/PostInstall.cmake
deleted file mode 100644
index d616221ef..000000000
--- a/Tests/SimpleInstall/PostInstall.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-message("In post install")
-if(PRE_INSTALL_DID_RUN)
- message("Pre and post install work fine")
-else()
- message(FATAL_ERROR "Pre install did not run before post install")
-endif()
diff --git a/Tests/SimpleInstall/PreInstall.cmake b/Tests/SimpleInstall/PreInstall.cmake
deleted file mode 100644
index 7a9851e1d..000000000
--- a/Tests/SimpleInstall/PreInstall.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-message("This is in pre install")
-set(PRE_INSTALL_DID_RUN 1)
diff --git a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt b/Tests/SimpleInstall/TestSubDir/CMakeLists.txt
deleted file mode 100644
index 860e10425..000000000
--- a/Tests/SimpleInstall/TestSubDir/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-add_executable(TSD TSD.cxx TSD_utils.cxx)
-install_files(/MyTest/include FILES TSD.h)
-install_targets(/MyTest/bin TSD)
diff --git a/Tests/SimpleInstall/TestSubDir/TSD.cxx b/Tests/SimpleInstall/TestSubDir/TSD.cxx
deleted file mode 100644
index 8fc38787a..000000000
--- a/Tests/SimpleInstall/TestSubDir/TSD.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-
-#include "TSD.h"
-
-int main()
-{
- int res = TSD("TEST");
- printf("Hello from TSD\n");
- return res;
-}
diff --git a/Tests/SimpleInstall/TestSubDir/TSD.h b/Tests/SimpleInstall/TestSubDir/TSD.h
deleted file mode 100644
index 6a3c1affa..000000000
--- a/Tests/SimpleInstall/TestSubDir/TSD.h
+++ /dev/null
@@ -1 +0,0 @@
-int TSD(const char*);
diff --git a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx
deleted file mode 100644
index 0f32894fe..000000000
--- a/Tests/SimpleInstall/TestSubDir/TSD_utils.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <string.h>
-
-int TSD(const char* foo)
-{
- if (strcmp(foo, "TEST") == 0) {
- return 0;
- }
- return 1;
-}
diff --git a/Tests/SimpleInstall/foo.c b/Tests/SimpleInstall/foo.c
deleted file mode 100644
index 45d5b2bf2..000000000
--- a/Tests/SimpleInstall/foo.c
+++ /dev/null
@@ -1,6 +0,0 @@
-char* foo = "Foo";
-
-int SomeFunctionInFoo()
-{
- return 5;
-}
diff --git a/Tests/SimpleInstall/foo.h b/Tests/SimpleInstall/foo.h
deleted file mode 100644
index 216cdf67b..000000000
--- a/Tests/SimpleInstall/foo.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char* foo;
-extern int SomeFunctionInFoo();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Tests/SimpleInstall/inst.cxx b/Tests/SimpleInstall/inst.cxx
deleted file mode 100644
index 7815f86ce..000000000
--- a/Tests/SimpleInstall/inst.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "foo.h"
-
-#ifdef STAGE_2
-# include <foo/lib1.h>
-# include <foo/lib2renamed.h>
-# include <lib3.h>
-# include <old/lib2.h>
-# include <old/lib3.h>
-#else
-# include "lib1.h"
-# include "lib2.h"
-#endif
-
-#include "lib4.h"
-
-#include <stdio.h>
-
-int main()
-{
- if (Lib1Func() != 2.0) {
- printf("Problem with lib1\n");
- return 1;
- }
- if (Lib2Func() != 1.0) {
- printf("Problem with lib2\n");
- return 1;
- }
- if (Lib4Func() != 4.0) {
- printf("Problem with lib4\n");
- return 1;
- }
- printf("The value of Foo: %s\n", foo);
- return SomeFunctionInFoo() - 5;
-}
diff --git a/Tests/SimpleInstall/inst2.cxx b/Tests/SimpleInstall/inst2.cxx
deleted file mode 100644
index c70b93af1..000000000
--- a/Tests/SimpleInstall/inst2.cxx
+++ /dev/null
@@ -1,2 +0,0 @@
-#define STAGE_2
-#include "inst.cxx"
diff --git a/Tests/SimpleInstall/lib1.cxx b/Tests/SimpleInstall/lib1.cxx
deleted file mode 100644
index 7aa905205..000000000
--- a/Tests/SimpleInstall/lib1.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib1.h"
-
-float Lib1Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstall/lib1.h b/Tests/SimpleInstall/lib1.h
deleted file mode 100644
index 0d64e76bc..000000000
--- a/Tests/SimpleInstall/lib1.h
+++ /dev/null
@@ -1 +0,0 @@
-extern float Lib1Func();
diff --git a/Tests/SimpleInstall/lib2.cxx b/Tests/SimpleInstall/lib2.cxx
deleted file mode 100644
index dccc48b78..000000000
--- a/Tests/SimpleInstall/lib2.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib2.h"
-
-float Lib2Func()
-{
- return 1.0;
-}
diff --git a/Tests/SimpleInstall/lib2.h b/Tests/SimpleInstall/lib2.h
deleted file mode 100644
index 044e7750d..000000000
--- a/Tests/SimpleInstall/lib2.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test2_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib2Func();
diff --git a/Tests/SimpleInstall/lib3.cxx b/Tests/SimpleInstall/lib3.cxx
deleted file mode 100644
index da8dbf942..000000000
--- a/Tests/SimpleInstall/lib3.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib3.h"
-
-float Lib3Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstall/lib3.h b/Tests/SimpleInstall/lib3.h
deleted file mode 100644
index e02bbc4c0..000000000
--- a/Tests/SimpleInstall/lib3.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test3_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib3Func();
diff --git a/Tests/SimpleInstall/lib4.cxx b/Tests/SimpleInstall/lib4.cxx
deleted file mode 100644
index fbede5ce5..000000000
--- a/Tests/SimpleInstall/lib4.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib4.h"
-
-float Lib4Func()
-{
- return 4.0;
-}
diff --git a/Tests/SimpleInstall/lib4.h b/Tests/SimpleInstall/lib4.h
deleted file mode 100644
index e1a221e28..000000000
--- a/Tests/SimpleInstall/lib4.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test4_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib4Func();
diff --git a/Tests/SimpleInstall/scripts/CMakeLists.txt b/Tests/SimpleInstall/scripts/CMakeLists.txt
deleted file mode 100644
index ec34e8c50..000000000
--- a/Tests/SimpleInstall/scripts/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$")
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
deleted file mode 100644
index 22150ca1c..000000000
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ /dev/null
@@ -1,397 +0,0 @@
-cmake_minimum_required (VERSION 3.9)
-project (TestSimpleInstall)
-set(CMAKE_VERBOSE_MAKEFILE 1)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/bin")
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib/static")
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
- "${TestSimpleInstall_BINARY_DIR}/lib")
-
-# Skip generating the rpath pointing at the build tree to make sure
-# the executable is installed with the proper rpath in the install
-# tree.
-set(CMAKE_SKIP_BUILD_RPATH 1)
-
-# Make sure the executable can run from the install tree.
-set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
-# Skip the dependency that causes a build when installing. This
-# avoids infinite loops when the post-build rule below installs.
-set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)
-set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY 1)
-
-set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
-
-set(EXTRA_INSTALL_FLAGS)
-message("Extra install: ${EXTRA_INSTALL_FLAGS}")
-
-if(STAGE2)
- set(LIBPATHS
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib/static
- ${CMAKE_INSTALL_PREFIX}/MyTest/lib
- )
- set(t1NAMES test1 test1${CMAKE_DEBUG_POSTFIX} test1rel)
- set(t2NAMES test2 test2${CMAKE_DEBUG_POSTFIX})
- set(t4NAMES test4out test4out${CMAKE_DEBUG_POSTFIX})
-
- # Make sure the install script ran.
- set(CMAKE_INSTALL_SCRIPT_DID_RUN 0)
- include(${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake OPTIONAL)
- if(CMAKE_INSTALL_SCRIPT_DID_RUN)
- message(STATUS "Stage 1 did run install script 2.")
- else()
- message(SEND_ERROR "Stage 1 did not run install script 2.")
- endif()
-
- if(CYGWIN OR MINGW)
- set(LIBPATHS ${LIBPATHS} "${CMAKE_INSTALL_PREFIX}/MyTest/bin")
- endif()
- message("Search for library in: ${LIBPATHS}")
-
- set(TEST1_LIBRARY "TEST1_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST2_LIBRARY "TEST2_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
- set(TEST4_LIBRARY "TEST4_LIBRARY-NOTFOUND" CACHE FILEPATH "Force find." FORCE)
-
- find_library(TEST1_LIBRARY
- NAMES ${t1NAMES}
- PATHS ${LIBPATHS}
- DOC "First library")
- find_library(TEST2_LIBRARY
- NAMES ${t2NAMES}
- PATHS ${LIBPATHS}
- DOC "Second library")
- find_library(TEST4_LIBRARY
- NAMES ${t4NAMES}
- PATHS ${LIBPATHS}
- DOC "Fourth library")
-
- # Test importing a library found on disk.
- add_library(lib_test4 UNKNOWN IMPORTED)
- set_property(TARGET lib_test4 PROPERTY IMPORTED_LOCATION ${TEST4_LIBRARY})
-
- include_directories(${CMAKE_INSTALL_PREFIX}/MyTest/include)
- add_executable (SimpleInstExeS2 inst2.cxx foo.c foo.h)
- target_link_libraries(SimpleInstExeS2 ${TEST1_LIBRARY} ${TEST2_LIBRARY} lib_test4)
- set(install_target SimpleInstExeS2)
-
- if("${TEST1_LIBRARY}" MATCHES "static")
- message(STATUS "test1 correctly found in lib/static")
- else()
- message(SEND_ERROR "test1 not found in lib/static!")
- endif()
-
- # Check for failure of configuration-specific installation.
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Release/lib1debug.h")
- message(FATAL_ERROR "Debug-configuration file installed for Release!")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/include/Debug/lib1release.h")
- message(FATAL_ERROR "Release-configuration file installed for Debug!")
- endif()
-
- # Check for failure of directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- message(FATAL_ERROR "Directory installation installed CVS directory.")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/CMakeLists.txt")
- message(FATAL_ERROR "Directory installation installed CMakeLists.txt.")
- endif()
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.h")
- message(FATAL_ERROR "Directory installation did not install alternate TSD.h")
- endif()
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/alt/TestSubDir/TSD.cxx")
- message(FATAL_ERROR "Directory installation installed alternate TSD.cxx")
- endif()
-
- # Check that scripts properly installed.
- if(WIN32 AND NOT CYGWIN)
- set(BAT .bat)
- else()
- set(BAT)
- endif()
- foreach(loc share share/old1 share/old2 share/old3 share/alt)
- set(CUR_SCRIPT "${CMAKE_INSTALL_PREFIX}/MyTest/${loc}/sample_script${BAT}")
- execute_process(
- COMMAND ${CUR_SCRIPT}
- RESULT_VARIABLE SAMPLE_SCRIPT_RESULT
- OUTPUT_VARIABLE SAMPLE_SCRIPT_OUTPUT
- )
- if(NOT "${SAMPLE_SCRIPT_RESULT}" STREQUAL "0")
- message(FATAL_ERROR
- "Sample script [${CUR_SCRIPT}] failed: [${SAMPLE_SCRIPT_RESULT}]")
- endif()
- if(NOT "${SAMPLE_SCRIPT_OUTPUT}" MATCHES "Sample Script Output")
- message(FATAL_ERROR
- "Bad sample script [${CUR_SCRIPT}] output: [${SAMPLE_SCRIPT_OUTPUT}]")
- endif()
- endforeach()
-
- # Check for failure of empty directory installation.
- if(NOT EXISTS "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty")
- message(FATAL_ERROR "Empty directory installation did not install.")
- endif()
- file(GLOB EMPTY_FILES "${CMAKE_INSTALL_PREFIX}/MyTest/share/empty/*")
- if(EMPTY_FILES)
- message(FATAL_ERROR "Empty directory installed [${EMPTY_FILES}].")
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstExeS2 PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- install_targets(/MyTest/bin SimpleInstExeS2)
-
-# try to import the exported targets again
- set(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
- find_package(SimpleInstallS1 REQUIRED)
- get_target_property(simpleInstallImported S1_SimpleInstall IMPORTED)
- if(NOT simpleInstallImported)
- message(FATAL_ERROR "Target S1_SimpleInstall could not be imported")
- endif()
-
-else()
- # Wipe out the install directory to do a fresh test.
- file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest)
-
- # this is stage 1, so create libraries and modules and install everything
- add_library(test1 STATIC lib1.cxx)
- add_library(test2 SHARED lib2.cxx)
- add_library(test3 MODULE lib3.cxx)
- add_library(test4 SHARED lib4.cxx)
-
- # Test <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME properties.
- set_property(TARGET test4 PROPERTY ARCHIVE_OUTPUT_NAME test4out)
- set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4out)
-
- add_executable (SimpleInstall inst.cxx foo.c foo.h)
- target_link_libraries(SimpleInstall test1 test2 test4)
- set(install_target SimpleInstall)
-
- set_target_properties(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
- # Disable VERSION test until it is implemented in the Xcode generator.
- if(NOT XCODE)
- set_target_properties(SimpleInstall PROPERTIES VERSION 1.2)
- endif()
-
- # Make sure the test executable can run from the install tree.
- set_target_properties(SimpleInstall PROPERTIES
- INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
-
- # Test per-configuration output name.
- set_target_properties(test1 PROPERTIES RELEASE_OUTPUT_NAME test1rel)
- set_target_properties(test2 PROPERTIES PUBLIC_HEADER foo.h)
-
- if(CMAKE_GENERATOR MATCHES "Makefiles")
- add_subdirectory(TestSubDir)
- add_dependencies(SimpleInstall TSD)
- endif()
-
- add_dependencies(SimpleInstall test3)
- add_dependencies(test2 test3)
- add_dependencies(test4 test2)
-
- install(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1
- RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll
- LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll
- ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib
- PUBLIC_HEADER DESTINATION MyTest/include COMPONENT Development
- )
-
- install(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- RUNTIME DESTINATION MyTest/bin
- LIBRARY DESTINATION MyTest/lib
- ARCHIVE DESTINATION MyTest/lib/static
- OPTIONAL # for coverage...target should always exist
- )
- install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
- install(FILES lib2.h
- DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
- COMPONENT Development
- PERMISSIONS OWNER_READ OWNER_WRITE
- RENAME lib2renamed.h
- )
-
- # Test old-style install commands.
- install_files(/MyTest/include FILES lib3.h)
- install_files(/MyTest/include/old .h lib3)
- install_files(/MyTest/include/old "^lib2.h$")
- install_programs(/MyTest/share/old1 FILES
- scripts/sample_script scripts/sample_script.bat)
- install_programs(/MyTest/share/old2
- scripts/sample_script scripts/sample_script.bat)
-
-# "export" the targets collected in "SimpleInstallS1"
- install(EXPORT SimpleInstallS1 FILE SimpleInstallS1Config.cmake
- DESTINATION MyTest/lib
- NAMESPACE S1_ )
-
- export(TARGETS SimpleInstall test1 test2 test3
- FILE "${CMAKE_CURRENT_BINARY_DIR}/SimpleInstallS1Config.cmake"
- NAMESPACE S2_ )
-
- add_subdirectory(scripts)
-
- # Test optional installation.
- install(FILES does_not_exist.h DESTINATION MyTest/include/foo OPTIONAL)
-
- # Test configuration-specific installation.
- install(FILES lib1.h RENAME lib1release.h CONFIGURATIONS Release
- DESTINATION MyTest/include/Release
- )
- install(FILES lib1.h RENAME lib1debug.h CONFIGURATIONS Debug
- DESTINATION MyTest/include/Debug
- )
-
- # Test directory installation.
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
- install(
- DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- PATTERN "scripts/*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
- )
-
- # Alternate directory installation for coverage.
- install(
- DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- COMPONENT Development
- USE_SOURCE_PERMISSIONS
- PATTERN "CVS" EXCLUDE
- REGEX "\\.txt$" EXCLUDE
- )
- install(
- DIRECTORY TestSubDir DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE
- DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- FILES_MATCHING PATTERN "*.h"
- )
-
- # Test empty directory installation.
- install(DIRECTORY DESTINATION MyTest/share/empty)
-
- # Test optional directory installation.
- install(DIRECTORY does-not-exist DESTINATION MyTest/share OPTIONAL)
-
- # Test user-specified install scripts, with and without COMPONENT.
- install(
- SCRIPT InstallScript1.cmake
- CODE "set(INSTALL_CODE_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript2.cmake
- )
- install(
- SCRIPT InstallScript3.cmake
- CODE "set(INSTALL_CODE_WITH_COMPONENT_DID_RUN 1)"
- SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/InstallScript4.cmake
- COMPONENT Development
- )
- set_directory_properties(PROPERTIES
- ADDITIONAL_MAKE_CLEAN_FILES
- "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
-
- set_target_properties(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
- set_target_properties(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT
- ${CMAKE_CURRENT_SOURCE_DIR}/PostInstall.cmake)
- set_target_properties(test4 PROPERTIES VERSION 1.2 SOVERSION 3
- INSTALL_NAME_DIR @executable_path/../lib)
-endif()
-
-get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
-if(_isMultiConfig)
- set(SI_CONFIG --config $<CONFIGURATION>)
-else()
- set(SI_CONFIG)
-endif()
-
-# Dummy test of CPack
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test of packaging with cpack")
-set(CPACK_PACKAGE_VENDOR "Kitware")
-set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/PackageScript.cmake")
-
-if(WIN32 AND NOT UNIX)
- find_program(NSIS_MAKENSIS NAMES makensis
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
- DOC "Where is makensis.exe located"
- )
- if(NOT NSIS_MAKENSIS)
- set(CPACK_GENERATOR TGZ)
- endif()
-endif()
-if(UNIX AND NOT APPLE)
- set(CPACK_GENERATOR "TGZ;STGZ;TZ")
- # find_program(found_compress
- # NAMES compress)
- # if(found_compress)
- # find_program(file_command NAMES file)
- # if(NOT file_command)
- # set(file_command file)
- # endif()
- # execute_process(COMMAND ${file_command} ${found_compress}
- # OUTPUT_VARIABLE output)
- # set(SKIP_TZ FALSE)
- # if("${output}" MATCHES "script")
- # set(SKIP_TZ TRUE)
- # endif()
- # if("${output}" MATCHES "dummy.sh")
- # set(SKIP_TZ TRUE)
- # endif()
- # if(NOT SKIP_TZ)
- # message("compress found and it was not a script")
- # message("output from file command: [${output}]")
- # list(APPEND CPACK_GENERATOR "TZ")
- # else()
- # message("compress found, but it was a script so don't use it")
- # message("output from file command: [${output}]")
- # endif()
- # endif()
- find_program(found_bz2
- NAMES bzip2)
- if(found_bz2)
- list(APPEND CPACK_GENERATOR "TBZ2")
- endif()
-endif()
-
-set(CPACK_PACKAGE_EXECUTABLES "SimpleInstall" "Simple Install")
-set(CMAKE_INSTALL_MFC_LIBRARIES 1)
-set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
-set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
-include(InstallRequiredSystemLibraries)
-
-if(CTEST_TEST_CPACK)
- set(package_command COMMAND
- ${CMAKE_COMMAND} --build . --target package ${SI_CONFIG}
- )
-
- # Avoid settings that require the .zip file command line tools...
- # (just build an NSIS installer without component support)
- #
- set(CPACK_BINARY_ZIP OFF)
- set(CPACK_MONOLITHIC_INSTALL ON)
-else()
- set(package_command)
-endif()
-
-include(CPack)
-
-set(install_command COMMAND
- ${CMAKE_COMMAND} --build . --target install ${SI_CONFIG}
- )
-
-add_custom_command(
- TARGET ${install_target}
- POST_BUILD
- ${install_command}
- ${package_command}
- COMMENT "Install Project"
- )
diff --git a/Tests/SimpleInstallS2/InstallScript1.cmake b/Tests/SimpleInstallS2/InstallScript1.cmake
deleted file mode 100644
index ef9da5761..000000000
--- a/Tests/SimpleInstallS2/InstallScript1.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-message("This is install script 1.")
-set(INSTALL_SCRIPT_1_DID_RUN 1)
-if(INSTALL_CODE_DID_RUN)
- message(FATAL_ERROR "Install script 1 did not run before install code.")
-endif()
diff --git a/Tests/SimpleInstallS2/InstallScript2.cmake b/Tests/SimpleInstallS2/InstallScript2.cmake
deleted file mode 100644
index c1d20a3a6..000000000
--- a/Tests/SimpleInstallS2/InstallScript2.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-message("This is install script 2.")
-if(INSTALL_SCRIPT_1_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 1 did not run before install script 2.")
-endif()
-if(INSTALL_CODE_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 2 did not run after install code.")
-endif()
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScriptOut.cmake"
- "set(CMAKE_INSTALL_SCRIPT_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstallS2/InstallScript3.cmake b/Tests/SimpleInstallS2/InstallScript3.cmake
deleted file mode 100644
index 64851564d..000000000
--- a/Tests/SimpleInstallS2/InstallScript3.cmake
+++ /dev/null
@@ -1,12 +0,0 @@
-message("This is install script 3.")
-set(INSTALL_SCRIPT_3_DID_RUN 1)
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message(FATAL_ERROR "Install script 3 did not run before install code with component.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 3 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
diff --git a/Tests/SimpleInstallS2/InstallScript4.cmake b/Tests/SimpleInstallS2/InstallScript4.cmake
deleted file mode 100644
index 34d0a73bb..000000000
--- a/Tests/SimpleInstallS2/InstallScript4.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-message("This is install script 4.")
-if(INSTALL_SCRIPT_3_DID_RUN)
- message("Install script ordering works.")
-else()
- message(FATAL_ERROR "Install script 3 did not run before install script 4.")
-endif()
-if(INSTALL_CODE_WITH_COMPONENT_DID_RUN)
- message("Install code ordering works.")
-else()
- message(FATAL_ERROR "Install script 4 did not run after install with component code.")
-endif()
-
-if(CMAKE_INSTALL_COMPONENT)
-if(NOT "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Development")
- message("CMAKE_INSTALL_COMPONENT=\"${CMAKE_INSTALL_COMPONENT}\"")
- message(FATAL_ERROR "Install script 4 should only run for \"Development\" INSTALL COMPONENT.")
-endif()
-endif()
-
-file(WRITE "${CMAKE_INSTALL_PREFIX}/MyTest/InstallScript4Out.cmake"
- "set(CMAKE_INSTALL_SCRIPT_4_DID_RUN 1)\n"
- )
diff --git a/Tests/SimpleInstallS2/PackageScript.cmake b/Tests/SimpleInstallS2/PackageScript.cmake
deleted file mode 100644
index 53b790932..000000000
--- a/Tests/SimpleInstallS2/PackageScript.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-message("This is packaging script")
-message("It writes a file with all variables available in ${CMAKE_INSTALL_PREFIX}/AllVariables.txt")
-
-file(WRITE ${CMAKE_INSTALL_PREFIX}/AllVariables.txt "")
-get_cmake_property(res VARIABLES)
-foreach(var ${res})
- file(APPEND ${CMAKE_INSTALL_PREFIX}/AllVariables.txt
- "${var} \"${${var}}\"\n")
-endforeach()
-
diff --git a/Tests/SimpleInstallS2/PostInstall.cmake b/Tests/SimpleInstallS2/PostInstall.cmake
deleted file mode 100644
index d616221ef..000000000
--- a/Tests/SimpleInstallS2/PostInstall.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-message("In post install")
-if(PRE_INSTALL_DID_RUN)
- message("Pre and post install work fine")
-else()
- message(FATAL_ERROR "Pre install did not run before post install")
-endif()
diff --git a/Tests/SimpleInstallS2/PreInstall.cmake b/Tests/SimpleInstallS2/PreInstall.cmake
deleted file mode 100644
index 7a9851e1d..000000000
--- a/Tests/SimpleInstallS2/PreInstall.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-message("This is in pre install")
-set(PRE_INSTALL_DID_RUN 1)
diff --git a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt b/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt
deleted file mode 100644
index 860e10425..000000000
--- a/Tests/SimpleInstallS2/TestSubDir/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-add_executable(TSD TSD.cxx TSD_utils.cxx)
-install_files(/MyTest/include FILES TSD.h)
-install_targets(/MyTest/bin TSD)
diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD.cxx
deleted file mode 100644
index 8fc38787a..000000000
--- a/Tests/SimpleInstallS2/TestSubDir/TSD.cxx
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-
-#include "TSD.h"
-
-int main()
-{
- int res = TSD("TEST");
- printf("Hello from TSD\n");
- return res;
-}
diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD.h b/Tests/SimpleInstallS2/TestSubDir/TSD.h
deleted file mode 100644
index 6a3c1affa..000000000
--- a/Tests/SimpleInstallS2/TestSubDir/TSD.h
+++ /dev/null
@@ -1 +0,0 @@
-int TSD(const char*);
diff --git a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx b/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx
deleted file mode 100644
index 0f32894fe..000000000
--- a/Tests/SimpleInstallS2/TestSubDir/TSD_utils.cxx
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <string.h>
-
-int TSD(const char* foo)
-{
- if (strcmp(foo, "TEST") == 0) {
- return 0;
- }
- return 1;
-}
diff --git a/Tests/SimpleInstallS2/foo.c b/Tests/SimpleInstallS2/foo.c
deleted file mode 100644
index 45d5b2bf2..000000000
--- a/Tests/SimpleInstallS2/foo.c
+++ /dev/null
@@ -1,6 +0,0 @@
-char* foo = "Foo";
-
-int SomeFunctionInFoo()
-{
- return 5;
-}
diff --git a/Tests/SimpleInstallS2/foo.h b/Tests/SimpleInstallS2/foo.h
deleted file mode 100644
index 216cdf67b..000000000
--- a/Tests/SimpleInstallS2/foo.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char* foo;
-extern int SomeFunctionInFoo();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/Tests/SimpleInstallS2/inst.cxx b/Tests/SimpleInstallS2/inst.cxx
deleted file mode 100644
index 7815f86ce..000000000
--- a/Tests/SimpleInstallS2/inst.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "foo.h"
-
-#ifdef STAGE_2
-# include <foo/lib1.h>
-# include <foo/lib2renamed.h>
-# include <lib3.h>
-# include <old/lib2.h>
-# include <old/lib3.h>
-#else
-# include "lib1.h"
-# include "lib2.h"
-#endif
-
-#include "lib4.h"
-
-#include <stdio.h>
-
-int main()
-{
- if (Lib1Func() != 2.0) {
- printf("Problem with lib1\n");
- return 1;
- }
- if (Lib2Func() != 1.0) {
- printf("Problem with lib2\n");
- return 1;
- }
- if (Lib4Func() != 4.0) {
- printf("Problem with lib4\n");
- return 1;
- }
- printf("The value of Foo: %s\n", foo);
- return SomeFunctionInFoo() - 5;
-}
diff --git a/Tests/SimpleInstallS2/inst2.cxx b/Tests/SimpleInstallS2/inst2.cxx
deleted file mode 100644
index c70b93af1..000000000
--- a/Tests/SimpleInstallS2/inst2.cxx
+++ /dev/null
@@ -1,2 +0,0 @@
-#define STAGE_2
-#include "inst.cxx"
diff --git a/Tests/SimpleInstallS2/lib1.cxx b/Tests/SimpleInstallS2/lib1.cxx
deleted file mode 100644
index 7aa905205..000000000
--- a/Tests/SimpleInstallS2/lib1.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib1.h"
-
-float Lib1Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstallS2/lib1.h b/Tests/SimpleInstallS2/lib1.h
deleted file mode 100644
index 0d64e76bc..000000000
--- a/Tests/SimpleInstallS2/lib1.h
+++ /dev/null
@@ -1 +0,0 @@
-extern float Lib1Func();
diff --git a/Tests/SimpleInstallS2/lib2.cxx b/Tests/SimpleInstallS2/lib2.cxx
deleted file mode 100644
index dccc48b78..000000000
--- a/Tests/SimpleInstallS2/lib2.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib2.h"
-
-float Lib2Func()
-{
- return 1.0;
-}
diff --git a/Tests/SimpleInstallS2/lib2.h b/Tests/SimpleInstallS2/lib2.h
deleted file mode 100644
index 044e7750d..000000000
--- a/Tests/SimpleInstallS2/lib2.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test2_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib2Func();
diff --git a/Tests/SimpleInstallS2/lib3.cxx b/Tests/SimpleInstallS2/lib3.cxx
deleted file mode 100644
index da8dbf942..000000000
--- a/Tests/SimpleInstallS2/lib3.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib3.h"
-
-float Lib3Func()
-{
- return 2.0;
-}
diff --git a/Tests/SimpleInstallS2/lib3.h b/Tests/SimpleInstallS2/lib3.h
deleted file mode 100644
index e02bbc4c0..000000000
--- a/Tests/SimpleInstallS2/lib3.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test3_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib3Func();
diff --git a/Tests/SimpleInstallS2/lib4.cxx b/Tests/SimpleInstallS2/lib4.cxx
deleted file mode 100644
index fbede5ce5..000000000
--- a/Tests/SimpleInstallS2/lib4.cxx
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "lib4.h"
-
-float Lib4Func()
-{
- return 4.0;
-}
diff --git a/Tests/SimpleInstallS2/lib4.h b/Tests/SimpleInstallS2/lib4.h
deleted file mode 100644
index e1a221e28..000000000
--- a/Tests/SimpleInstallS2/lib4.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifdef _WIN32
-# ifdef test4_EXPORTS
-# define CM_TEST_LIB_EXPORT __declspec(dllexport)
-# else
-# define CM_TEST_LIB_EXPORT __declspec(dllimport)
-# endif
-#else
-# define CM_TEST_LIB_EXPORT
-#endif
-
-CM_TEST_LIB_EXPORT float Lib4Func();
diff --git a/Tests/SimpleInstallS2/scripts/CMakeLists.txt b/Tests/SimpleInstallS2/scripts/CMakeLists.txt
deleted file mode 100644
index ec34e8c50..000000000
--- a/Tests/SimpleInstallS2/scripts/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-install_programs(/MyTest/share/old3 "^sample_script(\\.bat)?$")
diff --git a/Tests/SimpleInstallS2/scripts/sample_script b/Tests/SimpleInstallS2/scripts/sample_script
deleted file mode 100755
index 81f9f5315..000000000
--- a/Tests/SimpleInstallS2/scripts/sample_script
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-echo "Sample Script Output"
diff --git a/Tests/SimpleInstallS2/scripts/sample_script.bat b/Tests/SimpleInstallS2/scripts/sample_script.bat
deleted file mode 100755
index 64a77b5b0..000000000
--- a/Tests/SimpleInstallS2/scripts/sample_script.bat
+++ /dev/null
@@ -1 +0,0 @@
-@echo Sample Script Output
diff --git a/Tests/UseSWIG/BasicConfiguration.cmake b/Tests/UseSWIG/BasicConfiguration.cmake
index ad34d3909..fd3ac4031 100644
--- a/Tests/UseSWIG/BasicConfiguration.cmake
+++ b/Tests/UseSWIG/BasicConfiguration.cmake
@@ -58,7 +58,6 @@ if(${language} MATCHES lua)
set(SWIG_LANG_LIBRARIES ${LUA_LIBRARIES})
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
unset(CMAKE_SWIG_FLAGS)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/Tests/UseSWIG/BasicCsharp/CMakeLists.txt b/Tests/UseSWIG/BasicCsharp/CMakeLists.txt
index 84743efa0..1a6c763b5 100644
--- a/Tests/UseSWIG/BasicCsharp/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicCsharp/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.12...3.13)
project(TestBasicCsharp CXX CSharp)
diff --git a/Tests/UseSWIG/BasicPerl/CMakeLists.txt b/Tests/UseSWIG/BasicPerl/CMakeLists.txt
index 476ef0e9a..cf02de7de 100644
--- a/Tests/UseSWIG/BasicPerl/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicPerl/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestBasicPerl CXX)
diff --git a/Tests/UseSWIG/BasicPython/CMakeLists.txt b/Tests/UseSWIG/BasicPython/CMakeLists.txt
index cf1d8213c..8bbd1cbe8 100644
--- a/Tests/UseSWIG/BasicPython/CMakeLists.txt
+++ b/Tests/UseSWIG/BasicPython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestBasicPython CXX)
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index cc29b7700..4c3d901a9 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -88,3 +88,14 @@ add_test(NAME UseSWIG.ModuleVersion2 COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+
+
+add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES"
+ ${build_generator_args}
+ --build-project TestModuleVersion2
+ --build-options ${build_options}
+ )
diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
index 452f9e273..a7ee2106b 100644
--- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
+++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestModuleVersion2 CXX)
@@ -16,7 +16,6 @@ else()
set (PS ":")
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
set (UseSWIG_MODULE_VERSION 2)
unset(CMAKE_SWIG_FLAGS)
diff --git a/Tests/UseSWIG/MultipleModules/CMakeLists.txt b/Tests/UseSWIG/MultipleModules/CMakeLists.txt
index 25dd6b317..f1dc379c5 100644
--- a/Tests/UseSWIG/MultipleModules/CMakeLists.txt
+++ b/Tests/UseSWIG/MultipleModules/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestMultipleModules CXX)
@@ -19,7 +19,6 @@ else()
set (PS ":")
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
unset(CMAKE_SWIG_FLAGS)
set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON)
diff --git a/Tests/UseSWIG/MultiplePython/CMakeLists.txt b/Tests/UseSWIG/MultiplePython/CMakeLists.txt
index a1651fbfe..8f8775576 100644
--- a/Tests/UseSWIG/MultiplePython/CMakeLists.txt
+++ b/Tests/UseSWIG/MultiplePython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.1...3.13)
project(TestMultiplePython CXX)
@@ -17,7 +17,6 @@ else()
set (PS ":")
endif()
-set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
unset(CMAKE_SWIG_FLAGS)
set_property(SOURCE "../example.i" PROPERTY CPLUSPLUS ON)
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
new file mode 100644
index 000000000..fbb72d571
--- /dev/null
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.1...3.13)
+
+project(TestUseTargetINCLUDE_DIRECTORIES CXX)
+
+include(CTest)
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+
+unset(CMAKE_SWIG_FLAGS)
+
+set_property(SOURCE "example.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "example.i" PROPERTY COMPILE_OPTIONS -includeall)
+
+swig_add_library(example1
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ SOURCES example.i ../example.cxx)
+set_target_properties (example1 PROPERTIES
+ INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE
+ OUTPUT_NAME example1
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1")
+target_link_libraries(example1 PRIVATE Python3::Python)
+
+
+# Check that source property override target property
+set_property(SOURCE "example.i" PROPERTY USE_TARGET_INCLUDE_DIRECTORIES TRUE)
+
+swig_add_library(example2
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ SOURCES example.i ../example.cxx)
+set_target_properties (example2 PROPERTIES
+ INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES FALSE
+ OUTPUT_NAME example2
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2")
+target_link_libraries(example2 PRIVATE Python3::Python)
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i
new file mode 100644
index 000000000..fbdf7249f
--- /dev/null
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i
@@ -0,0 +1,9 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
diff --git a/Tests/VSNASM/CMakeLists.txt b/Tests/VSNASM/CMakeLists.txt
index c2e29df25..821d0227e 100644
--- a/Tests/VSNASM/CMakeLists.txt
+++ b/Tests/VSNASM/CMakeLists.txt
@@ -1,10 +1,20 @@
cmake_minimum_required(VERSION 2.8.12)
project(VSNASM C ASM_NASM)
+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DTESTx64)
string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64")
else()
add_definitions(-DTESTi386)
endif()
+
+# Test quoting for definitions with spaces.
+add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0")
+
+# Test quoting for file names with spaces. The file is generated because CMake
+# itself cannot have files with spaces.
+file(READ bar.asm BAR_ASM_CONTENTS)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}")
+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-add_executable(VSNASM main.c foo.asm)
+add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm")
diff --git a/Tests/VSNASM/bar.asm b/Tests/VSNASM/bar.asm
new file mode 100644
index 000000000..b486d82ae
--- /dev/null
+++ b/Tests/VSNASM/bar.asm
@@ -0,0 +1,13 @@
+section .text
+%ifdef TEST2x64
+global bar
+%else
+global _bar
+%endif
+%ifdef TESTx64
+bar:
+%else
+_bar:
+%endif
+ mov EAX_COMMA_SPACE_ZERO
+ ret
diff --git a/Tests/VSNASM/include/foo-proc.asm b/Tests/VSNASM/include/foo-proc.asm
index 450a7919b..eb5bb2b06 100644
--- a/Tests/VSNASM/include/foo-proc.asm
+++ b/Tests/VSNASM/include/foo-proc.asm
@@ -3,5 +3,5 @@ foo:
%else
_foo:
%endif
- mov eax, 0
+ mov EAX_COMMA_SPACE_ZERO
ret
diff --git a/Tests/VSNASM/main.c b/Tests/VSNASM/main.c
index 18ddb7826..b1401b698 100644
--- a/Tests/VSNASM/main.c
+++ b/Tests/VSNASM/main.c
@@ -1,5 +1,6 @@
extern int foo(void);
+extern int bar(void);
int main(void)
{
- return foo();
+ return foo() + bar();
}