CMake/Tests
Matthew Woehlke ab358d6a85 Improve find_dependency argument handling
Remove highly specialized and totally positional argument handling in
find_dependency macro, and instead just pass arguments through to
find_package. This gives users access to the full suite of arguments
that find_package knows, and is backward compatible with the old
arguments.

Also, rewrite the unit tests for this, since the old tests are
exclusively focused on testing the old argument handling and are no
longer applicable, and add some success tests (the old tests did not
even set up the CMake state in a way that CMake had any hope of ever
finding the test package).
2017-05-22 13:32:43 -04:00
..
AliasTarget Merge topic 'use-string-append' 2016-08-01 14:59:50 -04:00
Architecture Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
ArgumentExpansion
Assembler Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
BuildDepends Drop Visual Studio 7 .NET 2003 generator 2017-04-19 15:28:05 -04:00
BundleGeneratorTest Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
BundleTest Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
BundleUtilities Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CFBundleTest Xcode: Properly handle BUNDLE_EXTENSION 2016-06-18 23:23:32 +02:00
CheckCompilerRelatedVariables
CMakeCommands Tests: use cxx_auto_type only if actually available 2017-01-25 21:00:30 +01:00
CMakeLib Xcode: Drop support for Xcode versions below 3 2017-04-22 15:19:11 -04:00
CMakeOnly Merge topic 'fix-test-all-find-modules' 2017-04-24 09:34:03 -04:00
CMakeTestAllGenerators Tests: Drop machine-specific logic from CMakeTestAllGenerators 2017-04-18 15:12:22 -04:00
CMakeTestMultipleConfigures
CMakeTests Do not assume GCC libs are linked by all compilers 2017-05-05 17:26:29 +02:00
CoberturaCoverage
CommandLineTest
CompatibleInterface Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CompileCommandOutput Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CompileDefinitions Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CompileFeatures Features: Record features for SunPro C 5.13 and 5.14 2017-05-11 15:59:48 -04:00
CompileOptions Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Complex Add additional <= and >= comparison operators 2016-08-09 09:30:34 -04:00
ComplexOneConfig Add additional <= and >= comparison operators 2016-08-09 09:30:34 -04:00
ConfigSources
COnly Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Contracts Replace http://www.cmake.org URLs with https://cmake.org 2015-09-25 15:47:39 -04:00
CPackComponents Tests: Fix CPackComponents NSIS install root 2017-03-09 10:20:35 -05:00
CPackComponentsDEB Revert "CPack/DEB: Make package description variable precedence match RPM" 2016-09-24 12:05:06 +02:00
CPackComponentsForAll CPack/RPM tests: handle build-id links 2017-03-27 09:08:24 -04:00
CPackComponentsPrefix
CPackTestAllGenerators
CPackWiXGenerator Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CrossCompile
CSharpOnly VS: added support for C# (for Visual Studio 2010, 2012, 2013, 2015) 2017-01-13 09:28:13 +01:00
CTestBuildCommandProjectInSubdir
CTestConfig Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestCoverageCollectGCOV Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestLimitDashJ issues: update references to the CMake issue tracker 2016-08-15 09:34:06 -04:00
CTestScriptMode
CTestTest Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTest2 Tests: In CTestTest2 skip the kwsys.testProcess-10 test that leaks 2015-07-31 09:27:08 -04:00
CTestTestBadExe
CTestTestBadGenerator
CTestTestChecksum Tests: Fix spurious CTestTestParallel failures 2017-03-31 13:46:08 -04:00
CTestTestCostSerial Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestCrash Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestCycle
CTestTestDepends
CTestTestEmptyBinaryDirectory
CTestTestFailure Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestFdSetSize Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestLabelRegExp
CTestTestLaunchers Tests: Add additional launcher tests 2017-01-10 13:48:59 -05:00
CTestTestMissingDependsExe
CTestTestParallel Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestResourceLock Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestRunScript
CTestTestScheduler Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestSerialInDepends
CTestTestSerialOrder
CTestTestSkipReturnCode
CTestTestStopTime Tests: make tests pass with SOURCE_DATE_EPOCH set 2017-01-30 09:25:44 -05:00
CTestTestSubdir
CTestTestTimeout Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestUpload Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CTestTestVerboseOutput
CTestTestZeroTimeout Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Cuda CUDA: Visual Studio now properly delays device linking 2017-04-26 11:41:22 -04:00
CudaOnly CUDA: Static libraries can now explicitly resolve device symbols 2017-04-26 16:18:25 -04:00
CustComDepend Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CustomCommand add_custom_{command,target}: Add COMMAND_EXPAND_LISTS option 2017-01-13 20:02:16 -06:00
CustomCommandByproducts Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CustomCommandWorkingDirectory Tests: use BYPRODUCTS in the CustomCommandWorkingDirectory test 2017-04-21 08:57:40 -04:00
CxxDialect
CxxOnly Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
CxxSubdirC Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
DelphiCoverage Tests: Fix DelphiCoverage test file selection 2015-10-20 11:13:25 -04:00
Dependency Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
DoubleProject
EmptyDepends
EmptyLibrary
EmptyProperty Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Environment Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
ExportImport Allow OBJECT libraries to be installed, exported, and imported 2017-04-18 11:36:10 -04:00
ExternalOBJ
ExternalProject ExternalProject: only append COMMAND if actually adding a command 2017-02-27 11:33:31 -05:00
ExternalProjectLocal ExternalProject: Fix UPDATE_DISCONNECTED with empty update steps 2016-11-15 08:45:04 -05:00
ExternalProjectSourceSubdir ExternalProject: Add SOURCE_SUBDIR option 2016-08-16 13:18:18 -04:00
ExternalProjectSubdir Drop Visual Studio 6 generator 2016-03-09 09:42:18 -05:00
ExternalProjectUpdate ExternalProject: Always run update step with non-empty UPDATE_COMMAND 2016-05-18 14:54:25 -04:00
FindBoost Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
FindBZip2 Tests: Add FindBZip2 unit tests 2016-09-09 11:42:35 -04:00
FindGSL Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
FindGTest Tests: Remove unnecessary setting of CMAKE_MODULE_PATH 2017-05-16 08:05:32 +10:00
FindGTK2 Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
FindICU Tests: Run clang-format on FindICU test code 2016-07-13 10:01:02 -04:00
FindJsonCpp
FindLibRHash FindLibRHash: Add module to find the librhash package 2016-11-10 08:29:38 -05:00
FindLibUV FindLibUV: Add module to find libuv package 2016-08-31 09:05:14 -04:00
FindLTTngUST Format include directive blocks and ordering with clang-format 2016-04-29 13:58:54 -04:00
FindMatlab FindMatlab: adding handling of component "MAT" 2016-08-30 14:50:20 +02:00
FindModulesExecuteAll Tests: Fix FindModulesExecuteAll when KDE4 is installed 2017-04-21 10:11:10 -04:00
FindMPI TestFindOpenMP,MPI: Disable default languages 2017-05-08 21:43:01 +02:00
FindOpenCL Tests/FindOpenCL: Run clang-format to fix style 2016-06-07 08:41:06 -04:00
FindOpenGL FindOpenGL: Provide imported targets for GL and GLU 2016-12-02 15:11:49 -05:00
FindOpenMP TestFindOpenMP,MPI: Disable default languages 2017-05-08 21:43:01 +02:00
FindOpenSSL Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
FindPackageModeMakefileTest Test: Remove condition for CMake version no longer supported 2016-10-10 10:09:54 -04:00
FindPackageTest find_package: Optionally sort globbed directories in a meaningful order 2016-09-15 13:35:25 -04:00
FindPNG Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
FindThreads FindThreads: officially announce it works with only C++ enabled 2015-09-25 10:08:35 -04:00
FindTIFF Tests: Remove unnecessary setting of CMAKE_MODULE_PATH 2017-05-16 08:05:32 +10:00
FindVulkan Tests/FindVulkan: Run clang-format 2016-06-08 12:56:50 -04:00
FindXalanC Tests: Remove unnecessary setting of CMAKE_MODULE_PATH 2017-05-16 08:05:32 +10:00
FindXercesC Tests: Remove unnecessary setting of CMAKE_MODULE_PATH 2017-05-16 08:05:32 +10:00
ForceInclude Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Fortran Tests: Split Fortran module testing into separate FortranModules test 2016-09-22 14:52:01 -04:00
FortranC Tests: Fix CMAKE_MAKE_PROGRAM selection in FortranC.Flags test 2015-08-11 10:18:05 -04:00
FortranModules Ninja: Add source location as include directory for preprocessed files 2016-09-27 08:11:08 -04:00
FortranOnly
Framework Apple: Add support for static frameworks 2017-01-31 08:59:15 -05:00
FunctionTest
GeneratorExpression Genex: Allow TARGET_OBJECTS to be used everywhere 2017-04-18 11:36:09 -04:00
GhsMulti Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
GhsMultiDuplicateSourceFilenames GHS: Use shorter object file names on collision 2016-05-18 09:27:19 -04:00
GoogleTest GoogleTest: Expand capabilities of gtest_add_tests() 2017-05-16 07:57:27 +10:00
IncludeDirectories Xcode: Properly mark SYSTEM includes as such 2016-12-27 22:18:30 +01:00
InterfaceLibrary Allow NO_SYSTEM_FROM_IMPORTED on imported INTERFACE libraries 2016-11-21 11:42:01 -05:00
InterfaceLinkLibraries Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
iOSNavApp Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
IPO
JacocoCoverage
Java Tests/Java: Clean up style of Java test code 2016-06-07 08:50:35 -04:00
JavaExportImport Tests: Test namespaces with exported JARs 2017-04-21 10:51:09 -04:00
JavaJavah Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
JavascriptCoverage
JCTest Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Jump Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LibName Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LinkDirectory Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LinkFlags Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LinkLanguage Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LinkLine Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LinkLineOrder Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LinkStatic
LoadCommand Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
LoadCommandOneConfig Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
MacroTest
MacRuntimePath Add a BUILD_RPATH target property specifying build-tree RPATH entries 2016-10-03 13:42:27 -04:00
MakeClean Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
MathTest math(EXPR): Add support for unary + and - expressions 2016-10-14 15:35:15 -04:00
MFC Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
MissingInstall Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
MissingSourceFile
Module Tests: Add cases for typical CheckIPOSupported usage 2017-04-18 11:54:33 -04:00
ModuleDefinition Support WINDOWS_EXPORT_ALL_SYMBOLS with .def files 2017-03-21 10:02:34 -04:00
MSManifest Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
MumpsCoverage
NewlineArgs Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
ObjC++
ObjectLibrary Drop Visual Studio 7 .NET 2003 generator 2017-04-19 15:28:05 -04:00
OutDir Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
OutOfBinary Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
OutOfSource Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
PDBDirectoryAndName Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
PerConfig Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Plugin Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
Policy0002
PolicyScope
PositionIndependentTargets clang-format.bash: Use Git attributes to mark files for formatting 2017-02-22 16:59:26 -05:00
PrecompiledHeader Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
PreOrder Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Preprocess Drop Visual Studio 7 .NET 2003 generator 2017-04-19 15:28:05 -04:00
Properties Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
PythonCoverage
Qt4And5Automoc
Qt4Deploy Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Qt4Targets Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
QtAutogen Autogen: Tests: More rigorous rcc rebuild tests 2017-03-23 16:51:34 +01:00
QtAutomocNoQt
QtAutoUicInterface QtAutogen: Tests: Don't use std::auto_ptr 2016-12-07 08:24:06 -05:00
ReturnTest
RunCMake Improve find_dependency argument handling 2017-05-22 13:32:43 -04:00
RuntimePath Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SameName Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SBCS Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Server Tests/Server: import print_function from the future 2017-05-10 09:42:31 -04:00
SetLang Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Simple Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SimpleCOnly Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SimpleExclude Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SimpleInstall Tests: Activate InstallRequiredSystemLibraries OpenMP libs 2017-03-24 10:40:58 -04:00
SimpleInstallS2 prefer list(APPEND) over string(APPEND) where appropriate 2016-08-08 21:28:52 +02:00
SourceFileProperty
SourceGroups source_group: Restore TREE support for relative paths 2017-05-17 09:04:02 -04:00
SourcesProperty
StagingPrefix Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
StringFileTest Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SubDir Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SubDirSpaces Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SubProject Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
SwiftMix Swift: Simplify mixed test case to make it version agnostic 2017-03-29 15:36:05 +02:00
SwiftOnly Xcode: Add option to set Swift language version 2016-09-26 08:46:23 -04:00
SwigTest SwigTest: Update for swig_add_library and add lua example 2016-11-11 08:14:10 +01:00
SystemInformation Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
TargetName Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
TestDriver Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Testing Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
TestsWorkingDirectory Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
TryCompile Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
Tutorial Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Unset
VariableUnusedViaSet
VariableUnusedViaUnset
VariableUsage
Visibility Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
VSExcludeFromDefaultBuild
VSExternalInclude VS15: Add Visual Studio 15 generator 2016-09-07 15:49:08 -04:00
VSGNUFortran Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
VSMASM Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
VSMidl Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
VSNASM VS: Add support for ASM_NASM language 2017-02-07 13:20:52 -05:00
VSNsightTegra Tests: Fix VSNsightTegra test on Android NDK r12b 2016-10-18 13:32:50 -04:00
VSProjectInSubdir
VSResource Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
VSResourceNinjaForceRSP ninja, rc: ignore CMAKE_NINJA_FORCE_RESPONSE_FILE for RC files 2016-06-27 14:34:06 -04:00
VSWindowsFormsResx Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
VSWinStorePhone Merge topic 'vs-tool-override' 2016-06-23 08:59:29 -04:00
VSXaml Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
WarnUnusedCliUnused Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
Wrapping Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
X11 Revise C++ coding style using clang-format 2016-05-16 16:05:19 -04:00
XCTest XCTest: Add support for static frameworks 2017-04-25 09:56:34 -04:00
.NoDartCoverage
bootstrap.bat.in
BootstrapTest.cmake BootstrapTest: Use --parallel=... argument. 2016-10-21 18:22:44 +02:00
CheckFortran.cmake Tests: Pass generator platform and toolset into check for Fortran 2017-03-08 09:12:09 -05:00
CMakeBuildTest.cmake.in
CMakeCopyright.cmake
CMakeInstall.cmake
CMakeLists.txt GoogleTest: Expand capabilities of gtest_add_tests() 2017-05-16 07:57:27 +10:00
CTestUpdateBZR.cmake.in Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
CTestUpdateCommon.cmake Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
CTestUpdateCVS.cmake.in Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
CTestUpdateGIT.cmake.in Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
CTestUpdateGIT.sh.in
CTestUpdateHG.cmake.in Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
CTestUpdateP4.cmake.in Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
CTestUpdateSVN.cmake.in Use string(APPEND) in Tests 2016-07-28 00:43:04 +02:00
EnforceConfig.cmake.in
README
test_clean.cmake.in

If you think about adding a new testcase then here is a small checklist you
can run through to find a proper place for it. Go through the list from the
beginning and stop once you find something that matches your tests needs,
i.e. if you will test a module and only need the configure mode use the
instructions from section 2, not 3.

1. Your testcase can run in CMake script mode, i.e. "cmake -P something"

Put your test in Tests/CMakeTests/ directory as a .cmake.in file. It will be
put into the test binary directory by configure_file(... @ONLY) and run from
there. Use the AddCMakeTest() macro in Tests/CMakeTests/CMakeLists.txt to add
your test to the test runs.

2. Your test needs CMake to run in configure mode, but will not build anything

This includes tests that will build something using try_compile() and friends,
but nothing that expects add_executable(), add_library(), or add_test() to run.

If the test configures the project only once and it must succeed then put it
into the Tests/CMakeOnly/ directory.  Create a subdirectory named like your
test and write the CMakeLists.txt you need into that subdirectory. Use the
add_CMakeOnly_test() macro from Tests/CMakeOnly/CMakeLists.txt to add your
test to the test runs.

If the test configures the project with multiple variations and verifies
success or failure each time then put it into the Tests/RunCMake/ directory.
Read the instructions in Tests/RunCMake/CMakeLists.txt to add a test.

3. If you are testing something from the Modules directory

Put your test in the Tests/Modules/ directory. Create a subdirectory there
named after your test. Use the ADD_TEST_MACRO macro from Tests/CMakeLists.txt
to add your test to the test run. If you have put your stuff in
Tests/Modules/Foo then you call it using ADD_TEST_MACRO(Module.Foo Foo).

4. You are doing other stuff.

Find a good place ;) In doubt mail to cmake-developers@cmake.org and ask for
advise.