-install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMAKE_XDGDATA_DIR}/vim/vimfiles)
-install(FILES cmake-mode.el DESTINATION ${CMAKE_XDGDATA_DIR}/emacs/site-lisp)
+# Install Vim files to a typical system integration directory.
+# Packagers can set CMake_INSTALL_VIMFILES_DIR to control this.
+if(NOT CMake_INSTALL_VIMFILES_DIR)
+ set(CMake_INSTALL_VIMFILES_DIR ${CMAKE_XDGDATA_DIR}/vim/vimfiles)
+endif()
+install(DIRECTORY vim/indent vim/syntax DESTINATION ${CMake_INSTALL_VIMFILES_DIR})
+
+# Install Emacs files to a typical system integration directory.
+# Packagers can set CMake_INSTALL_EMACS_DIR to control this.
+if(NOT CMake_INSTALL_EMACS_DIR)
+ set(CMake_INSTALL_EMACS_DIR ${CMAKE_XDGDATA_DIR}/emacs/site-lisp)
+endif()
+install(FILES cmake-mode.el DESTINATION ${CMake_INSTALL_EMACS_DIR})
+
install(FILES cmake.m4 DESTINATION ${CMAKE_XDGDATA_DIR}/aclocal)
add_subdirectory (bash-completion)
# with) as well as a simple installation by a local user into their home
# directory *if* the prefix is `$HOME/.local` since `.local/share/` is part of
# the bash-completion search path too.
-# For more complex installations, packagers can set CMAKE_BASH_COMP_DIR to
-# another system location.
+# For more complex installations, packagers can set CMake_INSTALL_BASH_COMP_DIR
+# to another system location.
-set(CMAKE_BASH_COMP_DIR_DEFAULT ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
-if (NOT CMAKE_BASH_COMP_DIR)
- set(CMAKE_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR_DEFAULT}")
+if(NOT CMake_INSTALL_BASH_COMP_DIR)
+ if(CMAKE_BASH_COMP_DIR)
+ # Honor previous customization option.
+ set(CMake_INSTALL_BASH_COMP_DIR "${CMAKE_BASH_COMP_DIR}")
+ else()
+ # Default.
+ set(CMake_INSTALL_BASH_COMP_DIR ${CMAKE_XDGDATA_DIR}/bash-completion/completions)
+ endif()
endif()
-install(FILES cmake cpack ctest DESTINATION ${CMAKE_BASH_COMP_DIR})
+install(FILES cmake cpack ctest DESTINATION ${CMake_INSTALL_BASH_COMP_DIR})
[WORKING_DIRECTORY <dir>]
[COMMAND_EXPAND_LISTS])
-Adds a test called ``<name>``. The test name may contain arbitrary
-characters except for double-quotes. However, if it contains spaces
-or semicolons it must be enclosed in double-quotes. The options are:
+Adds a test called ``<name>``. The test name may not contain spaces,
+quotes, or other characters special in CMake syntax. The options are:
``COMMAND``
Specify the test command-line. If ``<command>`` specifies an
List of post-exclude regexes through which to filter the names of resolved
dependencies.
-These arguments can be used to blacklist unwanted system libraries when
-resolving the dependencies, or to whitelist libraries from a specific
+These arguments can be used to exclude unwanted system libraries when
+resolving the dependencies, or to include libraries from a specific
directory. The filtering works as follows:
1. If the not-yet-resolved dependency matches any of the
* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object gained
a new ``precompileHeaders`` field in the ``compileGroups`` objects.
+
+Updates
+=======
+
+Changes made since CMake 3.18.0 include the following.
+
+3.18.1
+------
+
+* The :generator:`Xcode` generator, when :variable:`CMAKE_OSX_ARCHITECTURES`
+ is not defined, now selects ``$(NATIVE_ARCH_ACTUAL)`` as the default
+ architecture (the Xcode ``ARCHS`` setting). This is needed for Xcode 12
+ to select the host's architecture, which older versions of Xcode did
+ by default.
+
+* In CMake 3.18.0 the :command:`add_test` command learned to support
+ special characters in test names. This was accidentally left out of
+ its release notes. Unfortunately the fix breaks existing projects
+ that were using manual quoting or escaping to work around the prior
+ limitation. This fix has been reverted in 3.18.1, but may be
+ re-introduced in future versions of CMake with a policy for compatibility.
OUTPUT_VARIABLE _cmake_sysroot_run_out
ERROR_VARIABLE _cmake_sysroot_run_err)
- if(_cmake_sysroot_run_out AND NOT _cmake_sysroot_run_err AND IS_DIRECTORY "${_cmake_sysroot_run_out}/usr")
+ if(_cmake_sysroot_run_out AND NOT _cmake_sysroot_run_err
+ AND NOT _cmake_sysroot_run_out STREQUAL "/"
+ AND IS_DIRECTORY "${_cmake_sysroot_run_out}/usr")
file(TO_CMAKE_PATH "${_cmake_sysroot_run_out}/usr" _cmake_sysroot_run_out_usr)
set(CMAKE_${lang}_COMPILER_SYSROOT "${_cmake_sysroot_run_out_usr}" PARENT_SCOPE)
else()
set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";")
endif()
endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]")
+ # When targeting macOS, use only the host architecture.
+ set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]])
+ else()
+ set(id_archs "")
+ endif()
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
# can be attempted.
macro(cmake_record_${lang}_compile_features)
list(APPEND CMAKE_${lang}_COMPILE_FEATURES
- ${lang}_std_98
- ${lang}_std_11
- ${lang}_std_14
- ${lang}_std_17
- ${lang}_std_20
+ cxx_std_98
+ cxx_std_11
+ cxx_std_14
+ cxx_std_17
+ cxx_std_20
)
_record_compiler_features(${lang} "" CMAKE_${lang}_COMPILE_FEATURES)
endmacro()
CODE_SIGNING_REQUIRED = NO;
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .;
+ @id_archs@
@id_toolset@
@id_lang_version@
@id_clang_cxx_library@
message(FATAL_ERROR "Tag for git checkout should not be empty.")
endif()
- set(git_clone_options "--no-checkout")
+ if(GIT_VERSION_STRING VERSION_LESS 2.20 OR 2.21 VERSION_LESS_EQUAL GIT_VERSION_STRING)
+ set(git_clone_options "--no-checkout")
+ else()
+ set(git_clone_options)
+ endif()
if(git_shallow)
if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.10)
list(APPEND git_clone_options "--depth 1 --no-single-branch")
endif()
foreach(component IN LISTS CURL_FIND_COMPONENTS)
list(FIND CURL_KNOWN_PROTOCOLS ${component} _found)
- if(_found)
+ if(NOT _found EQUAL -1)
list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found)
- if(_found)
+ if(NOT _found EQUAL -1)
set(CURL_${component}_FOUND TRUE)
elseif(CURL_FIND_REQUIRED)
message(FATAL_ERROR "CURL: Required protocol ${component} is not found")
endif()
else()
list(FIND CURL_SUPPORTED_FEATURES ${component} _found)
- if(_found)
+ if(NOT _found EQUAL -1)
set(CURL_${component}_FOUND TRUE)
elseif(CURL_FIND_REQUIRED)
message(FATAL_ERROR "CURL: Required feature ${component} is not found")
function(_XalanC_GET_VERSION version_hdr)
file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XALAN_VERSION_.*")
if(_contents)
- string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}")
- string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}")
- string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}")
+ string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t(]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}")
+ string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t(]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}")
+ string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t(]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}")
if(NOT XalanC_MAJOR MATCHES "^[0-9]+$")
message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MAJOR!")
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 18)
-set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_PATCH 1)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[d421274e3e CMake 3.18.0]==])
+ set(git_info [==[63a65baf4c CMake 3.18.1]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
QSet<QCMakeProperty> oldProps = this->properties().toSet();
#else
- QSet<QCMakeProperty> oldProps = QSet<QCMakeProperty>(
- this->properties().begin(), this->properties().end());
+ QCMakePropertyList const& oldPropsList = this->properties();
+ QSet<QCMakeProperty> oldProps =
+ QSet<QCMakeProperty>(oldPropsList.begin(), oldPropsList.end());
#endif
oldProps.intersect(newProps);
newProps.subtract(oldProps);
for (const cmLinkImplItem& library : libraries->Libraries) {
if (const cmGeneratorTarget* dependency = library.Target) {
+ if (dependency->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ continue;
+ }
if (cm::contains(dependency->GetAllConfigCompileLanguages(),
"Swift")) {
EvaluatedTargetPropertyEntry entry{ library, library.Backtrace };
*/
for (auto& sg : groupFilesList) {
std::ostream* fout;
- bool useProjectFile = cmIsOn(*this->GeneratorTarget->GetProperty(
- "GHS_NO_SOURCE_GROUP_FILE")) ||
+ cmProp noSourceGroupFile =
+ this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE");
+ bool useProjectFile = (noSourceGroupFile && cmIsOn(*noSourceGroupFile)) ||
cmIsOn(this->Makefile->GetDefinition("CMAKE_GHS_NO_SOURCE_GROUP_FILE"));
if (useProjectFile || sg.empty()) {
fout = &fout_proj;
#include <cm/memory>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
return makeProgram;
}
+bool cmGlobalXCodeGenerator::SetSystemName(std::string const& s,
+ cmMakefile* mf)
+{
+ this->SystemName = s;
+ return this->cmGlobalGenerator::SetSystemName(s, mf);
+}
+
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
bool build, cmMakefile* mf)
{
if (archs.empty()) {
// Tell Xcode to use NATIVE_ARCH instead of ARCHS.
buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES"));
+ // When targeting macOS, use only the host architecture.
+ if (this->SystemName == "Darwin"_s &&
+ (!sysroot || !*sysroot ||
+ cmSystemTools::LowerCase(sysroot).find("macos") !=
+ std::string::npos)) {
+ buildSettings->AddAttribute("ARCHS",
+ this->CreateString("$(NATIVE_ARCH_ACTUAL)"));
+ }
} else {
// Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO).
buildSettings->AddAttribute("ARCHS", this->CreateString(archs));
}
if (this->Architectures.empty()) {
- // With no ARCHS we use ONLY_ACTIVE_ARCH.
+ // With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a
+ // platform-specific default ARCHS placeholder value.
// Look up the arch that Xcode chooses in this case.
if (const char* arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) {
this->ObjectDirArchDefault = arch;
if (this->XcodeVersion >= 100) {
xout.Element("key", "BuildSystemType");
xout.Element("string", "Original");
+ xout.Element("key", "DisableBuildSystemDeprecationWarning");
+ xout.Element("true");
}
if (hasGeneratedSchemes) {
xout.Element("key",
bool ShouldStripResourcePath(cmMakefile*) const override;
+ bool SetSystemName(std::string const& s, cmMakefile* mf) override;
bool SetGeneratorToolset(std::string const& ts, bool build,
cmMakefile* mf) override;
void AppendFlag(std::string& flags, std::string const& flag) const;
std::vector<std::string> Architectures;
std::string ObjectDirArchDefault;
std::string ObjectDirArch;
+ std::string SystemName;
std::string GeneratorToolset;
std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex;
};
return GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN;
}
}
+
+struct DependeesDir
+{
+ template <typename T>
+ static const cmLinkItem& src(const T& con)
+ {
+ return con.src;
+ }
+
+ template <typename T>
+ static const cmLinkItem& dst(const T& con)
+ {
+ return con.dst;
+ }
+};
+
+struct DependersDir
+{
+ template <typename T>
+ static const cmLinkItem& src(const T& con)
+ {
+ return con.dst;
+ }
+
+ template <typename T>
+ static const cmLinkItem& dst(const T& con)
+ {
+ return con.src;
+ }
+};
}
cmGraphVizWriter::cmGraphVizWriter(std::string const& fileName,
return;
}
+ // write global data directly
this->WriteConnection(this->GlobalFileStream, depender, dependee, scopeType);
if (this->GeneratePerTarget) {
- auto fileStream = PerTargetFileStreams[depender.AsStr()].get();
- this->WriteNode(*fileStream, dependee);
- this->WriteConnection(*fileStream, depender, dependee, scopeType);
+ PerTargetConnections[depender].emplace_back(depender, dependee, scopeType);
}
if (this->GenerateDependers) {
- auto fileStream = TargetDependersFileStreams[dependee.AsStr()].get();
- this->WriteNode(*fileStream, depender);
- this->WriteConnection(*fileStream, depender, dependee, scopeType);
+ TargetDependersConnections[dependee].emplace_back(dependee, depender,
+ scopeType);
}
}
}
}
+ // write global data and collect all connection data for per target graphs
for (auto const gt : sortedGeneratorTargets) {
auto item = cmLinkItem(gt, false, gt->GetBacktrace());
this->VisitItem(item);
}
+
+ if (this->GeneratePerTarget) {
+ WritePerTargetConnections<DependeesDir>(PerTargetConnections,
+ PerTargetFileStreams);
+ }
+
+ if (this->GenerateDependers) {
+ WritePerTargetConnections<DependersDir>(TargetDependersConnections,
+ TargetDependersFileStreams);
+ }
+}
+
+void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
+ const cmLinkItem& rootItem,
+ Connections& extendedCons,
+ std::set<cmLinkItem>& visitedItems)
+{
+ // some "targets" are not in map, e.g. linker flags as -lm or
+ // targets without dependency.
+ // in both cases we are finished with traversing the graph
+ if (connectionMap.find(rootItem) == connectionMap.cend()) {
+ return;
+ }
+
+ const Connections& origCons = connectionMap.at(rootItem);
+
+ for (const Connection& con : origCons) {
+ extendedCons.emplace_back(con);
+ const cmLinkItem& dstItem = con.dst;
+ bool const visited = visitedItems.find(dstItem) != visitedItems.cend();
+ if (!visited) {
+ visitedItems.insert(dstItem);
+ FindAllConnections(connectionMap, dstItem, extendedCons, visitedItems);
+ }
+ }
+}
+
+void cmGraphVizWriter::FindAllConnections(const ConnectionsMap& connectionMap,
+ const cmLinkItem& rootItem,
+ Connections& extendedCons)
+{
+ std::set<cmLinkItem> visitedItems = { rootItem };
+ FindAllConnections(connectionMap, rootItem, extendedCons, visitedItems);
+}
+
+template <typename DirFunc>
+void cmGraphVizWriter::WritePerTargetConnections(
+ const ConnectionsMap& connections, const FileStreamMap& streams)
+{
+ // the per target connections must be extended by indirect dependencies
+ ConnectionsMap extendedConnections;
+ for (auto const& conPerTarget : connections) {
+ const cmLinkItem& rootItem = conPerTarget.first;
+ Connections& extendedCons = extendedConnections[conPerTarget.first];
+ FindAllConnections(connections, rootItem, extendedCons);
+ }
+
+ for (auto const& conPerTarget : extendedConnections) {
+ const cmLinkItem& rootItem = conPerTarget.first;
+
+ // some of the nodes are excluded completely and are not written
+ if (this->ItemExcluded(rootItem)) {
+ continue;
+ }
+
+ const Connections& cons = conPerTarget.second;
+ auto fileStream = streams.at(rootItem.AsStr()).get();
+
+ for (const Connection& con : cons) {
+ const cmLinkItem& src = DirFunc::src(con);
+ const cmLinkItem& dst = DirFunc::dst(con);
+ this->WriteNode(*fileStream, con.dst);
+ this->WriteConnection(*fileStream, src, dst, con.scopeType);
+ }
+ }
}
void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs,
#include <map>
#include <memory>
+#include <set>
#include <string>
+#include <utility>
#include <vector>
#include "cmsys/RegularExpression.hxx"
#include "cmGeneratedFileStream.h"
+#include "cmLinkItem.h"
#include "cmLinkItemGraphVisitor.h"
#include "cmStateTypes.h"
-class cmLinkItem;
class cmGlobalGenerator;
/** This class implements writing files for graphviz (dot) for graphs
using FileStreamMap =
std::map<std::string, std::unique_ptr<cmGeneratedFileStream>>;
+ struct Connection
+ {
+ Connection(cmLinkItem s, cmLinkItem d, std::string scope)
+ : src(std::move(s))
+ , dst(std::move(d))
+ , scopeType(std::move(scope))
+ {
+ }
+
+ cmLinkItem src;
+ cmLinkItem dst;
+ std::string scopeType;
+ };
+ using Connections = std::vector<Connection>;
+ using ConnectionsMap = std::map<cmLinkItem, Connections>;
+
void VisitLink(cmLinkItem const& depender, cmLinkItem const& dependee,
bool isDirectLink, std::string const& scopeType = "");
cmLinkItem const& dependeeTargetName,
std::string const& edgeStyle);
+ void FindAllConnections(const ConnectionsMap& connectionMap,
+ const cmLinkItem& rootItem,
+ Connections& extendedCons,
+ std::set<cmLinkItem>& visitedItems);
+
+ void FindAllConnections(const ConnectionsMap& connectionMap,
+ const cmLinkItem& rootItem,
+ Connections& extendedCons);
+
+ template <typename DirFunc>
+ void WritePerTargetConnections(const ConnectionsMap& connections,
+ const FileStreamMap& streams);
+
bool ItemExcluded(cmLinkItem const& item);
bool ItemNameFilteredOut(std::string const& itemName);
bool TargetTypeEnabled(cmStateEnums::TargetType targetType) const;
FileStreamMap PerTargetFileStreams;
FileStreamMap TargetDependersFileStreams;
+ ConnectionsMap PerTargetConnections;
+ ConnectionsMap TargetDependersConnections;
+
std::string GraphName;
std::string GraphHeader;
std::string GraphNodePrefix;
{
target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
- sf->SetProperty("SKIP_AUTOGEN", "ON");
}
inline void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file,
static_cast<int>(cmSystemTools::CalculateCommandLineLengthLimit()) -
globalGen->GetRuleCmdLength(this->LanguageLinkerDeviceRule(config));
- build.RspFile = this->ConvertToNinjaPath(std::string("CMakeFiles/") +
- genTarget->GetName() + ".rsp");
+ std::string path = localGen.GetHomeRelativeOutputPath();
+ if (!path.empty()) {
+ path += '/';
+ }
+ build.RspFile = this->ConvertToNinjaPath(
+ cmStrCat(path, "CMakeFiles/", genTarget->GetName(),
+ globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp"));
// Gather order-only dependencies.
this->GetLocalGenerator()->AppendTargetDepends(
globalGen->GetRuleCmdLength(linkBuild.Rule);
}
- linkBuild.RspFile = this->ConvertToNinjaPath(std::string("CMakeFiles/") +
- gt->GetName() + ".rsp");
+ std::string path = localGen.GetHomeRelativeOutputPath();
+ if (!path.empty()) {
+ path += '/';
+ }
+ linkBuild.RspFile = this->ConvertToNinjaPath(
+ cmStrCat(path, "CMakeFiles/", gt->GetName(),
+ globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp"));
// Gather order-only dependencies.
this->GetLocalGenerator()->AppendTargetDepends(gt, linkBuild.OrderOnlyDeps,
#ifndef cmStandardLexer_h
#define cmStandardLexer_h
+#if defined(__linux)
+/* Needed for glibc < 2.12 */
+# define _XOPEN_SOURCE 600
+#endif
#if !defined(_WIN32) && !defined(__sun)
/* POSIX APIs are needed */
# define _POSIX_C_SOURCE 200809L
cmGeneratorExpression ge(this->Test->GetBacktrace());
// Start the test command.
- os << indent << "add_test(\"" << this->Test->GetName() << "\" ";
+ os << indent << "add_test(" << this->Test->GetName() << " ";
// Evaluate command line arguments
std::vector<std::string> argv =
os << ")\n";
// Output properties for the test.
- os << indent << "set_tests_properties(\"" << this->Test->GetName()
- << "\" PROPERTIES ";
+ os << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
for (auto const& i : this->Test->GetProperties().GetList()) {
os << " " << i.first << " "
<< cmOutputConverter::EscapeForCMake(
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent)
{
- os << indent << "add_test(\"" << this->Test->GetName()
- << "\" NOT_AVAILABLE)\n";
+ os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
}
bool cmTestGenerator::NeedsScriptNoConfig() const
std::string exe = command[0];
cmSystemTools::ConvertToUnixSlashes(exe);
- fout << indent << "add_test(\"" << this->Test->GetName() << "\" \"" << exe
- << "\"";
+ fout << indent;
+ fout << "add_test(";
+ fout << this->Test->GetName() << " \"" << exe << "\"";
for (std::string const& arg : cmMakeRange(command).advance(1)) {
// Just double-quote all arguments so they are re-parsed
clOptions.RemoveFlag("SpectreMitigation");
}
+ // Remove any target-wide -TC or -TP flag added by the project.
+ // Such flags are unnecessary and break our model of language selection.
+ if (langForClCompile == "C" || langForClCompile == "CXX") {
+ clOptions.RemoveFlag("CompileAs");
+ }
+
this->ClOptions[configName] = std::move(pOptions);
return true;
}
ADD_AUTOGEN_TEST(UicNoGui uicNoGui)
ADD_AUTOGEN_TEST(UicOnly uicOnly)
ADD_AUTOGEN_TEST(UicSkipSource)
+ADD_AUTOGEN_TEST(UnityMocSource)
if(QT_TEST_ALLOW_QT_MACROS)
ADD_AUTOGEN_TEST(MocCMP0071)
--- /dev/null
+cmake_minimum_required(VERSION 3.16)
+project(UnityMocSource)
+include("../AutogenGuiTest.cmake")
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_UNITY_BUILD ON)
+
+add_library(library library.cpp)
+target_link_libraries(library ${QT_LIBRARIES})
+
+add_executable(unityMocSource main.cpp)
+target_link_libraries(unityMocSource PRIVATE library)
--- /dev/null
+#include <QObject>
+class Test : public QObject
+{
+ Q_OBJECT
+};
+#include "library.moc"
--- /dev/null
+int main()
+{
+ return 0;
+}
endfunction()
function(check_for_setup_test)
- file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(\"setup_test\".*")
+ file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(setup_test.*")
if(NOT output_var)
set(RunCMake_TEST_FAILED "Could not find the test: setup_test" PARENT_SCOPE)
endif()
add_RunCMake_test(add_executable)
add_RunCMake_test(add_library)
add_RunCMake_test(add_subdirectory)
-add_RunCMake_test(add_test)
add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)
set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>)
set(error_details "There is a problem with generated test file: ${testfile}")
-if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
-if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
endif()
-if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
-if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
+if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
endif()
-if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
+if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
ensure_files_match(
${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_default_options.dot
${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot)
+
+ensure_files_match(
+ ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_target_dependencies.dot.GraphicApplication
+ ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot.GraphicApplication)
+
+ensure_files_match(
+ ${RunCMake_TEST_SOURCE_DIR}/expected_outputs/dependency_graph_target_dependers.dot.CompilerFlags.dependers
+ ${RunCMake_TEST_BINARY_DIR}/generated_dependency_graph.dot.CompilerFlags.dependers)
--- /dev/null
+digraph "GraphicApplication" {
+node [
+ fontsize = "12"
+];
+ "node5" [ label = "GraphicApplication", shape = egg ];
+ "node2" [ label = "CoreLibrary", shape = octagon ];
+ "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary
+ "node0" [ label = "CompilerFlags", shape = pentagon ];
+ "node2" -> "node0" // CoreLibrary -> CompilerFlags
+ "node3" [ label = "GoofyLoggingLibrary\n(SeriousLoggingLibrary)\n(TheBestLoggingLibrary)", shape = pentagon ];
+ "node2" -> "node3" [ style = dotted ] // CoreLibrary -> GoofyLoggingLibrary
+ "node6" [ label = "GraphicLibrary", shape = doubleoctagon ];
+ "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary
+ "node7" [ label = "\"-lm\"", shape = septagon ];
+ "node6" -> "node7" [ style = dotted ] // GraphicLibrary -> "-lm"
+ "node0" [ label = "CompilerFlags", shape = pentagon ];
+ "node6" -> "node0" // GraphicLibrary -> CompilerFlags
+ "node2" [ label = "CoreLibrary", shape = octagon ];
+ "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary
+ "node8" [ label = "GraphicLibraryObjects", shape = hexagon ];
+ "node6" -> "node8" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects
+}
--- /dev/null
+digraph "CompilerFlags" {
+node [
+ fontsize = "12"
+];
+ "node0" [ label = "CompilerFlags", shape = pentagon ];
+ "node2" [ label = "CoreLibrary", shape = octagon ];
+ "node2" -> "node0" // CoreLibrary -> CompilerFlags
+ "node1" [ label = "ConsoleApplication", shape = egg ];
+ "node1" -> "node2" [ style = dotted ] // ConsoleApplication -> CoreLibrary
+ "node5" [ label = "GraphicApplication", shape = egg ];
+ "node5" -> "node2" [ style = dotted ] // GraphicApplication -> CoreLibrary
+ "node6" [ label = "GraphicLibrary", shape = doubleoctagon ];
+ "node6" -> "node2" [ style = dotted ] // GraphicLibrary -> CoreLibrary
+ "node5" [ label = "GraphicApplication", shape = egg ];
+ "node5" -> "node6" [ style = dotted ] // GraphicApplication -> GraphicLibrary
+ "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ];
+ "node9" -> "node2" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary
+ "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
+ "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
+ "node6" [ label = "GraphicLibrary", shape = doubleoctagon ];
+ "node6" -> "node0" // GraphicLibrary -> CompilerFlags
+ "node9" [ label = "GraphicDriverOpenGL", shape = tripleoctagon ];
+ "node9" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags
+ "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
+ "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
+}
+++ /dev/null
-if (NOT DEFINED RUN_AS_SCRIPT)
-
- cmake_minimum_required(VERSION 3.7)
- project(@CASE_NAME@ NONE)
- include(CTest)
-
- # Two fallback tests for set_tests_properties.
- add_test(NAME PrefixTest COMMAND "${CMAKE_COMMAND}" --version)
- add_test(NAME SuffixTest COMMAND "${CMAKE_COMMAND}" --version)
-
- add_test(
- NAME @CASE_CMAKELISTS_NAME_1@
- COMMAND "${CMAKE_COMMAND}" -D RUN_AS_SCRIPT=1 -P "${CMAKE_CURRENT_LIST_FILE}"
- )
- set_tests_properties(
- @CASE_CMAKELISTS_NAME_2@
- PROPERTIES
- ENVIRONMENT CMAKE_add_test_ENVVAR=1
- )
-
-else()
-
- if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR})
- message(FATAL_ERROR "Setting property on test did not succeed!")
- endif()
-
-endif()
+++ /dev/null
-Test #[0-9]+: \[=\[BracketArgument;SuffixTest\]=\] \.+[ ]+Passed
+++ /dev/null
-Test #[0-9]+: BracketArgument;SuffixTest \.+[ ]+Passed
+++ /dev/null
-Error\(s\) when configuring the project
-No tests were found!!!
+++ /dev/null
-Error\(s\) when configuring the project
-No tests were found!!!
+++ /dev/null
-Unable to find executable: SuffixTest
+++ /dev/null
-Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
+++ /dev/null
-Unable to find executable: SuffixTest
+++ /dev/null
-Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
+++ /dev/null
-Unable to find executable: SuffixTest
+++ /dev/null
-Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
+++ /dev/null
-Unable to find executable: SuffixTest
+++ /dev/null
-Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run
+++ /dev/null
-Test #[0-9]+: \(\) # \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \(\) # \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \(\) # \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \(\) # \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: PrefixTest;SuffixTest \.+[ ]*Passed
+++ /dev/null
-Error\(s\) when configuring the project
-No tests were found!!!
+++ /dev/null
-3/3 Test #3: PrefixTest;SuffixTest \.+\*\*\*Failed.*
-CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\):
-[ ]*Setting property on test did not succeed!
+++ /dev/null
-Error\(s\) when configuring the project
-No tests were found!!!
+++ /dev/null
-Test #[0-9]+: PrefixTest SuffixTest \.+[ ]*Passed
+++ /dev/null
-Error\(s\) when configuring the project
-No tests were found!!!
+++ /dev/null
-3/3 Test #3: PrefixTest SuffixTest \.+\*\*\*Failed.*
-CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\):
-[ ]*Setting property on test did not succeed!
+++ /dev/null
-Error\(s\) when configuring the project
-No tests were found!!!
+++ /dev/null
-Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
+++ /dev/null
-Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed
+++ /dev/null
-include(RunCTest)
-
-set(ENV{CTEST_OUTPUT_ON_FAILURE} 1)
-
-function(run_NameIsAlphaNumeric1_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
- run_ctest(NameIsAlphaNumeric1)
-endfunction()
-run_NameIsAlphaNumeric1_test()
-
-function(run_NameIsAlphaNumeric2_test)
- set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
- run_ctest(NameIsAlphaNumeric2)
-endfunction()
-run_NameIsAlphaNumeric2_test()
-
-function(run_NameIsAlphaNumeric3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
- run_ctest(NameIsAlphaNumeric3)
-endfunction()
-run_NameIsAlphaNumeric3_test()
-
-function(run_NameIsAlphaNumeric4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
- run_ctest(NameIsAlphaNumeric4)
-endfunction()
-run_NameIsAlphaNumeric4_test()
-
-
-function(run_NameContainsValidSpecialChars1_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==])
- run_ctest(NameContainsValidSpecialChars1)
-endfunction()
-run_NameContainsValidSpecialChars1_test()
-
-function(run_NameContainsValidSpecialChars2_test)
- set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==])
- run_ctest(NameContainsValidSpecialChars2)
-endfunction()
-run_NameContainsValidSpecialChars2_test()
-
-function(run_NameContainsValidSpecialChars3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==])
- run_ctest(NameContainsValidSpecialChars3)
-endfunction()
-run_NameContainsValidSpecialChars3_test()
-
-function(run_NameContainsValidSpecialChars4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==])
- run_ctest(NameContainsValidSpecialChars4)
-endfunction()
-run_NameContainsValidSpecialChars4_test()
-
-
-function(run_NameContainsOtherSpecialChars1_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ !§$%&/ü:*😤~ ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ !§$%&/ü:*😤~ ]==])
- run_ctest(NameContainsOtherSpecialChars1)
-endfunction()
-run_NameContainsOtherSpecialChars1_test()
-
-function(run_NameContainsOtherSpecialChars2_test)
- set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==])
- run_ctest(NameContainsOtherSpecialChars2)
-endfunction()
-run_NameContainsOtherSpecialChars2_test()
-
-function(run_NameContainsOtherSpecialChars3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ !§$%&/ü:*😤~ ]==])
- run_ctest(NameContainsOtherSpecialChars3)
-endfunction()
-run_NameContainsOtherSpecialChars3_test()
-
-function(run_NameContainsOtherSpecialChars4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ !§$%&/ü:*😤~ ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==])
- run_ctest(NameContainsOtherSpecialChars4)
-endfunction()
-run_NameContainsOtherSpecialChars4_test()
-
-
-function(run_NameContainsEscapedSpecialChars1_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==])
- run_ctest(NameContainsEscapedSpecialChars1)
-endfunction()
-run_NameContainsEscapedSpecialChars1_test()
-
-function(run_NameContainsEscapedSpecialChars2_test)
- set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==])
- run_ctest(NameContainsEscapedSpecialChars2)
-endfunction()
-run_NameContainsEscapedSpecialChars2_test()
-
-function(run_NameContainsEscapedSpecialChars3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==])
- run_ctest(NameContainsEscapedSpecialChars3)
-endfunction()
-run_NameContainsEscapedSpecialChars3_test()
-
-function(run_NameContainsEscapedSpecialChars4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==])
- run_ctest(NameContainsEscapedSpecialChars4)
-endfunction()
-run_NameContainsEscapedSpecialChars4_test()
-
-
-function(run_NameContainsGeneratorExpressionSyntax1_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==])
- run_ctest(NameContainsGeneratorExpressionSyntax1)
-endfunction()
-run_NameContainsGeneratorExpressionSyntax1_test()
-
-function(run_NameContainsGeneratorExpressionSyntax2_test)
- set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==])
- run_ctest(NameContainsGeneratorExpressionSyntax2)
-endfunction()
-run_NameContainsGeneratorExpressionSyntax2_test()
-
-function(run_NameContainsGeneratorExpressionSyntax3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==])
- run_ctest(NameContainsGeneratorExpressionSyntax3)
-endfunction()
-run_NameContainsGeneratorExpressionSyntax3_test()
-
-function(run_NameContainsGeneratorExpressionSyntax4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==])
- run_ctest(NameContainsGeneratorExpressionSyntax4)
-endfunction()
-run_NameContainsGeneratorExpressionSyntax4_test()
-
-
-function(run_NameContainsSpaces1_test)
- set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==])
- run_ctest(NameContainsSpaces1)
-endfunction()
-run_NameContainsSpaces1_test()
-
-function(run_NameContainsSpaces2_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==])
- run_ctest(NameContainsSpaces2)
-endfunction()
-run_NameContainsSpaces2_test()
-
-function(run_NameContainsSpaces3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==])
- run_ctest(NameContainsSpaces3)
-endfunction()
-run_NameContainsSpaces3_test()
-
-function(run_NameContainsSpaces4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==])
- run_ctest(NameContainsSpaces4)
-endfunction()
-run_NameContainsSpaces4_test()
-
-
-function(run_NameContainsSemicolon1_test)
- set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==])
- run_ctest(NameContainsSemicolon1)
-endfunction()
-run_NameContainsSemicolon1_test()
-
-function(run_NameContainsSemicolon2_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==])
- run_ctest(NameContainsSemicolon2)
-endfunction()
-run_NameContainsSemicolon2_test()
-
-function(run_NameContainsSemicolon3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==])
- run_ctest(NameContainsSemicolon3)
-endfunction()
-run_NameContainsSemicolon3_test()
-
-function(run_NameContainsSemicolon4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==])
- run_ctest(NameContainsSemicolon4)
-endfunction()
-run_NameContainsSemicolon4_test()
-
-
-function(run_NameContainsEscapedQuote1_test)
- set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==])
- run_ctest(NameContainsEscapedQuote1)
-endfunction()
-run_NameContainsEscapedQuote1_test()
-
-function(run_NameContainsEscapedQuote2_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==])
- run_ctest(NameContainsEscapedQuote2)
-endfunction()
-run_NameContainsEscapedQuote2_test()
-
-function(run_NameContainsEscapedQuote3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==])
- run_ctest(NameContainsEscapedQuote3)
-endfunction()
-run_NameContainsEscapedQuote3_test()
-
-function(run_NameContainsEscapedQuote4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==])
- run_ctest(NameContainsEscapedQuote4)
-endfunction()
-run_NameContainsEscapedQuote4_test()
-
-
-function(run_NameContainsBracketArgument1_test)
- set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==])
- set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==])
- run_ctest(NameContainsBracketArgument1)
-endfunction()
-run_NameContainsBracketArgument1_test()
-
-function(run_NameContainsBracketArgument2_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==])
- run_ctest(NameContainsBracketArgument2)
-endfunction()
-run_NameContainsBracketArgument2_test()
-
-function(run_NameContainsBracketArgument3_test)
- set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==])
- set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==])
- run_ctest(NameContainsBracketArgument3)
-endfunction()
-run_NameContainsBracketArgument3_test()
-
-function(run_NameContainsBracketArgument4_test)
- set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==])
- set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==])
- run_ctest(NameContainsBracketArgument4)
-endfunction()
-run_NameContainsBracketArgument4_test()
+++ /dev/null
-cmake_minimum_required(VERSION 3.17)
-
-set(CTEST_SITE "test-site")
-set(CTEST_BUILD_NAME "test-build-name")
-set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
-set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
-set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
-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(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
-ctest_start(Experimental)
-ctest_configure()
-#ctest_build()
-ctest_test(${ctest_test_args})
set_source_files_properties(foo.c bar.c PROPERTIES LANGUAGE CXX)
target_link_libraries(SetLang foo)
set_target_properties(SetLang PROPERTIES LINKER_LANGUAGE CXX)
+
+# VS generators historically tolerated target-wide -TP flags added
+# by project code, so cover that case to preserve the behavior.
+if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC")
+ add_library(stay stay_c.c stay_cxx.cxx)
+ set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP")
+endif()
--- /dev/null
+#ifdef __cplusplus
+# error C source incorrectly compiled as C++
+#endif
+
+int stay_c(void)
+{
+ return 0;
+}
--- /dev/null
+#ifndef __cplusplus
+# error C++ source incorrectly compiled as C
+#endif
+
+int stay_cxx()
+{
+ return 0;
+}
# Dummy to make sure generation works with such targets.
add_library(SwiftIface INTERFACE)
+target_link_libraries(SwiftOnly PRIVATE SwiftIface)
--no-system-bzip2 use cmake-provided bzip2 library (default)
--system-liblzma use system-installed liblzma library
--no-system-liblzma use cmake-provided liblzma library (default)
+ --system-nghttp2 use system-installed nghttp2 library
+ --no-system-nghttp2 use cmake-provided nghttp2 library (default)
--system-zstd use system-installed zstd library
--no-system-zstd use cmake-provided zstd library (default)
--system-libarchive use system-installed libarchive library
--init=*) cmake_init_file=`cmake_arg "$1"` ;;
--system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
--no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
- --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-zstd|--system-libuv)
+ --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-nghttp2|--system-zstd|--system-libuv)
lib=`cmake_arg "$1" "--system-"`
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
- --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma|--no-system-zstd|--no-system-libuv)
+ --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma|--no-system-nghttp2|--no-system-zstd|--no-system-libuv)
lib=`cmake_arg "$1" "--no-system-"`
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
--qt-gui) cmake_bootstrap_qt_gui="1" ;;
}
#endif
-#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_if_constexpr))
+#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_deduction_guides))
#include <optional>
template <typename T,
typename std::invoke_result<decltype(&T::get), T>::type = nullptr>