diff options
38 files changed, 204 insertions, 165 deletions
diff --git a/.gitlab/ci/docker/debian10/Dockerfile b/.gitlab/ci/docker/debian10/Dockerfile index 3ebee87..34a4bf1 100644 --- a/.gitlab/ci/docker/debian10/Dockerfile +++ b/.gitlab/ci/docker/debian10/Dockerfile @@ -16,9 +16,6 @@ MAINTAINER Ben Boeckel <ben.boeckel@kitware.com> COPY install_deps.sh /root/install_deps.sh RUN sh /root/install_deps.sh -COPY install_clang_tidy.sh /root/install_clang_tidy.sh -RUN sh /root/install_clang_tidy.sh - COPY --from=iwyu-build /root/iwyu.tar.gz /root/iwyu.tar.gz RUN tar -C / -xf /root/iwyu.tar.gz RUN ln -s /usr/lib/llvm-6.0/bin/include-what-you-use /usr/bin/include-what-you-use-6.0 diff --git a/.gitlab/ci/docker/debian10/install_clang_tidy.sh b/.gitlab/ci/docker/debian10/install_clang_tidy.sh deleted file mode 100755 index 1280f1e..0000000 --- a/.gitlab/ci/docker/debian10/install_clang_tidy.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -# clang-tidy headers -apt-get install -y \ - gnupg2 -GNUPGHOME=$(mktemp -d) -export GNUPGHOME -keyid=6084F3CF814B57C1CF12EFD515CF4D18AF4F7421 -gpg2 --keyserver hkps://keyserver.ubuntu.com --recv-keys "$keyid" -gpg2 -o /usr/share/keyrings/llvm.gpg --export "$keyid" -rm -rf "$GNUPGHOME" -unset GNUPGHOME -echo 'deb [signed-by=/usr/share/keyrings/llvm.gpg] http://apt.llvm.org/buster/ llvm-toolchain-buster-14 main' > /etc/apt/sources.list.d/llvm.list -apt-get update -apt-get install -y \ - clang-tidy-14 \ - libclang-14-dev - -apt-get clean diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 6ac1995..a46ec22 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -45,7 +45,7 @@ ### Debian .debian10: - image: "kitware/cmake:ci-debian10-x86_64-2022-09-22" + image: "kitware/cmake:ci-debian10-x86_64-2022-08-30" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 5632f6d..1803846 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -7,7 +7,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-13.4.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode-14.0.app/Contents/Developer" # Avoid conflicting with other projects running on the same machine. SCCACHE_SERVER_PORT: 4227 @@ -95,7 +95,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-13.4 + - xcode-14.0 - nonconcurrent .macos_x86_64_builder_tags_package: @@ -103,7 +103,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-13.4 + - xcode-14.0 - nonconcurrent - finder @@ -112,7 +112,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-13.4 + - xcode-14.0 - concurrent .macos_arm64_builder_tags: @@ -120,7 +120,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-13.4 + - xcode-14.0 - nonconcurrent .macos_arm64_builder_ext_tags: @@ -128,7 +128,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-13.4 + - xcode-14.0 - concurrent ## macOS-specific scripts diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 1391c56..9d587c1 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -59,10 +59,10 @@ Try Compiling Source Files .. code-block:: cmake try_compile(<resultVar> - <SOURCES <srcfile...>] | - SOURCE_FROM_ARG <name> <content>] | - SOURCE_FROM_VAR <name> <var>] | - SOURCE_FROM_FILE <name> <path> >... + <SOURCES <srcfile...>] | + SOURCE_FROM_CONTENT <name> <content>] | + SOURCE_FROM_VAR <name> <var>] | + SOURCE_FROM_FILE <name> <path> >... [NO_CACHE] [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] @@ -194,7 +194,7 @@ The options are: ``OUTPUT_VARIABLE <var>`` Store the output from the build process in the given variable. -``SOURCE_FROM_ARG <name> <content>`` +``SOURCE_FROM_CONTENT <name> <content>`` .. versionadded:: 3.25 Write ``<content>`` to a file named ``<name>`` in the operation directory. @@ -202,7 +202,7 @@ The options are: the contents of the file are dynamically specified. The specified ``<name>`` is not allowed to contain path components. - ``SOURCE_FROM_ARG`` may be specified multiple times. + ``SOURCE_FROM_CONTENT`` may be specified multiple times. ``SOURCE_FROM_FILE <name> <path>`` .. versionadded:: 3.25 @@ -218,10 +218,11 @@ The options are: .. versionadded:: 3.25 Write the contents of ``<var>`` to a file named ``<name>`` in the operation - directory. This is the same as ``SOURCE_FROM_ARG``, but takes the contents - from the specified CMake variable, rather than directly, which may be useful - when passing arguments through a function which wraps ``try_compile``. The - specified ``<name>`` is not allowed to contain path components. + directory. This is the same as ``SOURCE_FROM_CONTENT``, but takes the + contents from the specified CMake variable, rather than directly, which may + be useful when passing arguments through a function which wraps + ``try_compile``. The specified ``<name>`` is not allowed to contain path + components. ``SOURCE_FROM_VAR`` may be specified multiple times. diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index 8393e1b..be7c734 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -13,10 +13,10 @@ Try Compiling and Running Source Files .. code-block:: cmake try_run(<runResultVar> <compileResultVar> - <SOURCES <srcfile...>] | - SOURCE_FROM_ARG <name> <content>] | - SOURCE_FROM_VAR <name> <var>] | - SOURCE_FROM_FILE <name> <path> >... + <SOURCES <srcfile...>] | + SOURCE_FROM_CONTENT <name> <content>] | + SOURCE_FROM_VAR <name> <var>] | + SOURCE_FROM_FILE <name> <path> >... [NO_CACHE] [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] diff --git a/Modules/ExternalProject/gitupdate.cmake.in b/Modules/ExternalProject/gitupdate.cmake.in index 7896f62..50f0167 100644 --- a/Modules/ExternalProject/gitupdate.cmake.in +++ b/Modules/ExternalProject/gitupdate.cmake.in @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5) function(get_hash_for_ref ref out_var err_var) execute_process( - COMMAND "@git_EXECUTABLE@" rev-parse "${ref}^0" + COMMAND "@git_EXECUTABLE@" --git-dir=.git rev-parse "${ref}^0" WORKING_DIRECTORY "@work_dir@" RESULT_VARIABLE error_code OUTPUT_VARIABLE ref_hash @@ -27,7 +27,7 @@ endif() execute_process( - COMMAND "@git_EXECUTABLE@" show-ref "@git_tag@" + COMMAND "@git_EXECUTABLE@" --git-dir=.git show-ref "@git_tag@" WORKING_DIRECTORY "@work_dir@" OUTPUT_VARIABLE show_ref_output ) @@ -95,7 +95,7 @@ endif() if(fetch_required) message(VERBOSE "Fetching latest from the remote @git_remote_name@") execute_process( - COMMAND "@git_EXECUTABLE@" fetch --tags --force "@git_remote_name@" + COMMAND "@git_EXECUTABLE@" --git-dir=.git fetch --tags --force "@git_remote_name@" WORKING_DIRECTORY "@work_dir@" COMMAND_ERROR_IS_FATAL ANY ) @@ -112,7 +112,7 @@ if(git_update_strategy MATCHES "^REBASE(_CHECKOUT)?$") # We can't if we aren't already on a branch and we shouldn't if that local # branch isn't tracking the one we want to checkout. execute_process( - COMMAND "@git_EXECUTABLE@" symbolic-ref -q HEAD + COMMAND "@git_EXECUTABLE@" --git-dir=.git symbolic-ref -q HEAD WORKING_DIRECTORY "@work_dir@" OUTPUT_VARIABLE current_branch OUTPUT_STRIP_TRAILING_WHITESPACE @@ -128,7 +128,7 @@ if(git_update_strategy MATCHES "^REBASE(_CHECKOUT)?$") else() execute_process( - COMMAND "@git_EXECUTABLE@" for-each-ref "--format=%(upstream:short)" "${current_branch}" + COMMAND "@git_EXECUTABLE@" --git-dir=.git for-each-ref "--format=%(upstream:short)" "${current_branch}" WORKING_DIRECTORY "@work_dir@" OUTPUT_VARIABLE upstream_branch OUTPUT_STRIP_TRAILING_WHITESPACE @@ -151,7 +151,7 @@ endif() # Check if stash is needed execute_process( - COMMAND "@git_EXECUTABLE@" status --porcelain + COMMAND "@git_EXECUTABLE@" --git-dir=.git status --porcelain WORKING_DIRECTORY "@work_dir@" RESULT_VARIABLE error_code OUTPUT_VARIABLE repo_status @@ -165,7 +165,7 @@ string(LENGTH "${repo_status}" need_stash) # rebase or checkout without losing those changes permanently if(need_stash) execute_process( - COMMAND "@git_EXECUTABLE@" stash save @git_stash_save_options@ + COMMAND "@git_EXECUTABLE@" --git-dir=.git stash save @git_stash_save_options@ WORKING_DIRECTORY "@work_dir@" COMMAND_ERROR_IS_FATAL ANY ) @@ -173,13 +173,13 @@ endif() if(git_update_strategy STREQUAL "CHECKOUT") execute_process( - COMMAND "@git_EXECUTABLE@" checkout "${checkout_name}" + COMMAND "@git_EXECUTABLE@" --git-dir=.git checkout "${checkout_name}" WORKING_DIRECTORY "@work_dir@" COMMAND_ERROR_IS_FATAL ANY ) else() execute_process( - COMMAND "@git_EXECUTABLE@" rebase "${checkout_name}" + COMMAND "@git_EXECUTABLE@" --git-dir=.git rebase "${checkout_name}" WORKING_DIRECTORY "@work_dir@" RESULT_VARIABLE error_code OUTPUT_VARIABLE rebase_output @@ -188,7 +188,7 @@ else() if(error_code) # Rebase failed, undo the rebase attempt before continuing execute_process( - COMMAND "@git_EXECUTABLE@" rebase --abort + COMMAND "@git_EXECUTABLE@" --git-dir=.git rebase --abort WORKING_DIRECTORY "@work_dir@" ) @@ -196,7 +196,7 @@ else() # Not allowed to do a checkout as a fallback, so cannot proceed if(need_stash) execute_process( - COMMAND "@git_EXECUTABLE@" stash pop --index --quiet + COMMAND "@git_EXECUTABLE@" --git-dir=.git stash pop --index --quiet WORKING_DIRECTORY "@work_dir@" ) endif() @@ -218,7 +218,7 @@ else() message(WARNING "Rebase failed, output has been saved to ${error_log_file}" "\nFalling back to checkout, previous commit tagged as ${tag_name}") execute_process( - COMMAND "@git_EXECUTABLE@" tag -a + COMMAND "@git_EXECUTABLE@" --git-dir=.git tag -a -m "ExternalProject attempting to move from here to ${checkout_name}" ${tag_name} WORKING_DIRECTORY "@work_dir@" @@ -226,7 +226,7 @@ else() ) execute_process( - COMMAND "@git_EXECUTABLE@" checkout "${checkout_name}" + COMMAND "@git_EXECUTABLE@" --git-dir=.git checkout "${checkout_name}" WORKING_DIRECTORY "@work_dir@" COMMAND_ERROR_IS_FATAL ANY ) @@ -236,29 +236,29 @@ endif() if(need_stash) # Put back the stashed changes execute_process( - COMMAND "@git_EXECUTABLE@" stash pop --index --quiet + COMMAND "@git_EXECUTABLE@" --git-dir=.git stash pop --index --quiet WORKING_DIRECTORY "@work_dir@" RESULT_VARIABLE error_code ) if(error_code) # Stash pop --index failed: Try again dropping the index execute_process( - COMMAND "@git_EXECUTABLE@" reset --hard --quiet + COMMAND "@git_EXECUTABLE@" --git-dir=.git reset --hard --quiet WORKING_DIRECTORY "@work_dir@" ) execute_process( - COMMAND "@git_EXECUTABLE@" stash pop --quiet + COMMAND "@git_EXECUTABLE@" --git-dir=.git stash pop --quiet WORKING_DIRECTORY "@work_dir@" RESULT_VARIABLE error_code ) if(error_code) # Stash pop failed: Restore previous state. execute_process( - COMMAND "@git_EXECUTABLE@" reset --hard --quiet ${head_sha} + COMMAND "@git_EXECUTABLE@" --git-dir=.git reset --hard --quiet ${head_sha} WORKING_DIRECTORY "@work_dir@" ) execute_process( - COMMAND "@git_EXECUTABLE@" stash pop --index --quiet + COMMAND "@git_EXECUTABLE@" --git-dir=.git stash pop --index --quiet WORKING_DIRECTORY "@work_dir@" ) message(FATAL_ERROR "\nFailed to unstash changes in: '@work_dir@'." @@ -270,7 +270,7 @@ endif() set(init_submodules "@init_submodules@") if(init_submodules) execute_process( - COMMAND "@git_EXECUTABLE@" submodule update @git_submodules_recurse@ --init @git_submodules@ + COMMAND "@git_EXECUTABLE@" --git-dir=.git submodule update @git_submodules_recurse@ --init @git_submodules@ WORKING_DIRECTORY "@work_dir@" COMMAND_ERROR_IS_FATAL ANY ) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0868d28..489d215 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 24) -set(CMake_VERSION_PATCH 20220929) +set(CMake_VERSION_PATCH 20221004) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 323790e..cdf8efa 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -173,7 +173,7 @@ auto const TryCompileBaseSourcesArgParser = auto const TryCompileBaseNewSourcesArgParser = cmArgumentParser<Arguments>{ TryCompileBaseSourcesArgParser } - .Bind("SOURCE_FROM_ARG"_s, &Arguments::SourceFromArg) + .Bind("SOURCE_FROM_CONTENT"_s, &Arguments::SourceFromContent) .Bind("SOURCE_FROM_VAR"_s, &Arguments::SourceFromVar) .Bind("SOURCE_FROM_FILE"_s, &Arguments::SourceFromFile) /* keep semicolon on own line */; @@ -402,10 +402,11 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments, } if (this->SrcFileSignature) { - if (arguments.SourceFromArg && arguments.SourceFromArg->size() % 2) { + if (arguments.SourceFromContent && + arguments.SourceFromContent->size() % 2) { this->Makefile->IssueMessage( MessageType::FATAL_ERROR, - "SOURCE_FROM_ARG requires exactly two arguments"); + "SOURCE_FROM_CONTENT requires exactly two arguments"); return false; } if (arguments.SourceFromVar && arguments.SourceFromVar->size() % 2) { @@ -476,12 +477,12 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments, } else if (arguments.SourceDirectoryOrFile) { sources.emplace_back(*arguments.SourceDirectoryOrFile); } - if (arguments.SourceFromArg) { - auto const k = arguments.SourceFromArg->size(); + if (arguments.SourceFromContent) { + auto const k = arguments.SourceFromContent->size(); for (auto i = decltype(k){ 0 }; i < k; i += 2) { - const auto& name = (*arguments.SourceFromArg)[i + 0]; - const auto& content = (*arguments.SourceFromArg)[i + 1]; - auto out = this->WriteSource(name, content, "SOURCES_FROM_ARG"); + const auto& name = (*arguments.SourceFromContent)[i + 0]; + const auto& content = (*arguments.SourceFromContent)[i + 1]; + auto out = this->WriteSource(name, content, "SOURCE_FROM_CONTENT"); if (out.empty()) { return false; } @@ -494,7 +495,7 @@ bool cmCoreTryCompile::TryCompileCode(Arguments& arguments, const auto& name = (*arguments.SourceFromVar)[i + 0]; const auto& var = (*arguments.SourceFromVar)[i + 1]; const auto& content = this->Makefile->GetDefinition(var); - auto out = this->WriteSource(name, content, "SOURCES_FROM_VAR"); + auto out = this->WriteSource(name, content, "SOURCE_FROM_VAR"); if (out.empty()) { return false; } diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index d4c9466..3e1e12c 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -41,7 +41,7 @@ public: cm::optional<std::string> TargetName; cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> Sources; cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> - SourceFromArg; + SourceFromContent; cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> SourceFromVar; cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 7f1e426..53cb030 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5454,9 +5454,6 @@ std::string cmGeneratorTarget::GetObjectDirectory( std::string obj_dir = this->GlobalGenerator->ExpandCFGIntDir(this->ObjectDirectory, config); #if defined(__APPLE__) - // find and replace $(PROJECT_NAME) xcode placeholder - const std::string projectName = this->LocalGenerator->GetProjectName(); - cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName); // Replace Xcode's placeholder for the object file directory since // installation and export scripts need to know the real directory. // Xcode has build-time settings (e.g. for sanitizers) that affect this, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9739a4e..6b867d4 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -607,7 +607,6 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget( } #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" -#define OBJECT_LIBRARY_ARTIFACT_DIR std::string() void cmGlobalXCodeGenerator::AddExtraTargets( cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens) @@ -2405,8 +2404,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Add preprocessor definitions for this target and configuration. BuildObjectListOrString ppDefs(this, true); - this->AppendDefines( - ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); + if (languages.count("Swift")) { + // FIXME: Xcode warns that Swift does not support definition values. + // C/CXX sources mixed in Swift targets will not see CMAKE_INTDIR. + } else { + this->AppendDefines( + ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); + } if (const std::string* exportMacro = gtgt->GetExportMacro()) { // Add the export symbol definition for shared library objects. this->AppendDefines(ppDefs, exportMacro->c_str()); @@ -2518,18 +2522,28 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, soName += *soversion; } + if (gtgt->CanCompileSources()) { + std::string tmpDir = + cmStrCat(gtgt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir()); + buildSettings->AddAttribute("TARGET_TEMP_DIR", this->CreateString(tmpDir)); + + std::string outDir; + if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { + // We cannot suppress the archive, so hide it with intermediate files. + outDir = tmpDir; + } else { + outDir = gtgt->GetDirectory(configName); + } + buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", + this->CreateString(outDir)); + } + // Set attributes to specify the proper name for the target. std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY || gtgt->GetType() == cmStateEnums::SHARED_LIBRARY || gtgt->GetType() == cmStateEnums::MODULE_LIBRARY || gtgt->GetType() == cmStateEnums::EXECUTABLE) { - if (!gtgt->UsesDefaultOutputDir(configName, - cmStateEnums::RuntimeBinaryArtifact)) { - std::string pncdir = gtgt->GetDirectory(configName); - buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", - this->CreateString(pncdir)); - } if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) { pnprefix = ""; @@ -2539,20 +2553,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString(pnprefix)); buildSettings->AddAttribute("EXECUTABLE_SUFFIX", this->CreateString(pnsuffix)); - } else if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { - pnprefix = "lib"; - pnbase = gtgt->GetName(); - pnsuffix = ".a"; - - std::string pncdir = this->GetObjectsDirectory( - this->CurrentProject, configName, gtgt, OBJECT_LIBRARY_ARTIFACT_DIR); - buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", - this->CreateString(pncdir)); } // Store the product name for all target types. buildSettings->AddAttribute("PRODUCT_NAME", this->CreateString(realName)); - buildSettings->AddAttribute("SYMROOT", this->CreateString(pndir)); // Handle settings for each target type. switch (gtgt->GetType()) { @@ -4465,16 +4469,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( return true; } -std::string cmGlobalXCodeGenerator::GetObjectsDirectory( - const std::string& projName, const std::string& configName, - const cmGeneratorTarget* t, const std::string& variant) const -{ - std::string dir = cmStrCat( - t->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/', projName, - ".build/", configName, '/', t->GetName(), ".build/", variant); - return dir; -} - void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) { this->Architectures.clear(); @@ -4598,10 +4592,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( for (auto objLib : objlibs) { const std::string objLibName = objLib->GetName(); - std::string d = cmStrCat( - this->GetObjectsDirectory(this->CurrentProject, configName, objLib, - OBJECT_LIBRARY_ARTIFACT_DIR), - "lib", objLibName, ".a"); + std::string d = cmStrCat(objLib->GetSupportDirectory(), '/', + configName, "/lib", objLibName, ".a"); std::string dependency = this->ConvertToRelativeForMake(d); makefileStream << "\\\n\t" << dependency; @@ -4615,8 +4607,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { - std::string universal = this->GetObjectsDirectory( - this->CurrentProject, configName, gt, "$(OBJDIR)/"); + std::string universal = cmStrCat(gt->GetSupportDirectory(), '/', + configName, "/$(OBJDIR)/"); for (const auto& architecture : this->Architectures) { std::string universalFile = cmStrCat(universal, architecture, '/', gt->GetFullName(configName)); @@ -5013,14 +5005,10 @@ bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( cmGeneratorTarget* gt) const { - std::string configName = this->GetCMakeCFGIntDir(); auto objectDirArch = GetTargetObjectDirArch(*gt, this->ObjectDirArch); - - std::string dir = - cmStrCat(this->GetObjectsDirectory("$(PROJECT_NAME)", configName, gt, - "$(OBJECT_FILE_DIR_normal:base)/"), - objectDirArch, '/'); - gt->ObjectDirectory = dir; + gt->ObjectDirectory = + cmStrCat(gt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir(), + "/$(OBJECT_FILE_DIR_normal:base)/", objectDirArch, '/'); } std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 92e4528..e924169 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -339,11 +339,6 @@ private: std::string GetLibraryOrFrameworkPath(const std::string& path) const; - std::string GetObjectsDirectory(const std::string& projName, - const std::string& configName, - const cmGeneratorTarget* t, - const std::string& variant) const; - static std::string GetDeploymentPlatform(const cmMakefile* mf); void ComputeArchitectures(cmMakefile* mf); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 428bbff..6c5ab7f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -298,7 +298,16 @@ add_RunCMake_test(CompilerNotFound) if (APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") list(APPEND CompilerTest_ARGS -DCMake_TEST_OBJC=1) endif() +if(CMAKE_Fortran_COMPILER) + list(APPEND CompilerTest_ARGS -DCMake_TEST_Fortran=1) +endif() +foreach(lang IN ITEMS CUDA HIP ISPC) + if(CMake_TEST_${lang}) + list(APPEND CompilerTest_ARGS -DCMake_TEST_${lang}=1) + endif() +endforeach() add_RunCMake_test(CompilerTest) +set_property(TEST RunCMake.CompilerTest APPEND PROPERTY LABELS "CUDA" "HIP" "ISPC") add_RunCMake_test(Configure -DMSVC_IDE=${MSVC_IDE}) add_RunCMake_test(DisallowedCommands) if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") diff --git a/Tests/RunCMake/CompilerTest/CUDA-stdout.txt b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt new file mode 100644 index 0000000..00d35df --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working CUDA compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/CUDA.cmake b/Tests/RunCMake/CompilerTest/CUDA.cmake new file mode 100644 index 0000000..e8c19a0 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/CUDA.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_CUDA_ABI_COMPILED FALSE) +enable_language(CUDA) diff --git a/Tests/RunCMake/CompilerTest/Fortran-stdout.txt b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt new file mode 100644 index 0000000..d871fea --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working Fortran compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/Fortran.cmake b/Tests/RunCMake/CompilerTest/Fortran.cmake new file mode 100644 index 0000000..8c83bd7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/Fortran.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_Fortran_ABI_COMPILED FALSE) +enable_language(Fortran) diff --git a/Tests/RunCMake/CompilerTest/HIP-stdout.txt b/Tests/RunCMake/CompilerTest/HIP-stdout.txt new file mode 100644 index 0000000..8b3baa7 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP-stdout.txt @@ -0,0 +1,2 @@ +-- Check for working HIP compiler: [^ +]* - works diff --git a/Tests/RunCMake/CompilerTest/HIP.cmake b/Tests/RunCMake/CompilerTest/HIP.cmake new file mode 100644 index 0000000..e56b77a --- /dev/null +++ b/Tests/RunCMake/CompilerTest/HIP.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_HIP_ABI_COMPILED FALSE) +enable_language(HIP) diff --git a/Tests/RunCMake/CompilerTest/ISPC-stdout.txt b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt new file mode 100644 index 0000000..7e45c91 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC-stdout.txt @@ -0,0 +1,3 @@ +-- The ISPC compiler identification is [^ +]* +-- Configuring done diff --git a/Tests/RunCMake/CompilerTest/ISPC.cmake b/Tests/RunCMake/CompilerTest/ISPC.cmake new file mode 100644 index 0000000..3ce7b28 --- /dev/null +++ b/Tests/RunCMake/CompilerTest/ISPC.cmake @@ -0,0 +1,3 @@ +# Pretend the ABI check failed in order to force the fall-back test to run. +set(CMAKE_ISPC_ABI_COMPILED FALSE) +enable_language(ISPC) diff --git a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake index 995296a..2dd9c7f 100644 --- a/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerTest/RunCMakeTest.cmake @@ -3,6 +3,22 @@ include(RunCMake) run_cmake(C) run_cmake(CXX) +if(CMake_TEST_CUDA) + run_cmake(CUDA) +endif() + +if(CMake_TEST_Fortran) + run_cmake(Fortran) +endif() + +if(CMake_TEST_HIP) + run_cmake(HIP) +endif() + +if(CMake_TEST_ISPC) + run_cmake(ISPC) +endif() + if(CMake_TEST_OBJC) run_cmake(OBJC) run_cmake(OBJCXX) diff --git a/Tests/RunCMake/XcodeProject/Clean.cmake b/Tests/RunCMake/XcodeProject/Clean.cmake new file mode 100644 index 0000000..1ab7e10 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean.cmake @@ -0,0 +1,2 @@ +enable_language(C) +add_subdirectory(Clean) diff --git a/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt new file mode 100644 index 0000000..59e62cb --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean/CMakeLists.txt @@ -0,0 +1 @@ +add_library(empty empty.c) diff --git a/Tests/RunCMake/XcodeProject/Clean/empty.c b/Tests/RunCMake/XcodeProject/Clean/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/Clean/empty.c diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index d20f5a6..d97807b 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -1,5 +1,13 @@ include(RunCMake) +function(RunClean) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Clean-build) + run_cmake(Clean) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Clean-build xcodebuild clean) +endfunction() +RunClean() + run_cmake(ExplicitCMakeLists) run_cmake(ImplicitCMakeLists) run_cmake(InterfaceLibSources) @@ -290,30 +298,33 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6) unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedPrune - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=iOS" - "-DCMAKE_IOS_INSTALL_COMBINED=YES" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") + # FIXME(#24011): Xcode 14 removed support for older architectures the test needs. + if(XCODE_VERSION VERSION_LESS 14) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_SYSTEM_NAME=iOS" + "-DCMAKE_IOS_INSTALL_COMBINED=YES" + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(XcodeIOSInstallCombinedPrune) - run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) - if(XCODE_VERSION VERSION_LESS 12) - run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) endif() - # --build defaults to Debug, --install defaults to Release, so we have to - # specify the configuration explicitly - run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall - ${CMAKE_COMMAND} --install . --config Debug - ) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) # XcodeIOSInstallCombinedSingleArch set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedSingleArch-build) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake index 53b885d..60bc0d8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake @@ -9,11 +9,18 @@ function(verify_architectures file) return() endif() - string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures ${otool_out}) + string(REGEX MATCHALL "\narchitecture [^ \n\t()]+" architectures "${otool_out}") string(REPLACE "\narchitecture " "" actual "${architectures}") list(SORT actual) - set(expected arm64 armv7 i386 x86_64) + if(XCODE_VERSION VERSION_LESS 14) + set(maybe_armv7 armv7) + set(maybe_i386 i386) + else() + set(maybe_armv7 "") + set(maybe_i386 "") + endif() + set(expected arm64 ${maybe_armv7} ${maybe_i386} x86_64) if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index 19f8e2f..8426148 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -2,7 +2,13 @@ cmake_minimum_required(VERSION 3.3) project(IOSInstallCombined CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(maybe_armv7 armv7) +set(maybe_i386 i386) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(maybe_armv7 "") + set(maybe_i386 "") +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -16,7 +22,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") -set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") +set(CMAKE_OSX_ARCHITECTURES ${maybe_armv7} arm64 ${maybe_i386} x86_64) add_executable(foo_app MACOSX_BUNDLE main.cpp) install(TARGETS foo_app BUNDLE DESTINATION bin) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake index 3c11ae0..db8f869 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-install-check.cmake @@ -12,7 +12,11 @@ function(verify_architecture file) string(REGEX MATCHALL "is architecture: [^ \n\t]+" architecture "${lipo_out}") string(REGEX REPLACE "is architecture: " "" actual "${architecture}") - set(expected armv7) + if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(expected arm64) + else() + set(expected armv7) + endif() if(NOT actual STREQUAL expected) message(SEND_ERROR diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 974ae47..5177ec2 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.3) project(XcodeIOSInstallCombinedSingleArch CXX) -if(XCODE_VERSION VERSION_GREATER_EQUAL 9) +set(iphoneos_arch armv7) +if(XCODE_VERSION VERSION_GREATER_EQUAL 14) + set(CMAKE_OSX_DEPLOYMENT_TARGET 16) + set(iphoneos_arch arm64) +elseif(XCODE_VERSION VERSION_GREATER_EQUAL 9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10) endif() @@ -17,8 +21,8 @@ install(TARGETS foo DESTINATION lib) set_target_properties( foo PROPERTIES - XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 - XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] ${iphoneos_arch} + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] ${iphoneos_arch} XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "" XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "" ) diff --git a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt index ef6847c..041f3f1 100644 --- a/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt +++ b/Tests/RunCMake/try_compile/SourceFromBadName-stderr.txt @@ -1,4 +1,4 @@ CMake Error at SourceFromBadName.cmake:[0-9]+ \(try_compile\): - SOURCES_FROM_ARG given invalid filename "bad/name.c" + SOURCE_FROM_CONTENT given invalid filename "bad/name.c" Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromBadName.cmake b/Tests/RunCMake/try_compile/SourceFromBadName.cmake index e53a73f..44d92fd 100644 --- a/Tests/RunCMake/try_compile/SourceFromBadName.cmake +++ b/Tests/RunCMake/try_compile/SourceFromBadName.cmake @@ -1 +1 @@ -try_compile(RESULT SOURCE_FROM_ARG bad/name.c "int main();") +try_compile(RESULT SOURCE_FROM_CONTENT bad/name.c "int main();") diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt index bebe8bb..8b2248a 100644 --- a/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt +++ b/Tests/RunCMake/try_compile/SourceFromOneArg-stderr.txt @@ -1,4 +1,4 @@ CMake Error at SourceFromOneArg.cmake:[0-9]+ \(try_compile\): - SOURCE_FROM_ARG requires exactly two arguments + SOURCE_FROM_CONTENT requires exactly two arguments Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake index 39ca11e..5a50499 100644 --- a/Tests/RunCMake/try_compile/SourceFromOneArg.cmake +++ b/Tests/RunCMake/try_compile/SourceFromOneArg.cmake @@ -1 +1 @@ -try_compile(RESULT SOURCE_FROM_ARG test.c) +try_compile(RESULT SOURCE_FROM_CONTENT test.c) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt index 2cf201d..5f2ff61 100644 --- a/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs-stderr.txt @@ -1,4 +1,4 @@ CMake Error at SourceFromThreeArgs.cmake:[0-9]+ \(try_compile\): - SOURCE_FROM_ARG requires exactly two arguments + SOURCE_FROM_CONTENT requires exactly two arguments Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake index af6340d..196851a 100644 --- a/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake +++ b/Tests/RunCMake/try_compile/SourceFromThreeArgs.cmake @@ -1 +1 @@ -try_compile(RESULT SOURCE_FROM_ARG test.c "int" "main();") +try_compile(RESULT SOURCE_FROM_CONTENT test.c "int" "main();") diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 9396cfa..5f540e9 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -78,7 +78,7 @@ include(old_and_new_signature_tests.cmake) # try to compile an empty source specified directly try_compile(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE - SOURCE_FROM_ARG empty.c "") + SOURCE_FROM_CONTENT empty.c "") if(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE) message(SEND_ERROR "Trying to compile an empty source succeeded?") endif() @@ -103,11 +103,11 @@ set(TRY_RUN_EXT_CODE "int answer() { return 42; }\n") try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE - SOURCE_FROM_ARG main.c "${TRY_RUN_MAIN_CODE}" - SOURCE_FROM_ARG answer.c "${TRY_RUN_EXT_CODE}" + SOURCE_FROM_CONTENT main.c "${TRY_RUN_MAIN_CODE}" + SOURCE_FROM_CONTENT answer.c "${TRY_RUN_EXT_CODE}" COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT) -EXPECT_COMPILED("SOURCE_FROM_ARG" SHOULD_COMPILE "${COMPILE_OUTPUT}") -EXPECT_RUN_RESULT("SOURCE_FROM_ARG" SHOULD_EXIT_WITH_ERROR 42) +EXPECT_COMPILED("SOURCE_FROM_CONTENT" SHOULD_COMPILE "${COMPILE_OUTPUT}") +EXPECT_RUN_RESULT("SOURCE_FROM_CONTENT" SHOULD_EXIT_WITH_ERROR 42) try_run(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE SOURCE_FROM_VAR main.c TRY_RUN_MAIN_CODE |