diff options
-rw-r--r-- | Help/command/target_precompile_headers.rst | 27 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 12 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmGlobalWatcomWMakeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmOutputConverter.cxx | 9 | ||||
-rw-r--r-- | Source/cmOutputConverter.h | 1 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/include/foo_C.h | 1 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h | 1 |
16 files changed, 42 insertions, 44 deletions
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst index 569c7eb..0d4f45a 100644 --- a/Help/command/target_precompile_headers.rst +++ b/Help/command/target_precompile_headers.rst @@ -56,35 +56,34 @@ e.g. ``[["other_header.h"]]``) will be treated as is, and include directories must be available for the compiler to find them. Other header file names (e.g. ``project_header.h``) are interpreted as being relative to the current source directory (e.g. :variable:`CMAKE_CURRENT_SOURCE_DIR`) and will be -included by absolute path. - -Arguments to ``target_precompile_headers()`` may use "generator expressions" -with the syntax ``$<...>``. -See the :manual:`cmake-generator-expressions(7)` manual for available -expressions. See the :manual:`cmake-compile-features(7)` manual for -information on compile features and a list of supported compilers. -The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly -useful for specifying a language-specific header to precompile for -only one language (e.g. ``CXX`` and not ``C``). For example: +included by absolute path. For example: .. code-block:: cmake target_precompile_headers(myTarget PUBLIC project_header.h - "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>" PRIVATE [["other_header.h"]] <unordered_map> ) -When specifying angle brackets inside a :manual:`generator expression -<cmake-generator-expressions(7)>`, be sure to encode the closing ``>`` -as ``$<ANGLE-R>``. For example: +Arguments to ``target_precompile_headers()`` may use "generator expressions" +with the syntax ``$<...>``. +See the :manual:`cmake-generator-expressions(7)` manual for available +expressions. +The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly +useful for specifying a language-specific header to precompile for +only one language (e.g. ``CXX`` and not ``C``). In this case, header +file names that are not explicitly in double quotes or angle brackets +must be specified by absolute path. Also, when specifying angle brackets +inside a generator expression, be sure to encode the closing ``>`` as +``$<ANGLE-R>``. For example: .. code-block:: cmake target_precompile_headers(mylib PRIVATE + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/cxx_only.h>" "$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>" "$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>" ) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 1b27463..57e17b3 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1179,7 +1179,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(NOT Boost_VERSION_STRING VERSION_LESS 1.73.0) + if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.74.0) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f376bd4..ed86054 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 17) -set(CMake_VERSION_PATCH 20200427) +set(CMake_VERSION_PATCH 20200428) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 4daf726..930f300 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -808,11 +808,15 @@ bool CMakeSetupDialog::setupFirstConfigure() m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_PROCESSOR", tr("CMake System Processor"), systemProcessor, false); QString cxxCompiler = dialog.getCXXCompiler(); - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", - tr("CXX compiler."), cxxCompiler, false); + if (!cxxCompiler.isEmpty()) { + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", + tr("CXX compiler."), cxxCompiler, false); + } QString cCompiler = dialog.getCCompiler(); - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", - tr("C compiler."), cCompiler, false); + if (!cCompiler.isEmpty()) { + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", + tr("C compiler."), cCompiler, false); + } } else if (dialog.crossCompilerToolChainFile()) { QString toolchainFile = dialog.getCrossCompilerToolChainFile(); m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE", diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 673936c..fbb9429 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -73,11 +73,12 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag( void cmCommonTargetGenerator::AppendFortranFormatFlags( std::string& flags, cmSourceFile const& source) { - cmProp srcfmt = source.GetProperty("Fortran_FORMAT"); + const std::string srcfmt = source.GetSafeProperty("Fortran_FORMAT"); cmOutputConverter::FortranFormat format = - cmOutputConverter::GetFortranFormat(srcfmt ? srcfmt->c_str() : nullptr); + cmOutputConverter::GetFortranFormat(srcfmt); if (format == cmOutputConverter::FortranFormatNone) { - const char* tgtfmt = this->GeneratorTarget->GetProperty("Fortran_FORMAT"); + const std::string tgtfmt = + this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT"); format = cmOutputConverter::GetFortranFormat(tgtfmt); } const char* var = nullptr; diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 308ddda..07e0793 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -19,7 +19,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm) #endif this->ToolSupportsColor = true; this->NeedSymbolicMark = true; - this->EmptyRuleHackCommand = "@cd ."; + this->EmptyRuleHackCommand = "@%null"; #ifdef _WIN32 cm->GetState()->SetWindowsShell(true); #endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 1a753e2..f305246 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -808,9 +808,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( // Add flags from target and source file properties. std::string flags; - cmProp srcfmt = sf->GetProperty("Fortran_FORMAT"); - switch ( - cmOutputConverter::GetFortranFormat(srcfmt ? srcfmt->c_str() : nullptr)) { + const std::string srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); + switch (cmOutputConverter::GetFortranFormat(srcfmt)) { case cmOutputConverter::FortranFormatFixed: flags = "-fixed " + flags; break; @@ -2290,7 +2289,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Add Fortran source format attribute if property is set. const char* format = nullptr; - const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT"); + const std::string tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT"); switch (cmOutputConverter::GetFortranFormat(tgtfmt)) { case cmOutputConverter::FortranFormatFixed: format = "fixed"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index aa8912e..1401e29 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1442,7 +1442,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( // Create the scanner for this language std::unique_ptr<cmDepends> scanner; if (lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM" || - lang == "CUDA") { + lang == "OBJC" || lang == "OBJCXX" || lang == "CUDA") { // TODO: Handle RC (resource files) dependencies correctly. scanner = cm::make_unique<cmDependsC>(this, targetDir, lang, &validDeps); } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 95c798b..8daffa0 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -672,7 +672,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( if (this->FortranProject) { switch (cmOutputConverter::GetFortranFormat( - target->GetProperty("Fortran_FORMAT"))) { + target->GetSafeProperty("Fortran_FORMAT"))) { case cmOutputConverter::FortranFormatFixed: flags += " -fixed"; break; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b21946c..267d5e1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -724,8 +724,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // At the moment, it is assumed that C, C++, Fortran, and CUDA have both // assembly and preprocessor capabilities. The same is true for the // ability to export compile commands - bool lang_has_preprocessor = ((lang == "C") || (lang == "CXX") || - (lang == "Fortran") || (lang == "CUDA")); + bool lang_has_preprocessor = + ((lang == "C") || (lang == "CXX") || (lang == "OBJC") || + (lang == "OBJCXX") || (lang == "Fortran") || (lang == "CUDA")); bool const lang_has_assembly = lang_has_preprocessor; bool const lang_can_export_cmds = lang_has_preprocessor; diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 68bf3af..dc324cc 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -170,15 +170,6 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat( return format; } -cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat( - const char* value) -{ - if (!value) { - return FortranFormatNone; - } - return GetFortranFormat(cm::string_view(value)); -} - void cmOutputConverter::SetLinkScriptShell(bool linkScriptShell) { this->LinkScriptShell = linkScriptShell; diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 6583ab5..28582df 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -94,7 +94,6 @@ public: FortranFormatFree }; static FortranFormat GetFortranFormat(cm::string_view value); - static FortranFormat GetFortranFormat(const char* value); private: cmState* GetState() const; diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake index 1696037..3119341 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake @@ -17,14 +17,14 @@ endif() file(STRINGS ${foobar_pch_h_header} foobar_pch_h_header_strings) -if (NOT foobar_pch_h_header_strings MATCHES ";#include <stddef.h>(;|$)") +if (NOT foobar_pch_h_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo_C.h\";#include <stddef.h>(;|$)") set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foobar_pch_h_header}\nhas bad content:\n ${foobar_pch_h_header_strings}") return() endif() file(STRINGS ${foobar_pch_hxx_header} foobar_pch_hxx_header_strings) -if (NOT foobar_pch_hxx_header_strings MATCHES ";#include <cstddef>(;|$)") +if (NOT foobar_pch_hxx_header_strings MATCHES ";#include \"[^\"]*PrecompileHeaders/include/foo_CXX.h\";#include <cstddef>(;|$)") set(RunCMake_TEST_FAILED "Generated foo pch header\n ${foobar_pch_hxx_header}\nhas bad content:\n ${foobar_pch_hxx_header_strings}") return() endif() diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake index cdc42b2..bb18a64 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake @@ -7,6 +7,8 @@ add_executable(foobar ) target_include_directories(foobar PUBLIC include) target_precompile_headers(foobar PRIVATE + "$<$<COMPILE_LANGUAGE:C>:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_C.h>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_CXX.h>" "$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>" "$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>" ) diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo_C.h b/Tests/RunCMake/PrecompileHeaders/include/foo_C.h new file mode 100644 index 0000000..f4de601 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/include/foo_C.h @@ -0,0 +1 @@ +#include "foo.h" diff --git a/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h b/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h new file mode 100644 index 0000000..f4de601 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/include/foo_CXX.h @@ -0,0 +1 @@ +#include "foo.h" |