summaryrefslogtreecommitdiff
path: root/Modules/CMakeCXXCompiler.cmake.in
Commit message (Collapse)AuthorAgeFilesLines
* Link step: use linker dependency linker fileMarc Chevrier2023-05-031-0/+1
| | | | | | Based on work done by @ben.boeckel (!8051) Fixes: #22217
* Treat '.ccm', '.cxxm', and '.c++m' files as C++ sourcesBrad King2023-03-091-1/+1
| | | | | | | | | These extensions are used by convention for C++ module interface units with Clang. For now, do not add any tests using these extensions. Very few compilers recognize them as C++ sources. Tests can be added later as part of C++ modules support.
* Apple: Handle generation and comsuption of text-based stubs (.tbd files)Marc Chevrier2023-03-011-0/+1
| | | | Fixes: #24123
* CompilerID: Compiler extensions default detectionRaul Tambre2021-09-281-0/+1
|
* MINGW: Define variable only when targeting Windows platformsBrad King2021-09-171-4/+0
| | | | | | | | | | | | | | | The `MINGW` variable indicates that the compiler targets MinGW, a GNU ABI on Windows. Since commit aff3147917 (Modernize GNU compiler info on Windows, 2009-12-02, v2.8.2~636), we load the `Platform/Windows-GNU` module for compilers targetin MinGW, so set the variable there instead. This is equivalent to `Platform/Windows-MSVC` setting the `MSVC` variable. Also remove `if(MINGW)` checks from the module, which have not been necessary since the enclosed logic was moved to that module. The undocumented `CMAKE_COMPILER_IS_MINGW` internal variable is now unused, so remove it too. Fixes: #22647
* Cygwin: Remove redundant definitions of CYGWIN and UNIX variablesBrad King2021-09-161-5/+0
| | | | | | | | These are set by modules loaded for `CMAKE_SYSTEM_NAME`. We do not need to set them again if the compiler defines `__CYGWIN__`. Also remove the now-unused undocumented `CMAKE_COMPILER_IS_CYGWIN` internal variable.
* Treat '.ixx' and '.cppm' files as C++ sourcesAndrew Gilewsky2021-03-221-1/+1
| | | | | These extensions are used by convention for C++ modules and interface units with MSVC.
* Treat the '.mpp' file extension as C++ codeBen Boeckel2021-01-051-1/+1
| | | | This is the extension required in build2 for C++ module support.
* CUDA, CXX, OBJCXX: C++23 support with Clang 12Raul Tambre2020-12-081-0/+1
| | | | | Clang 12 landed initial support for C++23 language mode flag -std={c|gnu}++2b in commit 6627a3c2873fdf7ccba1a1573371079be48b36e8.
* CMakeDetermineCompilerABI: Detect byte order as part of checkBrad King2020-11-041-0/+1
| | | | | | | We already detect `sizeof(void*)`. Detect the byte order as part of the same check. Issue: #21392
* Compilers: Add paths from -print-sysroot to system prefix pathRobert Maynard2020-04-141-0/+1
|
* Objective-C: Do not treat Objective-C files as C++ filesCristian Adam2019-10-111-1/+1
| | | | | When both C and C++ langauges are enabled, the Objective-C files should be treated as C files and not as C++ files.
* Languages: Add support for Objective-C++Steve Wilson2019-09-281-1/+1
| | | | | | | | | | | | | | | | | Add entries in Modules and Modules/Platform to support Objective-C++ compiler determination and identification. Add Modules to check Objective-C++ compiler flags, source compilations, program checks, etc... Use OBJCXX as the designator of the language, eg: project(foo OBJCXX) Add various tests for Objective-C++ language features. Add tests to preserve C++ handling of .M and .mm files when Objective-C++ is not a configured language. Co-authored-by: Cristian Adam <cristian.adam@gmail.com>
* Languages: Add support for Objective-CSteve Wilson2019-09-281-1/+10
| | | | | | | | | | | | | | | | | Add entries in Modules and Modules/Platform to support Objective-C compiler determination and identification. Add Modules to check Objective-C compiler flags, source compilations, program checks, etc... Use OBJC as the designator of the language, eg: project(foo OBJC) Add various tests for Objective-C language features. Add tests to preserve C++ handling of .m and .mm files when OBJC is not a configured language. Co-Authored-By: Cristian Adam <cristian.adam@gmail.com>
* clang: introduce CMAKE_<lang>_COMPILER_FRONTEND_VARIANTZsolt Parragi2019-05-171-0/+1
| | | | | | | | This variable is set to GNU on Windows when clang.exe ar clang++.exe is used, and set to MSVC for clang-cl.exe. CMAKE_<lang>_SIMULATE_ID is set to MSVC in both cases, as clang defaults to -fms-compatibility for all command lines on windows.
* Compute implicit include directories from compiler outputChuck Cranor2019-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - CMakeParseImplicitIncludeInfo.cmake: new parser that extracts the compiler's include path from verbose output. If the parser cannot parse the output, we fall back to the old behavior. On osx we skip over framework directories (handled elsewhere). - CMakeDetermineCompilerABI.cmake: - use verbose flag in try_compile for ${src} - use new cmake_parse_implicit_include_info() to attempt extract implicit include directory path and if successful set CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES - CMakeCCompiler.cmake.in and CMakeCXXCompiler.cmake.in - preserve CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES value between runs in the same way CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES is preserved - Tests/RunCMake/ParseImplicitIncludeInfo: tests for parse based on the older Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in. The test runs a set of verbose compiler outputs collected from various machines through the parser and checks the results. New compiler files can be added by dropping input/output files in the ParseImplicitIncludeInfo/data subdirectory and then adding the new set of files to the ${targets} list in ParseImplicitIncludeInfo.cmake. There is a helper CMakeLists.txt in ParseImplicitIncludeInfo/data that can help with the generation of test input files. NOTE: the standard cmake pre-commit hook rejects verbose compiler output with trailing spaces... you have to manually edit them out. This shouldn't impact the test. Note that both the parser and the test code can use CMAKE_${LANG}_COMPILER_* variables such as ${CMAKE_CXX_COMPILER_ID} to decide how to parse verbose compiler output. For the test code, this requires us to save the variables values in the test input files. Fixes: #16291
* MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}Mateusz Zych2018-10-291-0/+1
| | | | | | | | | | | | CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC, are responsible for calling resource compiler and manifest tool. Before this commit, both of these tools were called directly, with the expectation that they are available in the `PATH`. This has been fixed by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT` defining paths to these tools. Fixes: #17804
* Xcode: Detect architecture(s) using ARCHS instead of CURRENT_ARCHBrad King2018-06-181-1/+1
| | | | | | | | | Xcode 10 no longer populates `CURRENT_ARCH` with the current architecture in shell scripts and instead uses `undefined_arch`. Instead we must use `ARCHS`. It lists all architectures separated by spaces. Fixes: #18085
* Features: Add infrastructure for C++ 20 language standardBrad King2018-03-271-0/+1
| | | | Issue: #17849
* Add infrastructure to detect secondary compiler version informationBrad King2017-10-031-0/+1
| | | | | | | | | | | Create a `CMAKE_<LANG>_COMPILER_VERSION_INTERNAL` variable to hold a secondary/internal compiler version number detected at the same time as the primary compiler version. This will be useful for some compilers where we need such a number to determine correct usage. Inspired-by: Stefan Andersson <tfosm@hotmail.com> Suggested-by: Norbert Lange <norbert.lange@andritz.com> Issue: #17264
* Add a CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID variableNorbert Lange2017-06-291-0/+1
| | | | | | | | | | Compilers such as MSVC and IAR may have variants that target different architectures. We have been using a `MSVC_<LANG>_ARCHITECTURE_ID` variable to hold this information for MSVC. Add an alternative with a more general name (later we can port MSVC to it too). This additional information may be needed to generate proper invocations of the compiler based on its architecture variant.
* Merge topic 'lang-specific-binutils'Brad King2017-04-051-2/+2
|\ | | | | | | | | | | | | 73934188 Rename CMAKE_GCC_{AR,RANLIB} to CMAKE_LANG_COMPILER_{AR,RANLIB} Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !656
| * Rename CMAKE_GCC_{AR,RANLIB} to CMAKE_LANG_COMPILER_{AR,RANLIB}Ruslan Baratov2017-04-031-2/+2
| | | | | | | | | | | | The variables recently added by commit b9d36826 (Add 'CMAKE_GCC_AR' and 'CMAKE_GCC_RANLIB' variables, 2017-03-08) are more appropriately managed with language-specific names rather than toolchain-specific names.
* | Xcode: Detect CURRENT_ARCH for use by generatorBrad King2017-03-311-0/+1
|/ | | | | | | During compiler identification, extract the Xcode `CURRENT_ARCH` value and save it for later use by the Xcode generator in an internal compiler information variable. This will be useful to know the locations of object files when only one architecture is built.
* Add 'CMAKE_GCC_AR' and 'CMAKE_GCC_RANLIB' variablesRuslan Baratov2017-03-091-0/+2
|
* Features: Add infrastructure for C++ 17 language standardBrad King2016-12-021-0/+1
| | | | Issue: #16468
* CMakeDetermine*Compiler: Add hook to save custom compiler informationBrad King2016-08-121-0/+1
| | | | | | Provide a way for Platform/<os>-Determine-<lang>.cmake modules to save platform-specific information about the compiler in the configured CMake<lang>Compiler.cmake modules.
* Compiler: Add infrastructure for detecting compiler wrappersChuck Atkins2015-12-071-0/+1
|
* Revert "Disable shared library support when compiler links statically" (#15855)Brad King2015-11-231-1/+0
| | | | | | | | In commit v3.4.0-rc1~18^2 (Disable shared library support when compiler links statically, 2015-09-30) we tried to detect when the compiler is not capable of linking shared libraries (possibly due to flags in use). However, the approach is not robust against flags like `-nostdlib`. Revert it for now pending another solution to the original problem.
* Disable shared library support when compiler links staticallyBrad King2015-09-301-0/+1
| | | | | | | | | When a user or a compiler wrapper adds '-static' to the compiler flags then it will always link static binaries. Detect this from the compiler id binary and disable TARGET_SUPPORTS_SHARED_LIBS. This will prevent projects from accidentally adding shared libraries when the toolchain does not support them. It also helps CMake avoid linking with flags that require shared libraries to be supported.
* Ninja: Detect MSVC /showIncludes prefix with compiler flags (#15596)Brad King2015-09-181-2/+5
| | | | | | | | Move detection over to the compiler id logic where we have already constructed the list of compiler flags from ARG1 and CMAKE_<LANG>_FLAGS. Pass the flags when we execute "cl" with "/showIncludes". Also pass "/c" because we only need to compile, not link. Check the compiler process exit code before trusting its output.
* Ninja: Refactor lookup of cmcldeps locationBrad King2015-09-181-1/+0
| | | | | This executable comes with CMake so just compute its location in cmSystemTools instead of storing it in compiler information modules.
* Project: Determine default language dialect for the compiler.Stephen Kelly2015-09-181-0/+1
| | | | | | Use the __cplusplus and __STDC_VERSION__ macros to automatically determine the default dialect for the compiler while determining its id and version.
* Features: Add support for C++14 features.Stephen Kelly2014-05-221-0/+1
| | | | Record the features implemented by GNU 4.9 and Clang 3.4.
* Features: Add cxx_template_template_parameters.Stephen Kelly2014-04-161-0/+1
| | | | | Extend the existing feature infrastructure as needed to support both C++11 and C++98 features.
* project: Add infrastructure for recording CXX compiler featuresStephen Kelly2014-04-071-0/+3
| | | | | | | | | | | | | | Add a feature test using the compiler macros and the preprocessor to determine available features. Add a CMAKE_CXX_COMPILE_FEATURES variable which contains all features known to the loaded compiler, and a CMAKE_CXX_KNOWN_FEATURES variable containing all features known to CMake. Add language standard specific variables for internal use to determine the standard-specific compile flags to use. This will be extended to other languages in the future. Follow-up commits will add features which will be recorded by the feature test.
* Treat .m files consistently as C across all generatorsTim Blechmann2014-03-201-1/+1
| | | | | | | | | | | | | | | | | Objective C sources should be compiled with the C compiler, not C++. The Xcode generator correctly classifies ".m" sources already. The cmSystemTools::GetFileFormat method was fixed by commit v2.8.0~1782 (fix for 7045, use gcc for .m, 2008-08-19) but it is not used by any of the generator since commit v2.4.0~2819 (major changes to support addition of languages, 2004-09-22). Fix the CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS table entries so that cmGlobalGenerator::GetLanguageFromExtension tells the Makefile, Ninja, and VS IDE generators to compile ".m" sources as C. This makes behavior consistent on all generators. Signed-off-by: Tim Blechmann <tim@klingt.org>
* Ninja: use deps = gcc/msvc featurePeter Kümmel2013-10-241-1/+1
| | | | cmcldeps is now only used for .rc file processing
* CMakeDetermineCompilerId: Add notion of "simulated" id/versionBrad King2013-10-041-0/+2
| | | | | | | | | Some compilers try to simulate other compilers as a drop-in replacement supporting all the same command-line options and predefined preprocessor macros. In such cases it will be useful to have CMake load the compiler information files for the simulated compiler instead of duplicating the information. Teach CMakeDetermineCompilerId to extract the simulated compiler id and version when the compiler id detection provides it.
* OS X: Detect implicit linker framework search pathsBrad King2012-12-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we hard-coded a list of implicit framework directories but did not account for CMAKE_OSX_SYSROOT or for changes to the list across OS X versions. Instead we should automatically detect the framework directories for the active toolchain. The parent commit added the "-Wl,-v" option to ask "ld" to print its implicit directories. It displays a block such as: Framework search paths: /... Parse this block to extract the list of framework directories. Detection may fail on toolchains that do not list their framework directories, such as older OS X linkers. Always treat the paths <sdk>/Library/Frameworks <sdk>/System/Library/Frameworks <sdk>/Network/Library/Frameworks # Older OS X only /System/Library/Frameworks as implicit. Note that /System/Library/Frameworks should always be considered implicit so that frameworks CMake finds there will not override the SDK copies.
* OS X: Always generate -isysroot if any SDK is in useBrad King2012-09-211-1/+1
| | | | | | | | Drop the last use of CMAKE_OSX_SYSROOT_DEFAULT. Replace internal platform variable CMAKE_${lang}_HAS_ISYSROOT with a more general CMAKE_${lang}_SYSROOT_FLAG variable. If the -isysroot flag exists and CMAKE_OSX_SYSROOT points to an SDK (not "/") then always add it to compiler command lines. This is already done in the Xcode IDE.
* Store ABI detection results in compiler information filesBrad King2012-08-241-0/+1
| | | | | | | | | | Drop use of cache entry CMAKE_DETERMINE_<LANG>_ABI_COMPILED and replace it with variable CMAKE_<LANG>_ABI_COMPILED. Since the grandparent commit this test result is specific to the version of CMake. Store it in the version-specific compiler information files instead of CMakeCache.txt so testing can be re-done to meet the requirements of the current version of CMake even if another version of CMake was already used to configure the build tree.
* Move CMAKE_<LANG>_COMPILER_WORKS to compiler information filesBrad King2012-08-241-0/+1
| | | | | | | | Since the parent commit this test result is specific to the version of CMake. Store it in the version-specific compiler information files instead of CMakeCache.txt so testing can be re-done to meet the requirements of the current version of CMake even if another version of CMake was already used to configure the build tree.
* Remove CMake-language block-end command argumentsKitware Robot2012-08-131-4/+4
| | | | | | | | | | | | | | | | | Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Convert CMake-language commands to lower caseKitware Robot2012-08-131-42/+42
| | | | | | | | | | | | | | | | | Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Ninja: don't set cmcldeps vars to empty string when they are not definedPeter Kuemmel2012-06-091-4/+2
|
* Ninja: allow spaces in source pathPeter Kuemmel2012-06-081-0/+5
| | | | And make /showIncude prefix visible for all build rules
* Add framework to detect compiler version with its id (#12408)Brad King2011-12-071-0/+1
| | | | | | | | | | | | | | | | | | | | Teach CMakePlatformId.h to construct an "INFO:compiler_version[]" string literal from macros COMPILER_VERSION_(MAJOR|MINOR|PATCH|TWEAK) to be defined in CMake(C|CXX)CompilerId.(c|cpp) for each compiler. Provide conversion macros DEC() and HEX() to decode decimal or hex digits from integer values. Parse the version out of the compiler id binary along with the other INFO values already present. Store the result in variable CMAKE_<LANG>_COMPILER_VERSION in the format "major[.minor[.patch[.tweak]]]". Save the value persistently in CMake(C|CXX)Compiler.cmake in the build tree. Document the variable for internal use since we do not set it everywhere yet. Report the compiler version on the compiler id result line e.g. The C compiler identification is GNU 4.5.2 Report CMAKE_(C|CXX)_COMPILER_(ID|VERSION) in SystemInformation test.
* Teach find_(library|package) about Linux multiarch (#12037)Brad King2011-06-081-0/+5
| | | | | | | | | | | | | Implement support for multiarch as specified here: http://wiki.debian.org/Multiarch https://wiki.ubuntu.com/MultiarchSpec Detect the <arch> part of <prefix>/lib/<arch> from the implicit library search path from each compiler to set CMAKE_<lang>_LIBRARY_ARCHITECTURE. Define CMAKE_LIBRARY_ARCHITECTURE using one of these values (they should all be the same). Teach the find_library and find_package commands to search <prefix>/lib/<arch> whenever they would search <prefix>/lib.
* Only use .CPP .CXX and .C++ do not work by default with g+++.Bill Hoffman2010-09-021-1/+1
|