summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-server.7.rst19
-rw-r--r--Help/release/dev/WriteBasicConfigVersionFile_SameMinorVersion.rst5
-rw-r--r--Modules/BasicConfigVersion-SameMinorVersion.cmake.in50
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake12
-rw-r--r--Modules/FindImageMagick.cmake9
-rw-r--r--Modules/FindQt4.cmake13
-rw-r--r--Modules/FindwxWidgets.cmake7
-rw-r--r--Modules/FindwxWindows.cmake3
-rw-r--r--Modules/GoogleTest.cmake27
-rw-r--r--Modules/InstallRequiredSystemLibraries.cmake5
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefile.h10
-rw-r--r--Source/cmServerDictionary.h1
-rw-r--r--Source/cmServerProtocol.cxx91
-rw-r--r--Source/cmTestGenerator.cxx10
-rw-r--r--Source/cmTestGenerator.h5
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt91
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt (renamed from Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt)0
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt25
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest.cmake10
-rw-r--r--Tests/RunCMake/GoogleTest/RunCMakeTest.cmake10
23 files changed, 296 insertions, 128 deletions
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index 54f7a79..c2aef99 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -658,25 +658,8 @@ Each project object can have the following keys:
"name"
contains the (sub-)projects name.
-"targets"
- contains a list of build system target objects.
-
-Target objects define individual build targets for a certain configuration.
-
-Each target object can have the following keys:
-
-"name"
- contains the name of the target.
-"type"
- defines the type of build of the target. Possible values are
- "STATIC_LIBRARY", "MODULE_LIBRARY", "SHARED_LIBRARY", "OBJECT_LIBRARY",
- "EXECUTABLE", "UTILITY" and "INTERFACE_LIBRARY".
-"fullName"
- contains the full name of the build result (incl. extensions, etc.).
-"hasEnabledTests"
- true if testing is enabled for this target.
"ctestInfo"
- contains a list of test objects for this target.
+ contains a list of test objects.
Each test object can have the following keys:
diff --git a/Help/release/dev/WriteBasicConfigVersionFile_SameMinorVersion.rst b/Help/release/dev/WriteBasicConfigVersionFile_SameMinorVersion.rst
new file mode 100644
index 0000000..7f1c4d0
--- /dev/null
+++ b/Help/release/dev/WriteBasicConfigVersionFile_SameMinorVersion.rst
@@ -0,0 +1,5 @@
+WriteBasicConfigFile_SameMinorVersion
+-------------------------------------
+
+* The :command:`write_basic_package_version_file` understands a new
+ ``SameMinorVersion`` option for the ``COMPATIBILITY`` argument.
diff --git a/Modules/BasicConfigVersion-SameMinorVersion.cmake.in b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
new file mode 100644
index 0000000..59ca253
--- /dev/null
+++ b/Modules/BasicConfigVersion-SameMinorVersion.cmake.in
@@ -0,0 +1,50 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by write_basic_package_version_file() as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
+# but only if the requested major and minor versions are the same as the current
+# one.
+# The variable CVF_VERSION must be set before calling configure_file().
+
+
+set(PACKAGE_VERSION "@CVF_VERSION@")
+
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+
+ if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.([0-9]+)")
+ set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
+ else()
+ set(CVF_VERSION_MAJOR "@CVF_VERSION@")
+ set(CVF_VERSION_MINOR "")
+ endif()
+
+ if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
+ (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ else()
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ endif()
+
+ if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
+
+
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+ return()
+endif()
+
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+ math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+ set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+ set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index f5a8e59..e37f34f 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -122,7 +122,7 @@
#
# write_basic_package_version_file(<filename>
# [VERSION <major.minor.patch>]
-# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> )
+# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion> )
#
#
# Writes a file for use as ``<package>ConfigVersion.cmake`` file to
@@ -144,6 +144,9 @@
# requested, e.g. version 2.0 will not be considered compatible if 1.0 is
# requested. This mode should be used for packages which guarantee backward
# compatibility within the same major version.
+# If ``SameMinorVersion`` is used, the behaviour is the same as
+# ``SameMajorVersion``, but both major and minor version must be the same as
+# requested, e.g version 0.2 will not be compatible if 0.1 is requested.
# If ``ExactVersion`` is used, then the package is only considered compatible if
# the requested version matches exactly its own version number (not considering
# the tweak version). For example, version 1.2.3 of a package is only
@@ -154,10 +157,9 @@
# macro.
#
# Internally, this macro executes :command:`configure_file()` to create the
-# resulting version file. Depending on the ``COMPATIBILITY``, either the file
-# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or
-# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that
-# these two files are internal to CMake and you should not call
+# resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
+# ``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used.
+# Please note that these files are internal to CMake and you should not call
# :command:`configure_file()` on them yourself, but they can be used as starting
# point to create more sophisticted custom ``ConfigVersion.cmake`` files.
#
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 7d5534b..c16bbf2 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -196,24 +196,33 @@ foreach(component ${ImageMagick_FIND_COMPONENTS}
if(component STREQUAL "Magick++")
FIND_IMAGEMAGICK_API(Magick++ Magick++.h
Magick++ CORE_RL_Magick++_
+ Magick++-6 Magick++-7
Magick++-Q8 Magick++-Q16 Magick++-Q16HDRI Magick++-Q8HDRI
+ Magick++-6.Q64 Magick++-6.Q32 Magick++-6.Q64HDRI Magick++-6.Q32HDRI
Magick++-6.Q16 Magick++-6.Q8 Magick++-6.Q16HDRI Magick++-6.Q8HDRI
+ Magick++-7.Q64 Magick++-7.Q32 Magick++-7.Q64HDRI Magick++-7.Q32HDRI
Magick++-7.Q16 Magick++-7.Q8 Magick++-7.Q16HDRI Magick++-7.Q8HDRI
)
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
elseif(component STREQUAL "MagickWand")
FIND_IMAGEMAGICK_API(MagickWand "wand/MagickWand.h;MagickWand/MagickWand.h"
Wand MagickWand CORE_RL_wand_
+ MagickWand-6 MagickWand-7
MagickWand-Q16 MagickWand-Q8 MagickWand-Q16HDRI MagickWand-Q8HDRI
+ MagickWand-6.Q64 MagickWand-6.Q32 MagickWand-6.Q64HDRI MagickWand-6.Q32HDRI
MagickWand-6.Q16 MagickWand-6.Q8 MagickWand-6.Q16HDRI MagickWand-6.Q8HDRI
+ MagickWand-7.Q64 MagickWand-7.Q32 MagickWand-7.Q64HDRI MagickWand-7.Q32HDRI
MagickWand-7.Q16 MagickWand-7.Q8 MagickWand-7.Q16HDRI MagickWand-7.Q8HDRI
)
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
elseif(component STREQUAL "MagickCore")
FIND_IMAGEMAGICK_API(MagickCore "magick/MagickCore.h;MagickCore/MagickCore.h"
Magick MagickCore CORE_RL_magick_
+ MagickCore-6 MagickCore-7
MagickCore-Q16 MagickCore-Q8 MagickCore-Q16HDRI MagickCore-Q8HDRI
+ MagickCore-6.Q64 MagickCore-6.Q32 MagickCore-6.Q64HDRI MagickCore-6.Q32HDRI
MagickCore-6.Q16 MagickCore-6.Q8 MagickCore-6.Q16HDRI MagickCore-6.Q8HDRI
+ MagickCore-7.Q64 MagickCore-7.Q32 MagickCore-7.Q64HDRI MagickCore-7.Q32HDRI
MagickCore-7.Q16 MagickCore-7.Q8 MagickCore-7.Q16HDRI MagickCore-7.Q8HDRI
)
list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index c67d0be..714e4af 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -709,13 +709,19 @@ if (QT_QMAKE_EXECUTABLE AND
if (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED)
_qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir)
set(QT_PLUGINS_DIR NOTFOUND)
+ set(qt_cross_paths)
foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins")
endforeach()
- find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
+ find_path(QT_PLUGINS_DIR
+ NAMES accessible bearer codecs designer graphicssystems iconengines imageformats inputmethods qmltooling script sqldrivers
HINTS ${qt_cross_paths} ${qt_plugins_dir}
DOC "The location of the Qt plugins"
NO_CMAKE_FIND_ROOT_PATH)
+ # If no plugins were installed, set QT_PLUGINS_DIR to ${qt_plugins_dir}
+ if(NOT QT_PLUGINS_DIR AND qt_plugins_dir)
+ set(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins")
+ endif()
endif ()
# ask qmake for the translations directory
@@ -729,6 +735,7 @@ if (QT_QMAKE_EXECUTABLE AND
_qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir)
if(qt_imports_dir)
set(QT_IMPORTS_DIR NOTFOUND)
+ set(qt_cross_paths)
foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports")
endforeach()
@@ -738,6 +745,10 @@ if (QT_QMAKE_EXECUTABLE AND
NO_CMAKE_FIND_ROOT_PATH
NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH)
+ # If the imports folder is empty, set QT_IMPORTS_DIR to ${qt_imports_dir}
+ if(NOT QT_IMPORTS_DIR AND qt_imports_dir)
+ set(QT_IMPORTS_DIR ${qt_imports_dir} CACHE PATH "The location of the Qt imports")
+ endif()
mark_as_advanced(QT_IMPORTS_DIR)
endif()
endif ()
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index e08afe4..e21ec38 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -751,7 +751,7 @@ else()
#-----------------------------------------------------------------
# Support cross-compiling, only search in the target platform.
find_program(wxWidgets_CONFIG_EXECUTABLE
- NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
+ NAMES $ENV{WX_CONFIG} wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
DOC "Location of wxWidgets library configuration provider binary (wx-config)."
ONLY_CMAKE_FIND_ROOT_PATH
)
@@ -964,8 +964,9 @@ find_package_handle_standard_args(wxWidgets
#=====================================================================
# Resource file compiler.
-find_program(wxWidgets_wxrc_EXECUTABLE wxrc
- ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw
+find_program(wxWidgets_wxrc_EXECUTABLE
+ NAMES $ENV{WXRC_CMD} wxrc
+ PATHS ${wxWidgets_ROOT_DIR}/utils/wxrc/vc_msw
DOC "Location of wxWidgets resource file compiler binary (wxrc)"
)
diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake
index 054a1bf..115cdc6 100644
--- a/Modules/FindwxWindows.cmake
+++ b/Modules/FindwxWindows.cmake
@@ -617,7 +617,8 @@ else()
# wx-config should be in your path anyhow, usually no need to set WXWIN or
# search in ../wx or ../../wx
- find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
+ find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
+ NAMES $ENV{WX_CONFIG} wx-config
HINTS
ENV WXWIN
$ENV{WXWIN}/bin
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index 41bd1dc..3d47367 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -361,9 +361,32 @@ function(gtest_discover_tests TARGET)
set(_TEST_LIST ${TARGET}_TESTS)
endif()
+ get_property(
+ has_counter
+ TARGET ${TARGET}
+ PROPERTY CTEST_DISCOVERED_TEST_COUNTER
+ SET
+ )
+ if(has_counter)
+ get_property(
+ counter
+ TARGET ${TARGET}
+ PROPERTY CTEST_DISCOVERED_TEST_COUNTER
+ )
+ math(EXPR counter "${counter} + 1")
+ else()
+ set(counter 1)
+ endif()
+ set_property(
+ TARGET ${TARGET}
+ PROPERTY CTEST_DISCOVERED_TEST_COUNTER
+ ${counter}
+ )
+
# Define rule to generate test list for aforementioned test executable
- set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include.cmake")
- set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests.cmake")
+ set(ctest_file_base "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}[${counter}]")
+ set(ctest_include_file "${ctest_file_base}_include.cmake")
+ set(ctest_tests_file "${ctest_file_base}_tests.cmake")
get_property(crosscompiling_emulator
TARGET ${TARGET}
PROPERTY CROSSCOMPILING_EMULATOR
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 1ba4877..38e0861 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -594,8 +594,11 @@ if(_IRSL_HAVE_Intel)
endif()
if(WIN32)
set(__install_dirs "${_Intel_redistdir}/1033")
+ if(EXISTS "${_Intel_redistdir}/1041")
+ list(APPEND __install_dirs "${_Intel_redistdir}/1041")
+ endif()
if(_Intel_compiler_ver VERSION_LESS 18)
- list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c" "${_Intel_redistdir}/1041")
+ list(APPEND __install_dirs "${_Intel_redistdir}/irml" "${_Intel_redistdir}/irml_c")
endif()
foreach(__Intel_lib IN ITEMS cilkrts20.dll libchkp.dll libgfxoffload.dll libioffload_host.dll libirngmd.dll
libmmd.dll libmmdd.dll libmpx.dll liboffload.dll svml_dispmd.dll)
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 7c9467a..2f7c80a 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -11,7 +11,7 @@
#
# WRITE_BASIC_CONFIG_VERSION_FILE( filename
# [VERSION major.minor.patch]
-# COMPATIBILITY (AnyNewerVersion|SameMajorVersion)
+# COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion)
# )
#
#
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index eaa4679..b87a1b1 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 10)
-set(CMake_VERSION_PATCH 20171120)
+set(CMake_VERSION_PATCH 20171127)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7519ef7..a9de3f5 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3336,13 +3336,6 @@ cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
return this->GlobalGenerator;
}
-void cmMakefile::GetTestNames(std::vector<std::string>& testNames)
-{
- for (const auto& iter : Tests) {
- testNames.push_back(iter.first);
- }
-}
-
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* cmMakefile::GetVariableWatch() const
{
@@ -3678,6 +3671,16 @@ cmTest* cmMakefile::GetTest(const std::string& testName) const
return nullptr;
}
+void cmMakefile::GetTests(const std::string& config,
+ std::vector<cmTest*>& tests)
+{
+ for (auto generator : this->GetTestGenerators()) {
+ if (generator->TestsForConfig(config)) {
+ tests.push_back(generator->GetTest());
+ }
+ }
+}
+
void cmMakefile::AddCMakeDependFilesFromUser()
{
std::vector<std::string> deps;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0540a6c..737cab9 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -624,11 +624,6 @@ public:
cmGlobalGenerator* GetGlobalGenerator() const;
/**
- * Get all the test names this makefile knows about
- */
- void GetTestNames(std::vector<std::string>& testNames);
-
- /**
* Get all the source files this makefile knows about
*/
const std::vector<cmSourceFile*>& GetSourceFiles() const
@@ -651,6 +646,11 @@ public:
cmTest* GetTest(const std::string& testName) const;
/**
+ * Get all tests that run under the given configuration.
+ */
+ void GetTests(const std::string& config, std::vector<cmTest*>& tests);
+
+ /**
* Return a location of a file in cmake or custom modules directory
*/
std::string GetModulesFile(const char* name) const;
diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h
index a0115b6..62dee11 100644
--- a/Source/cmServerDictionary.h
+++ b/Source/cmServerDictionary.h
@@ -91,7 +91,6 @@ static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories";
static const std::string kWATCHED_FILES_KEY = "watchedFiles";
static const std::string kHAS_INSTALL_RULE = "hasInstallRule";
static const std::string kINSTALL_PATHS = "installPaths";
-static const std::string kHAS_ENABLED_TESTS = "hasEnabledTests";
static const std::string kCTEST_NAME = "ctestName";
static const std::string kCTEST_COMMAND = "ctestCommand";
static const std::string kCTEST_INFO = "ctestInfo";
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 0bcfe48..cfac513 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -771,10 +771,10 @@ static void DumpBacktraceRange(Json::Value& result, const std::string& type,
}
}
-static Json::Value DumpCTestInfo(const std::string& name, cmTest* testInfo)
+static Json::Value DumpCTestInfo(cmTest* testInfo)
{
Json::Value result = Json::objectValue;
- result[kCTEST_NAME] = name;
+ result[kCTEST_NAME] = testInfo->GetName();
// Concat command entries together. After the first should be the arguments
// for the command
@@ -801,76 +801,17 @@ static Json::Value DumpCTestInfo(const std::string& name, cmTest* testInfo)
return result;
}
-static Json::Value DumpCTestTarget(cmGeneratorTarget* target,
- const std::string& config)
+static void DumpMakefileTests(cmMakefile* mf, const std::string& config,
+ Json::Value* result)
{
- cmLocalGenerator* lg = target->GetLocalGenerator();
- const cmState* state = lg->GetState();
-
- const cmStateEnums::TargetType type = target->GetType();
- const std::string typeName = state->GetTargetTypeName(type);
-
- Json::Value ttl = Json::arrayValue;
- ttl.append("EXECUTABLE");
- ttl.append("STATIC_LIBRARY");
- ttl.append("SHARED_LIBRARY");
- ttl.append("MODULE_LIBRARY");
- ttl.append("OBJECT_LIBRARY");
- ttl.append("UTILITY");
- ttl.append("INTERFACE_LIBRARY");
-
- if (!hasString(ttl, typeName) || target->IsImported()) {
- return Json::Value();
- }
-
- Json::Value result = Json::objectValue;
- result[kNAME_KEY] = target->GetName();
- result[kTYPE_KEY] = typeName;
-
- if (type == cmStateEnums::INTERFACE_LIBRARY) {
- return result;
- }
- result[kFULL_NAME_KEY] = target->GetFullName(config);
-
- if (target->Makefile->IsOn("CMAKE_TESTING_ENABLED")) {
- result[kHAS_ENABLED_TESTS] = true;
- std::vector<std::string> CTestNames;
-
- Json::Value testInfo = Json::arrayValue;
- std::vector<std::string> testNames;
- target->Makefile->GetTestNames(testNames);
- for (auto& name : testNames) {
- auto test = target->Makefile->GetTest(name);
- if (test != nullptr) {
- testInfo.append(DumpCTestInfo(name, test));
- }
- }
- result[kCTEST_INFO] = testInfo;
- }
-
- return result;
-}
-
-static Json::Value DumpCTestTargetsList(
- const std::vector<cmLocalGenerator*>& generators, const std::string& config)
-{
- Json::Value result = Json::arrayValue;
-
- std::vector<cmGeneratorTarget*> targetList;
- for (const auto& lgIt : generators) {
- auto list = lgIt->GetGeneratorTargets();
- targetList.insert(targetList.end(), list.begin(), list.end());
- }
- std::sort(targetList.begin(), targetList.end());
-
- for (cmGeneratorTarget* target : targetList) {
- Json::Value tmp = DumpCTestTarget(target, config);
+ std::vector<cmTest*> tests;
+ mf->GetTests(config, tests);
+ for (auto test : tests) {
+ Json::Value tmp = DumpCTestInfo(test);
if (!tmp.isNull()) {
- result.append(tmp);
+ result->append(tmp);
}
}
-
- return result;
}
static Json::Value DumpCTestProjectList(const cmake* cm,
@@ -884,11 +825,17 @@ static Json::Value DumpCTestProjectList(const cmake* cm,
Json::Value pObj = Json::objectValue;
pObj[kNAME_KEY] = projectIt.first;
- // All Projects must have at least one local generator
- assert(!projectIt.second.empty());
+ Json::Value tests = Json::arrayValue;
- // Project structure information:
- pObj[kTARGETS_KEY] = DumpCTestTargetsList(projectIt.second, config);
+ // Gather tests for every generator
+ for (const auto& lg : projectIt.second) {
+ // Make sure they're generated.
+ lg->GenerateTestFiles();
+ cmMakefile* mf = lg->GetMakefile();
+ DumpMakefileTests(mf, config, &tests);
+ }
+
+ pObj[kCTEST_INFO] = tests;
result.append(pObj);
}
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 78ca6bc..b548359 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -34,6 +34,16 @@ void cmTestGenerator::Compute(cmLocalGenerator* lg)
this->LG = lg;
}
+bool cmTestGenerator::TestsForConfig(const std::string& config)
+{
+ return this->GeneratesForConfig(config);
+}
+
+cmTest* cmTestGenerator::GetTest() const
+{
+ return this->Test;
+}
+
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, Indent indent)
{
// Create the tests.
diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h
index 1ca61c2..73d05a3 100644
--- a/Source/cmTestGenerator.h
+++ b/Source/cmTestGenerator.h
@@ -30,6 +30,11 @@ public:
void Compute(cmLocalGenerator* lg);
+ /** Test if this generator installs the test for a given configuration. */
+ bool TestsForConfig(const std::string& config);
+
+ cmTest* GetTest() const;
+
protected:
void GenerateScriptConfigs(std::ostream& os, Indent indent) override;
void GenerateScriptActions(std::ostream& os, Indent indent) override;
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 1a6f204..ac3df65 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -565,6 +565,84 @@ endif()
#######################
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake
+ VERSION 1.2.3.17
+ COMPATIBILITY SameMinorVersion)
+
+unset(PACKAGE_VERSION_UNSUITABLE)
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_FIND_VERSION 2.3.4)
+set(PACKAGE_FIND_VERSION_MAJOR 2)
+set(PACKAGE_FIND_VERSION_MINOR 3)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 2.3.4 was requested !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 0.0.1)
+set(PACKAGE_FIND_VERSION_MAJOR 0)
+set(PACKAGE_FIND_VERSION_MINOR 0)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 0.0.1 was requested !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.0.0)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 0)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Zot123 with version 1.2.3.17 (1.0.0 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.0)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.0 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3.17)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3.17 was requested) !")
+endif()
+if(NOT PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
+endif()
+
+if(PACKAGE_VERSION_UNSUITABLE)
+ message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
+endif()
+
+#######################
+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake
VERSION 1.2.3.17
COMPATIBILITY ExactVersion)
@@ -574,7 +652,7 @@ set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_FIND_VERSION 2.3.4)
include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
if(PACKAGE_VERSION_COMPATIBLE)
- message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !")
+ message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (2.3.4 was requested) !")
endif()
if(PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
@@ -583,7 +661,7 @@ endif()
set(PACKAGE_FIND_VERSION 1.2)
include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
if(PACKAGE_VERSION_COMPATIBLE)
- message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !")
+ message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1.2 was requested) !")
endif()
if(PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
@@ -592,7 +670,7 @@ endif()
set(PACKAGE_FIND_VERSION 1)
include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
if(PACKAGE_VERSION_COMPATIBLE)
- message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !")
+ message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1 was requested) !")
endif()
if(PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
@@ -601,7 +679,7 @@ endif()
set(PACKAGE_FIND_VERSION 1.2.3.4)
include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
if(NOT PACKAGE_VERSION_COMPATIBLE)
- message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !")
+ message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.4 was requested) !")
endif()
if(PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
@@ -612,19 +690,18 @@ set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
if(NOT PACKAGE_VERSION_COMPATIBLE)
- message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !")
+ message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3 was requested) !")
endif()
if(PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
endif()
-
set(PACKAGE_FIND_VERSION 1.2.3.17)
set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
if(NOT PACKAGE_VERSION_COMPATIBLE)
- message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !")
+ message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.17 was requested) !")
endif()
if(NOT PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt
index 5f7753d..5f7753d 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest-test-stdout.txt
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt
new file mode 100644
index 0000000..960c0b9
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt
@@ -0,0 +1,25 @@
+Test project .*
+ Start 9: TEST:basic\.case_foo!2
+1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec
+ Start 10: TEST:basic\.case_bar!2
+2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec
+ Start 11: TEST:basic\.disabled_case!2
+3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
+ Start 12: TEST:disabled\.case!2
+4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec
+ Start 13: TEST:typed/short\.case!2
+5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec
+ Start 14: TEST:typed/float\.case!2
+6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec
+ Start 15: TEST:value/test\.case/1!2
+7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec
+ Start 16: TEST:value/test\.case/"foo"!2
+8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec
+
+100% tests passed, 0 tests failed out of 6
+
+Total Test time \(real\) = +[0-9.]+ sec
+
+The following tests did not run:
+.*11 - TEST:basic\.disabled_case!2 \(Disabled\)
+.*12 - TEST:disabled\.case!2 \(Disabled\)
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
index 9a3677f..58f4196 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
@@ -11,5 +11,13 @@ gtest_discover_tests(
TEST_PREFIX TEST:
TEST_SUFFIX !1
EXTRA_ARGS how now "\"brown\" cow"
- PROPERTIES LABELS TEST
+ PROPERTIES LABELS TEST1
+)
+
+gtest_discover_tests(
+ fake_gtest
+ TEST_PREFIX TEST:
+ TEST_SUFFIX !2
+ EXTRA_ARGS how now "\"brown\" cow"
+ PROPERTIES LABELS TEST2
)
diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
index aec8568..b79af26 100644
--- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
@@ -15,10 +15,16 @@ function(run_GoogleTest)
--build .
--config Debug
)
- run_cmake_command(GoogleTest-test
+ run_cmake_command(GoogleTest-test1
${CMAKE_CTEST_COMMAND}
-C Debug
- -L TEST
+ -L TEST1
+ --no-label-summary
+ )
+ run_cmake_command(GoogleTest-test2
+ ${CMAKE_CTEST_COMMAND}
+ -C Debug
+ -L TEST2
--no-label-summary
)
endfunction()