diff options
-rw-r--r-- | Help/command/target_precompile_headers.rst | 27 | ||||
-rw-r--r-- | Modules/CheckLanguage.cmake | 2 | ||||
-rw-r--r-- | Modules/FindMPI.cmake | 6 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 7 | ||||
-rw-r--r-- | Tests/CMakeOnly/CheckLanguage/CMakeLists.txt | 18 | ||||
-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 |
11 files changed, 41 insertions, 34 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/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index a1a3a7a..95e4fbe 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -43,7 +43,7 @@ macro(check_language lang) file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}) set(extra_compiler_variables) - if(lang STREQUAL CUDA) + if(${lang} STREQUAL CUDA) set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")") endif() diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index d6cd799..42941c9 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -298,9 +298,9 @@ else() endif() # PGI compiler names -set(_MPI_PGI_C_COMPILER_NAMES mpipgcc mppgcc) -set(_MPI_PGI_CXX_COMPILER_NAMES mpipgCC mppgCC) -set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) +set(_MPI_PGI_C_COMPILER_NAMES mpipgicc mpipgcc mppgcc) +set(_MPI_PGI_CXX_COMPILER_NAMES mpipgic++ mpipgCC mppgCC) +set(_MPI_PGI_Fortran_COMPILER_NAMES mpipgifort mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77) # XLC MPI Compiler names set(_MPI_XL_C_COMPILER_NAMES mpxlc mpxlc_r mpixlc mpixlc_r) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 919fb74..6f2183d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1457,7 +1457,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/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index dd8a389..9d08e07 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -666,8 +666,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/cmTarget.cxx b/Source/cmTarget.cxx index 80986fc..cdfd349 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -235,8 +235,11 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, !impl->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX").empty(); // Check whether we are targeting AIX. - impl->IsAIX = - (impl->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "AIX"); + { + std::string const& systemName = + impl->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"); + impl->IsAIX = (systemName == "AIX" || systemName == "OS400"); + } // Check whether we are targeting an Android platform. impl->IsAndroid = diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt index 90aa921..1570c37 100644 --- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -18,16 +18,16 @@ if(APPLE) list(APPEND LANGUAGES OBJC OBJCXX) endif() -foreach(lang ${LANGUAGES}) - check_language(${lang}) - if(NOT DEFINED CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) did not set result") +foreach(test_lang ${LANGUAGES}) + check_language(${test_lang}) + if(NOT DEFINED CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) did not set result") endif() - if(DEFINED expect_${lang}) - if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not fail!") - elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not succeed!") + if(DEFINED expect_${test_lang}) + if(expect_${test_lang} AND NOT CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not fail!") + elseif(NOT expect_${test_lang} AND CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not succeed!") endif() endif() endforeach() diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake index cc01ecb..9714bea 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake @@ -13,14 +13,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" |