summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/Compiler/Cray-C.cmake12
-rw-r--r--Modules/Compiler/Cray-CXX.cmake12
-rw-r--r--Modules/FindLibXml2.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmFileCommand.cxx2
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx5
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx6
-rw-r--r--Source/cmRulePlaceholderExpander.cxx5
-rw-r--r--Source/cmRulePlaceholderExpander.h1
-rw-r--r--Source/cmSystemTools.cxx14
-rw-r--r--Source/cmSystemTools.h7
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Source/cmcmd.cxx2
-rw-r--r--Source/kwsys/Glob.hxx.in14
-rw-r--r--Source/kwsys/hashtable.hxx.in2
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/RerunMocBasic/CMakeLists.txt98
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt144
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt33
-rw-r--r--Tests/QtAutogen/RerunRccDepends/CMakeLists.txt175
-rw-r--r--Tests/TryCompile/CMakeLists.txt29
-rw-r--r--Tests/TryCompile/check_a_b.c10
24 files changed, 346 insertions, 239 deletions
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index b3c96ee..d34154c 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -8,13 +8,13 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "-h noc99,conform")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-h noc99,gnu")
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "-h c99,conform")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-h c99,gnu")
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION -h noc99,conform)
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION -h noc99,gnu)
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION -h c99,conform)
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-h std=c11,conform")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-h std=c11,gnu")
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION -h std=c11,conform)
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu)
endif ()
endif ()
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index bbb5718..85a3167 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -8,15 +8,15 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-h conform")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-h gnu")
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform)
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-h std=c++11")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-h std=c++11,gnu")
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11)
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6)
- set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-h std=c++14")
- set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-h std=c++14,gnu")
+ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14)
+ set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu)
endif ()
endif ()
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 1a2af16..47c0e79 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -18,7 +18,7 @@ Result variables
This module will set the following variables in your project:
-``LIBXML2_FOUND``
+``LibXml2_FOUND``
true if libxml2 headers and libraries were found
``LIBXML2_INCLUDE_DIR``
the directory containing LibXml2 headers
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8330dc8..6af2c8e 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 14)
-set(CMake_VERSION_PATCH 20190214)
+set(CMake_VERSION_PATCH 20190218)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index bd110ec..eb52895 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -226,7 +226,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
} else if (doing == DoingCMakeFlags) {
cmakeFlags.push_back(argv[i]);
} else if (doing == DoingCompileDefinitions) {
- compileDefs.push_back(argv[i]);
+ cmSystemTools::ExpandListArgument(argv[i], compileDefs);
} else if (doing == DoingLinkOptions) {
linkOptions.push_back(argv[i]);
} else if (doing == DoingLinkLibraries) {
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 12f1cbb..96c9e15 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3759,7 +3759,7 @@ bool cmFileCommand::HandleCreateLinkCommand(
// Check if copy-on-error is enabled in the arguments.
if (!completed && copyOnErrorArg.IsEnabled()) {
- completed = cmSystemTools::cmCopyFile(fileName, newFileName);
+ completed = cmsys::SystemTools::CopyFileAlways(fileName, newFileName);
if (!completed) {
result = "Copy failed: " + cmSystemTools::GetLastSystemError();
}
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 12d9304..913fc4a 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -453,7 +453,8 @@ bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
"Windows Kits\\Installed Roots;KitsRoot81",
win81Root, cmSystemTools::KeyWOW64_32)) {
- return cmSystemTools::FileExists(win81Root + "/um/windows.h", true);
+ return cmSystemTools::FileExists(win81Root + "/include/um/windows.h",
+ true);
}
return false;
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 998729f..8d2586d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -454,6 +454,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
if (lang == "Swift") {
vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES";
vars.SwiftModuleName = "$SWIFT_MODULE_NAME";
+ vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME";
}
// For some cases we do an explicit preprocessor invocation.
@@ -940,6 +941,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
} else {
vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName();
}
+
+ cmGeneratorTarget::Names targetNames =
+ this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
+ vars["SWIFT_LIBRARY_NAME"] = targetNames.Base;
}
if (!this->NeedDepTypeMSVC(language)) {
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index ddff4cf..2959b7d 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1020,20 +1020,20 @@ cmQtAutoGeneratorMocUic::WorkerT::~WorkerT()
void cmQtAutoGeneratorMocUic::WorkerT::LogInfo(
GeneratorT genType, std::string const& message) const
{
- return Log().Info(genType, message);
+ Log().Info(genType, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogWarning(
GeneratorT genType, std::string const& message) const
{
- return Log().Warning(genType, message);
+ Log().Warning(genType, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogFileWarning(
GeneratorT genType, std::string const& filename,
std::string const& message) const
{
- return Log().WarningFile(genType, filename, message);
+ Log().WarningFile(genType, filename, message);
}
void cmQtAutoGeneratorMocUic::WorkerT::LogError(
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index e347a2c..5ebdd1b 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -172,6 +172,11 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
return replaceValues.SwiftModuleName;
}
}
+ if (replaceValues.SwiftLibraryName) {
+ if (variable == "SWIFT_LIBRARY_NAME") {
+ return replaceValues.SwiftLibraryName;
+ }
+ }
if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
variable == "TARGET_INSTALLNAME_DIR") {
// All these variables depend on TargetSOName
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 5c03637..930eafd 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -60,6 +60,7 @@ public:
const char* FilterPrefix;
const char* SwiftAuxiliarySources;
const char* SwiftModuleName;
+ const char* SwiftLibraryName;
};
// Expand rule variables in CMake of the type found in language rules
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 276cb57..f0e8077 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -937,12 +937,6 @@ std::string cmSystemTools::FileExistsInParentDirectories(
return "";
}
-bool cmSystemTools::cmCopyFile(const std::string& source,
- const std::string& destination)
-{
- return Superclass::CopyFileAlways(source, destination);
-}
-
#ifdef _WIN32
cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry()
{
@@ -1390,14 +1384,6 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(std::string const& ext)
return cmSystemTools::UNKNOWN_FILE_FORMAT;
}
-bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
-{
- std::vector<std::string> temp;
- bool res = Superclass::Split(s, temp);
- l.insert(l.end(), temp.begin(), temp.end());
- return res;
-}
-
std::string cmSystemTools::ConvertToOutputPath(std::string const& path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index ba6de51..82e4f01 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -172,10 +172,6 @@ public:
static bool SimpleGlob(const std::string& glob,
std::vector<std::string>& files, int type = 0);
- ///! Copy a file.
- static bool cmCopyFile(const std::string& source,
- const std::string& destination);
-
/** Rename a file or directory within a single disk volume (atomic
if possible). */
static bool RenameFile(const std::string& oldname,
@@ -347,9 +343,6 @@ public:
cmDuration timeout, std::vector<char>& out,
std::vector<char>& err);
- /** Split a string on its newlines into multiple lines. Returns
- false only if the last line stored had no newline. */
- static bool Split(const char* s, std::vector<std::string>& l);
static void SetForceUnixPaths(bool v) { s_ForceUnixPaths = v; }
static bool GetForceUnixPaths() { return s_ForceUnixPaths; }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ff6b04b..dd29c0c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2354,7 +2354,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
outFile += "/CMakeLists.txt";
// Copy file
- if (!cmSystemTools::cmCopyFile(inFile, outFile)) {
+ if (!cmsys::SystemTools::CopyFileAlways(inFile, outFile)) {
std::cerr << "Error copying file \"" << inFile << "\" to \"" << outFile
<< "\".\n";
return 1;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4415ba6..21802ad 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -482,7 +482,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = false;
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
- if (!cmSystemTools::cmCopyFile(args[cc], args.back())) {
+ if (!cmsys::SystemTools::CopyFileAlways(args[cc], args.back())) {
std::cerr << "Error copying file \"" << args[cc] << "\" to \""
<< args.back() << "\".\n";
return_value = true;
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index bd4a176..4c3bde1 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -41,17 +41,9 @@ public:
, content(c)
{
}
- Message(const Message& msg)
- : type(msg.type)
- , content(msg.content)
- {
- }
- Message& operator=(Message const& msg)
- {
- this->type = msg.type;
- this->content = msg.content;
- return *this;
- }
+ ~Message() = default;
+ Message(const Message& msg) = default;
+ Message& operator=(Message const& msg) = default;
};
typedef std::vector<Message> GlobMessages;
diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in
index fc0d60e..0981c66 100644
--- a/Source/kwsys/hashtable.hxx.in
+++ b/Source/kwsys/hashtable.hxx.in
@@ -73,7 +73,7 @@ struct _Hashtable_node
void public_method_to_quiet_warning_about_all_methods_private();
private:
- void operator=(_Hashtable_node<_Val> const&); // poison node assignment
+ void operator=(_Hashtable_node<_Val> const&) = delete;
};
template <class _Val, class _Key, class _HashFcn, class _ExtractKey,
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 616092d..b584e16 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -128,7 +128,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
endif()
# for msvc the compiler version determines which c++11 features are available.
-if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
+ OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"))
if(";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
index f4b726f..9b32e59 100644
--- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
@@ -5,10 +5,48 @@ include("../AutogenCoreTest.cmake")
# Dummy executable to generate a clean target
add_executable(dummy dummy.cpp)
-set(timeformat "%Y%j%H%M%S")
+# Utility variables
+set(timeformat "%Y.%j.%H.%M%S")
set(mocBasicSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocBasic")
set(mocBasicBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocBasic")
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(acquire_timestamp When)
+ file(TIMESTAMP "${mocBasicBin}" time${When} "${timeformat}")
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocBasicBinDir}" RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+macro(require_change)
+ if (timeAfter VERSION_GREATER timeBefore)
+ message(STATUS "As expected the file ${mocBasicBin} changed.")
+ else()
+ message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} did not change!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
+ endif()
+endmacro()
+
+macro(require_change_not)
+ if (timeAfter VERSION_GREATER timeBefore)
+ message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} changed!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n")
+ else()
+ message(STATUS "As expected the file ${mocBasicBin} did not change.")
+ endif()
+endmacro()
+
+
# Initial build
configure_file("${mocBasicSrcDir}/test1a.h.in" "${mocBasicBinDir}/test1.h" COPYONLY)
try_compile(MOC_RERUN
@@ -21,46 +59,44 @@ try_compile(MOC_RERUN
OUTPUT_VARIABLE output
)
if (NOT MOC_RERUN)
- message(SEND_ERROR "Initial build of mocBasic failed. Output: ${output}")
+ message(FATAL_ERROR "Initial build of mocBasic failed. Output: ${output}")
endif()
+
# Get name of the output binary
file(STRINGS "${mocBasicBinDir}/mocBasic.txt" mocBasicList ENCODING UTF-8)
list(GET mocBasicList 0 mocBasicBin)
-message("Changing the header content for a MOC rerun")
-# - Acquire binary timestamps before the build
-file(TIMESTAMP "${mocBasicBin}" timeBefore "${timeformat}")
+# To avoid a race condition where the binary has the same timestamp
+# as a source file and therefore gets rebuild
+# - sleep to ensure a timestamp change
+# - touch binary to ensure it has a new timestamp
+acquire_timestamp(Before)
+sleep()
+message(STATUS "Touching binary file to ensure a new timestamps")
+file(TOUCH_NOCREATE "${mocBasicBin}")
+acquire_timestamp(After)
+require_change()
+
+
# - Ensure that the timestamp will change
-# - Change header file content and rebuild
+# - Change header file content
# - Rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+acquire_timestamp(Before)
+sleep()
+message(STATUS "Changing the header content for a MOC re-run")
configure_file("${mocBasicSrcDir}/test1b.h.in" "${mocBasicBinDir}/test1.h" COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocBasicBinDir}" RESULT_VARIABLE result )
-if (result)
- message(SEND_ERROR "Second build of mocBasic failed.")
-endif()
-# - Acquire binary timestamps after the build
-file(TIMESTAMP "${mocBasicBin}" timeAfter "${timeformat}")
-# - Test if timestamps changed
-if (NOT timeAfter GREATER timeBefore)
- message(SEND_ERROR "File (${mocBasicBin}) should have changed!")
-endif()
+sleep()
+rebuild(2)
+acquire_timestamp(After)
+require_change()
-message("Changing nothing for a MOC rerun")
-# - Acquire binary timestamps before the build
-file(TIMESTAMP "${mocBasicBin}" timeBefore "${timeformat}")
# - Ensure that the timestamp would change
# - Change nothing
# - Rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocBasicBinDir}" RESULT_VARIABLE result )
-if (result)
- message(SEND_ERROR "Third build of mocBasic failed.")
-endif()
-# - Acquire binary timestamps after the build
-file(TIMESTAMP "${mocBasicBin}" timeAfter "${timeformat}")
-# - Test if timestamps changed
-if (timeAfter GREATER timeBefore)
- message(SEND_ERROR "File (${mocBasicBin}) should not have changed!")
-endif()
+acquire_timestamp(Before)
+sleep()
+message(STATUS "Changing nothing for no MOC re-run")
+rebuild(3)
+acquire_timestamp(After)
+require_change_not()
diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
index b83e994..e1951f1 100644
--- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
@@ -9,10 +9,53 @@ include("../AutogenCoreTest.cmake")
add_executable(dummy dummy.cpp)
# Utility variables
-set(timeformat "%Y%j%H%M%S")
+set(timeformat "%Y.%j.%H.%M%S")
set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocPlugin")
set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocPlugin")
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName}.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}" RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} failed.")
+ else()
+ message(STATUS "Build ${buildName} finished.")
+ endif()
+endmacro()
+
+macro(require_change PLG)
+ if (pl${PLG}After VERSION_GREATER pl${PLG}Before)
+ message(STATUS "As expected the file ${pl${PLG}File} changed.")
+ else()
+ message(SEND_ERROR
+ "Unexpectedly the file ${pl${PLG}File} did not change!\nTimestamp pre: ${pl${PLG}Before}\nTimestamp aft: ${pl${PLG}After}\n")
+ endif()
+endmacro()
+
+macro(require_change_not PLG)
+ if (pl${PLG}After VERSION_GREATER pl${PLG}Before)
+ message(SEND_ERROR
+ "Unexpectedly the file ${pl${PLG}File} changed!\nTimestamp pre: ${pl${PLG}Before}\nTimestamp aft: ${pl${PLG}After}\n")
+ else()
+ message(STATUS "As expected the file ${pl${PLG}File} did not change.")
+ endif()
+endmacro()
+
+macro(acquire_timestamps When)
+ file(TIMESTAMP "${plAFile}" plA${When} "${timeformat}")
+ file(TIMESTAMP "${plBFile}" plB${When} "${timeformat}")
+ file(TIMESTAMP "${plCFile}" plC${When} "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plD${When} "${timeformat}")
+ file(TIMESTAMP "${plEFile}" plE${When} "${timeformat}")
+endmacro()
+
+
# Initial build
try_compile(MOC_PLUGIN
"${mocPlugBinDir}"
@@ -24,83 +67,68 @@ try_compile(MOC_PLUGIN
OUTPUT_VARIABLE output
)
if (NOT MOC_PLUGIN)
- message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
+ message(FATAL_ERROR "Initial build of mocPlugin failed. Output: ${output}")
endif()
+# Get names of the output binaries
find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
find_library(plEFile "PlugE" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+# To avoid a race condition where the library has the same timestamp
+# as a source file and therefore gets rebuild
+# - sleep to ensure a timestamp change
+# - rebuild library to ensure it has a new timestamp
+sleep()
+message(STATUS "Rebuilding library files to ensure new timestamps")
+rebuild(1)
+
+
# - Ensure that the timestamp will change.
# - Change the json files referenced by Q_PLUGIN_METADATA
# - Rebuild
-file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
-file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
-file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
-file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
-file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}")
-
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Changing json files.")
configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/StyleE.json")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
-
-file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
-file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
-file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
-file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
-file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}")
-
-if (plAAfter GREATER plABefore)
- message(SEND_ERROR "file (${plAFile}) should not have changed!")
-endif()
-if (plBAfter GREATER plBBefore)
- message(SEND_ERROR "file (${plBFile}) should not have changed!")
-endif()
-if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
-endif()
-if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
-endif()
-if (NOT plEAfter GREATER plEBefore)
- # There's a bug in Ninja on Windows
- # https://gitlab.kitware.com/cmake/cmake/issues/16776
- if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
- message(SEND_ERROR "file (${plEFile}) should have changed!")
- endif()
+sleep()
+rebuild(2)
+acquire_timestamps(After)
+# Test changes
+require_change_not(A)
+require_change_not(B)
+require_change(C)
+require_change(D)
+# There's a bug in Ninja on Windows:
+# https://gitlab.kitware.com/cmake/cmake/issues/16776
+if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
+ require_change(E)
endif()
+
# - Ensure that the timestamp will change.
# - Change the json files referenced by A_CUSTOM_MACRO
# - Rebuild
-file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
-file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
-file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}")
-
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Changing json files")
configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleE_Custom.json")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
-
-file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
-file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
-file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}")
-
-if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
-endif()
-if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
-endif()
-if (NOT plEAfter GREATER plEBefore)
- # There's a bug in Ninja on Windows
- # https://gitlab.kitware.com/cmake/cmake/issues/16776
- if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
- message(SEND_ERROR "file (${plEFile}) should have changed!")
- endif()
+sleep()
+rebuild(3)
+acquire_timestamps(After)
+# Test changes
+require_change_not(A)
+require_change_not(B)
+require_change(C)
+require_change(D)
+# There's a bug in Ninja on Windows
+# https://gitlab.kitware.com/cmake/cmake/issues/16776
+if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
+ require_change(E)
endif()
diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
index dcb7a79..33c01ac 100644
--- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
@@ -9,10 +9,23 @@ add_executable(dummy dummy.cpp)
# When a .qrc or a file listed in a .qrc file changes,
# the target must be rebuilt
-set(timeformat "%Y%j%H%M%S")
set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccConfigChange")
set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccConfigChange")
+# Rebuild macro
+macro(rebuild CFG)
+ message(STATUS "Rebuilding rccConfigChange in ${CFG} configuration.")
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" --build . --config "${CFG}"
+ WORKING_DIRECTORY "${rccDepBD}"
+ RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "${CFG} build of rccConfigChange failed.")
+ else()
+ message(STATUS "${CFG} build of rccConfigChange finished.")
+ endif()
+endmacro()
+
# Initial build
try_compile(RCC_DEPENDS
"${rccDepBD}"
@@ -24,19 +37,11 @@ try_compile(RCC_DEPENDS
OUTPUT_VARIABLE output
)
if (NOT RCC_DEPENDS)
- message(SEND_ERROR "Initial build of rccConfigChange failed. Output: ${output}")
+ message(FATAL_ERROR "Initial build of rccConfigChange failed. Output: ${output}")
endif()
-# - Rebuild Release
-message("Rebuilding rccConfigChange in Release configuration")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config Release WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Release build of rccConfigChange failed.")
-endif()
+# Rebuild: Release
+rebuild(Release)
-# - Rebuild Debug
-message("Rebuilding rccConfigChange in Debug configuration")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . --config Debug WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Debug build of rccConfigChange failed.")
-endif()
+# Rebuild: Debug
+rebuild(Debug)
diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
index 80c5cf0..1301550 100644
--- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
@@ -3,19 +3,63 @@ project(RerunRccDepends)
include("../AutogenCoreTest.cmake")
# Tests rcc rebuilding when a resource file changes
+# When a .qrc or a file listed in a .qrc file changes,
+# the target must be rebuilt
# Dummy executable to generate a clean target
add_executable(dummy dummy.cpp)
-# When a .qrc or a file listed in a .qrc file changes,
-# the target must be rebuilt
-set(timeformat "%Y%j%H%M%S")
+# Utility variables
+set(timeformat "%Y.%j.%H.%M%S")
set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccDepends")
set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccDepends")
-# Initial build
+# Utility macros
+macro(sleep)
+ message(STATUS "Sleeping for a few seconds.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+endmacro()
+
+macro(acquire_timestamps When)
+ file(TIMESTAMP "${rccDepBinPlain}" rdPlain${When} "${timeformat}")
+ file(TIMESTAMP "${rccDepBinGenerated}" rdGenerated${When} "${timeformat}")
+endmacro()
+
+macro(rebuild buildName)
+ message(STATUS "Starting build ${buildName} of rccDepends.")
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" --build .
+ WORKING_DIRECTORY "${rccDepBD}"
+ RESULT_VARIABLE result)
+ if (result)
+ message(FATAL_ERROR "Build ${buildName} of rccDepends failed.")
+ else()
+ message(STATUS "Build ${buildName} of rccDepends finished.")
+ endif()
+endmacro()
+
+macro(require_change type)
+ if (rd${type}After VERSION_GREATER rd${type}Before)
+ message(STATUS "As expected the ${type} .qrc file ${rccDepBin${type}} changed.")
+ else()
+ message(SEND_ERROR "Unexpectedly the ${type} .qrc file ${rccDepBin${type}} did not change!\nTimestamp pre: ${rd${type}Before}\nTimestamp aft: ${rd${type}After}\n")
+ endif()
+endmacro()
+
+macro(require_change_not type)
+ if (rd${type}After VERSION_GREATER rd${type}Before)
+ message(SEND_ERROR "Unexpectedly the ${type} .qrc file ${rccDepBin${type}} changed!\nTimestamp pre: ${rd${type}Before}\nTimestamp aft: ${rd${type}After}\n")
+ else()
+ message(STATUS "As expected the ${type} .qrc file ${rccDepBin${type}} did not change.")
+ endif()
+endmacro()
+
+
+# Initial configuration
configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY)
configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY)
+
+# Initial build
try_compile(RCC_DEPENDS
"${rccDepBD}"
"${rccDepSD}"
@@ -26,113 +70,84 @@ try_compile(RCC_DEPENDS
OUTPUT_VARIABLE output
)
if (NOT RCC_DEPENDS)
- message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
+ message(FATAL_ERROR "Initial build of rccDepends failed. Output: ${output}")
endif()
# Get name of the output binaries
file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8)
file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8)
list(GET targetListPlain 0 rccDepBinPlain)
-list(GET targetListGen 0 rccDepBinGen)
-message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}")
-message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}")
+list(GET targetListGen 0 rccDepBinGenerated)
+message(STATUS "Target that uses a plain .qrc file is:\n ${rccDepBinPlain}")
+message(STATUS "Target that uses a GENERATED .qrc file is:\n ${rccDepBinGenerated}")
+
+# To avoid a race condition where the binary has the same timestamp
+# as a source file and therefore gets rebuild
+# - sleep to ensure a timestamp change
+# - touch binary to ensure it has a new timestamp
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Touching binary files to ensure new timestamps")
+file(TOUCH_NOCREATE "${rccDepBinPlain}" "${rccDepBinGenerated}")
+acquire_timestamps(After)
+require_change(Plain)
+require_change(Generated)
-message("Changing a resource files listed in the .qrc file")
-# - Acquire binary timestamps before the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
# - Ensure that the timestamp will change
# - Change a resource files listed in the .qrc file
# - Rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Changing a resource file listed in the .qrc file")
file(TOUCH "${rccDepBD}/resPlain/input.txt" "${rccDepBD}/resGen/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Second build of rccDepends failed.")
-endif()
-# - Acquire binary timestamps after the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+sleep()
+rebuild(2)
+acquire_timestamps(After)
# - Test if timestamps changed
-if (NOT rdPlainAfter GREATER rdPlainBefore)
- message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
-endif()
-if (NOT rdGenAfter GREATER rdGenBefore)
- message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
-endif()
+require_change(Plain)
+require_change(Generated)
-message("Changing the .qrc file")
-# - Acquire binary timestamps before the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
# - Ensure that the timestamp will change
# - Change the .qrc file
# - Rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Changing the .qrc file")
configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY)
configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Third build of rccDepends failed.")
-endif()
-# - Acquire binary timestamps after the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+sleep()
+rebuild(3)
+acquire_timestamps(After)
# - Test if timestamps changed
-if (NOT rdPlainAfter GREATER rdPlainBefore)
- message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
-endif()
-if (NOT rdGenAfter GREATER rdGenBefore)
- message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
-endif()
+require_change(Plain)
+require_change(Generated)
-message("Changing a newly added resource files listed in the .qrc file")
-# - Acquire binary timestamps before the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
# - Ensure that the timestamp will change
# - Change a newly added resource files listed in the .qrc file
# - Rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Changing a newly added resource file listed in the .qrc file")
file(TOUCH "${rccDepBD}/resPlain/inputAdded.txt" "${rccDepBD}/resGen/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fourth build of rccDepends failed.")
-endif()
-# - Acquire binary timestamps after the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+sleep()
+rebuild(4)
+acquire_timestamps(After)
# - Test if timestamps changed
-if (NOT rdPlainAfter GREATER rdPlainBefore)
- message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
-endif()
-if (NOT rdGenAfter GREATER rdGenBefore)
- message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
-endif()
+require_change(Plain)
+require_change(Generated)
-message("Changing nothing in the .qrc file")
-# - Acquire binary timestamps before the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
# - Ensure that the timestamp will change
# - Change nothing
# - Rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fifth build of rccDepends failed.")
-endif()
-# - Acquire binary timestamps after the build
-file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
-file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+acquire_timestamps(Before)
+sleep()
+message(STATUS "Changing nothing in the .qrc file")
+rebuild(5)
+acquire_timestamps(After)
# - Test if timestamps changed
-if (rdPlainAfter GREATER rdPlainBefore)
- message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!")
-endif()
-if (rdGenAfter GREATER rdGenBefore)
- message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!")
-endif()
+require_change_not(Plain)
+require_change_not(Generated)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 184a7be..54e96a2 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -165,6 +165,35 @@ try_compile(TEST_INNER
OUTPUT_VARIABLE output)
TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
+try_compile(COMPILE_DEFINITIONS_LIST_EXPANDED
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ ${TryCompile_SOURCE_DIR}/check_a_b.c
+ OUTPUT_VARIABLE output
+ COMPILE_DEFINITIONS "-DDEF_A;-DDEF_B"
+ )
+if(COMPILE_DEFINITIONS_LIST_EXPANDED)
+ message(STATUS "COMPILE_DEFINITIONS list expanded correctly")
+else()
+ string(REPLACE "\n" "\n " output " ${output}")
+ message(SEND_ERROR "COMPILE_DEFINITIONS list did not expand correctly\n${output}")
+endif()
+
+try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE output
+ COMPILE_DEFINITIONS "bad#source.c"
+ )
+if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles")
+ string(REPLACE "\n" "\n " output " ${output}")
+ message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}")
+elseif(NOT output MATCHES [[(bad#source\.c|bad\\)]])
+ string(REPLACE "\n" "\n " output " ${output}")
+ message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}")
+else()
+ message(STATUS "try_compile with bad#source.c correctly failed")
+endif()
+
add_executable(TryCompile pass.c)
######################################
diff --git a/Tests/TryCompile/check_a_b.c b/Tests/TryCompile/check_a_b.c
new file mode 100644
index 0000000..05fba0f
--- /dev/null
+++ b/Tests/TryCompile/check_a_b.c
@@ -0,0 +1,10 @@
+#ifndef DEF_A
+# error DEF_A not defined
+#endif
+#ifndef DEF_B
+# error DEF_B not defined
+#endif
+int main()
+{
+ return 0;
+}