summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeCXXCompiler.cmake.in
Commit message (Collapse)AuthorAgeFilesLines
* 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-081-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
|
* Let CMake recognize .CPP .CXX and .C++ as c++ files.Bill Hoffman2010-09-021-2/+2
|
* Fix issue #10155 - default value of CMAKE_OSX_DEPLOYMENT_TARGET should ↵David Cole2010-01-291-0/+1
| | | | always be the empty string. When the value of CMAKE_OSX_DEPLOYMENT_TARGET is the empty string, the -mmacosx-version-min flag should not show up on the compiler command line. The logic for selecting default value of CMAKE_OSX_SYSROOT is orthogonal to and independent of the value of the deployment target. The default value for CMAKE_OSX_SYSROOT is the SDK that corresponds to the current version of Mac OSX on which cmake is running.
* -also put CMAKE_LINKER in the C and CXX compiler information filesAlexander Neundorf2010-01-221-0/+1
| | | | | | This is already done for assembler and is necessary for e.g. Symbian. Alex
* Change the way 32/64 bit compiles are detected with MSVC and intel makefile ↵Bill Hoffman2009-11-201-0/+1
| | | | builds. Use the platform ID preprocessor approach.
* Fix check for -isysroot on OS XBrad King2009-09-191-0/+2
| | | | | | | | | | | Previously we checked for this flag by parsing the version number of GCC out of 'gcc --version', but this is not reliable because the format can vary greatly. Now we run 'gcc -v --help' and look for '-isysroot' in the list of options. We also now store the result on a per-language basis in the per-compiler info file "CMake<LANG>Compiler.cmake". This is necessary to make it accessible from try-compile projects so that they generate correctly.
* Do not always propagate linker language preferenceBrad King2009-07-301-0/+1
| | | | | | | | | | | | The commit "Consider link dependencies for link language" taught CMake to propagate linker language preference from languages compiled into libraries linked by a target. It turns out this should only be done for some languages, such as C++, because normally the language of the program entry point (main) should be used. We introduce variable CMAKE_<LANG>_LINKER_PREFERENCE_PROPAGATES to tell CMake whether a language should propagate its linker preference across targets. Currently it is true only for C++.
* ENH: Implicit link info for C, CXX, and FortranBrad King2009-07-231-0/+3
| | | | | | | | | | | | | This teaches CMake to detect implicit link information for C, C++, and Fortran compilers. We detect the implicit linker search directories and implicit linker options for UNIX-like environments using verbose output from compiler front-ends. We store results in new variables called CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES The implicit libraries can contain linker flags as well as library names.
* ENH: Generalize the check for sizeof void* to detect more ABI information.Brad King2008-01-211-3/+11
|
* ENH: second try for handling the linker language with integer priority ↵Alexander Neundorf2007-07-121-1/+1
| | | | | | values (returning a pointer to a string on the stack is no good idea) Alex
* COMP: revert last commit for now, broke Visual StudioAlexander Neundorf2007-07-111-1/+1
| | | | Alex