summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Ninja: Fix clang-cl /showIncludes prefix detectionBrad King2016-05-031-2/+2
| | | | | | | | | We run MSVC-like compilers with the `/showIncludes` option and match the output to extract the corresponding message. Fix the matching to support compilers like `clang-cl` that print the message on the first line such that it is not preceded by a newline. LLVM-Issue: https://llvm.org/bugs/show_bug.cgi?id=27226
* Merge topic 'remove-vs6-generator'Brad King2016-03-101-11/+2
|\ | | | | | | | | | | b42866a3 Drop Visual Studio 6 generator cd9ba3ec cmLocalVisualStudio7Generator: Fix name of helper function
| * Drop Visual Studio 6 generatorBrad King2016-03-091-11/+2
| | | | | | | | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* | CMakeDetermineCompilerId: Add detection of clang.exe bundled with VSMariusz PluciƄski2016-03-101-1/+5
|/ | | | | When using a clang toolset we need to find `clang.exe` instead of `cl.exe`.
* Merge topic 'vs-compiler-id-itanium'Brad King2016-01-071-3/+0
|\ | | | | | | | | d9bf5206 CMakeDetermineCompilerId: Fix VS Itanium platform name (#15889)
| * CMakeDetermineCompilerId: Fix VS Itanium platform name (#15889)Brad King2015-12-211-3/+0
| | | | | | | | | | | | | | VS expects the platform to be just `Itanium`, so drop the incorrect special case mapping it to `ia64`. This platform name has been wrong since the logic was added by commit v2.8.10~148^2~8 (VS: Detect the compiler id and tool location, 2012-08-16).
| * Merge branch 'revert-compiler-links-statically' into releaseBrad King2015-11-231-8/+0
| |\
* | | Compiler: Add infrastructure for detecting compiler wrappersChuck Atkins2015-12-071-0/+6
| | |
* | | Merge topic 'revert-compiler-links-statically'Brad King2015-11-241-8/+0
|\ \ \ | |/ / |/| / | |/ | | 9682de56 Revert "Disable shared library support when compiler links statically" (#15855)
| * Revert "Disable shared library support when compiler links statically" (#15855)Brad King2015-11-231-8/+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.
* | Merge topic 'vs-win10-sdk'Brad King2015-10-021-0/+3
|\ \ | |/ |/| | | | | | | | | 3f077996 VS: Add support for selecting the Windows 10 SDK (#15670) 5dfc4c5f VS: Add hook to initialize Windows platform settings 61c472a2 cmSystemTools: Add VersionCompareGreater helper
| * VS: Add support for selecting the Windows 10 SDK (#15670)Gilles Khouzam2015-10-021-0/+3
| | | | | | | | | | | | | | | | | | Teach the VS 2015 generator to produce a WindowsTargetPlatformVersion value. Use the CMAKE_SYSTEM_VERSION to specify the version and if not set choose a default based on available SDKs. Activate this behavior when targeting Windows 10. Co-Author: Brad King <brad.king@kitware.com>
* | Disable shared library support when compiler links staticallyBrad King2015-09-301-0/+8
|/ | | | | | | | | 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-0/+31
| | | | | | | | 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.
* CMakeDetermineCompilerId: Drop unused code pathBrad King2015-09-181-23/+11
| | | | | The execute_process command always exists so we never need to fall back on exec_program.
* Project: Determine default language dialect for the compiler.Stephen Kelly2015-09-181-0/+5
| | | | | | Use the __cplusplus and __STDC_VERSION__ macros to automatically determine the default dialect for the compiler while determining its id and version.
* CMakeDetermineCompilerId: Use per-language regex to match Xcode compiler toolBrad King2015-06-301-9/+6
| | | | | | Move the Ld invocation match expression from CMakeDetermineCompilerId into CMakeDetermine{C,CXX,Fortran}Compiler so that it can be specified on a per-language basis.
* CMakeDetermineCompilerId: Simplify src reference in IDE projectsBrad King2015-06-251-2/+2
| | | | | | | | When constructing the "id_src" value for substitution into VS or Xcode compiler id projects, the input "src" variable already contains the file name with no path so we do not need get_filename_component. We know this because CMAKE_DETERMINE_COMPILER_ID_WRITE already references "${src}" with this assumption.
* CMakeDetermineCompilerId: Try matching compiler output to detect idBrad King2015-06-181-0/+19
| | | | | | Some compilers can only be distinguished by their compilation output rather than preprocessor symbols or special flags. Add infrastructure to determine the compiler id by matching output.
* CMakeDetermineCompilerId: Refactor id build/check loop logicBrad King2015-06-181-5/+6
| | | | | | | | Callers of CMAKE_DETERMINE_COMPILER_ID initialize the CMAKE_${lang}_COMPILER_ID to unset so we can check it at the end of each loop iteration instead of the beginning. This approach allows us to break out of the loop as soon as we succeed. It will also allow checks to be added in more places within the loop later.
* CMakeDetermineCompilerId: Optionally try some flags before no flagsBrad King2015-06-181-1/+3
| | | | | | | | Teach CMAKE_DETERMINE_COMPILER_ID to optionally try detecting the compiler id using some given flags before trying to detect it with no special flags. This will be useful for Fortran detection to distinguish some compilers that use the preprocessors of others but have no macro of their own by getting verbose output.
* MSVC: Distinguish among ARM architectures more precisely (#14552)Gunnar Roth2015-02-241-2/+0
| | | | | Detect the exact ARM architecture instead of just "ARM". Treat "ARM" as an architecture family that includes THUMB (ARMV4I and ARMV5I).
* Fortran: Add infrastructure to detect compiler version (#15372)Brad King2015-02-191-1/+40
| | | | | | | | Fortran does not offer syntax to compose a string literal at preprocessing time from numeric compuations. Instead encode each digit of each component as a separate INFO string and compose them in CMake code after extraction. Support MAJOR, MINOR, PATCH, and TWEAK components with up to 8 digits each.
* Merge topic 'fix-qcc-compiler-id'Brad King2015-01-161-1/+1
|\ | | | | | | | | 9c9bc712 QNX: Fix detection of QCC compiler id (#15349)
| * QNX: Fix detection of QCC compiler id (#15349)Brad King2015-01-141-1/+1
| | | | | | | | | | | | | | In commit v3.1.0-rc1~113^2 (Use a more reliable regex for extracting binary INFO strings, 2014-09-03) the matching of INFO: strings was made more strict and no longer matches just "INFO:qnxnto". Use "INFO:qnxnto[]" instead to conform to the new pattern.
* | Merge topic 'xcode-ios-compiler-id'Brad King2015-01-121-5/+0
|\ \ | | | | | | | | | | | | 7b7209f6 Xcode: Do not require code signing for compiler id (#15214)
| * | Xcode: Do not require code signing for compiler id (#15214)Brad King2015-01-111-5/+0
| |/ | | | | | | | | | | | | | | The approach in commit v3.1.0-rc1~1^2 (Xcode: Fix compiler id detection when code signing is required, 2014-10-22) still requires a code signing key when targeting a real device. Instead set CODE_SIGNING_REQUIRED to "NO" to tell Xcode not to sign at all. Drop the corresponding setting of the code signing identity.
* | Merge topic 'xcode-ios-compiler-id'Brad King2014-11-101-1/+1
|\ \ | |/ | | | | | | 7f89552a Xcode: Fix compiler path detection for iOS tools on Xcode <= 5.0 (#15237)
| * Xcode: Fix compiler path detection for iOS tools on Xcode <= 5.0 (#15237)Brad King2014-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | Since commit v3.1.0-rc1~1^2~1 (Xcode: Fix compiler id detection for iOS tools, 2014-10-22) our compiler id detection project sets the product type to 'com.apple.product-type.bundle.unit-test'. This causes the Ld command line on which we match the path to the compiler to have a 'CompilerIdC.xctest/' component. The commit updated our regex to match this, but placed it before the extra './' component that Xcode 5.0 and below produce. Xcode <= 5.0 prints '/./CompilerIdC.xctest/', so switch the order of the two components in the regex to match it.
* | Merge topic 'xcode-ios-compiler-id'Brad King2014-10-231-2/+17
|\ \ | |/ | | | | | | | | b91020f6 Xcode: Fix compiler id detection when code signing is required c48f6e12 Xcode: Fix compiler id detection for iOS tools (#15214)
| * Xcode: Fix compiler id detection when code signing is requiredBrad King2014-10-221-0/+5
| | | | | | | | | | | | | | | | | | | | The iOS product type 'com.apple.package-type.bundle.unit-test' requires code signing on Xcode 6. Other iOS target types do too. Until CMake learns to add the CODE_SIGN_IDENTITY build attribute itself, toolchain files can set CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY to tell the Xcode generator to add the attribute. Teach CMakeDetermineCompilerId to recognize this variable and add the CODE_SIGN_IDENTITY build attribute to the compiler id project.
| * Xcode: Fix compiler id detection for iOS tools (#15214)Brad King2014-10-221-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 0cce556b (Xcode: Use sysroot and deployment target to identify compiler, 2014-04-29) our compiler id detection project uses the target platform SDK in case Xcode selects a different compiler based on it. Now the compiler id project actually compiles with the target compiler and SDK when cross-compiling. The iOS tools do not support the 'com.apple.product-type.tool' product type we use in our compiler id detection project. When targeting iPhone, use product type 'com.apple.product-type.bundle.unit-test' instead.
* | Avoid if() quoted auto-dereferenceBen Boeckel2014-10-201-1/+1
|/ | | | | | | When testing CMAKE_<LANG>_COMPILER_ID values, do not explicitly dereference or quote the variable. We want if() to auto-dereference the variable and not its value. Also replace MATCHES with STREQUAL where equivalent.
* VS: Detect compiler id of Nsight Tegra-Android toolchainsBrad King2014-09-291-4/+18
| | | | | | | | | | Teach CMakeDetermineCompilerId to recognize the Tegra-Android platform and generate a test project for Nsight Tegra tools. Locate the full path to CMAKE_<LANG>_COMPILER by computing it within the test project build environment. Also teach CMakeFindBinUtils that this variant of the Visual Studio generator uses UNIX-like instead of MS-like archiving and linking tools.
* Use a more reliable regex for extracting binary INFO stringsChuck Atkins2014-09-031-1/+1
| | | | | | | A few different regular expressions were being used in various places to extract info strings from binaries. This uses a consistent regex amongst all of them now. This also fixes the broken ABI detection for Cray compilers.
* CMakeDetermineCompilerId: Fix detection for VS ARM platformBrad King2014-08-121-0/+5
| | | | | | | | | Add WindowsSDKDesktopARMSupport to the compiler id .vcxproj to avoid 'error MSB8022: Compiling Desktop applications for the ARM platform is not supported.' from VS. Inspired-by: Minmin Gong <minmin.gong@gmail.com> Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
* CMakeDetermineCompilerId: Recognize WindowsPhone and WindowsStoreGilles Khouzam2014-07-311-0/+12
| | | | | | | | | When CMAKE_SYSTEM_NAME is set to target one of these, add ApplicationType and ApplicationTypeRevision elements to the .vcxproj file used to identify the compiler so that the WindowsPhone or WindowsStore toolchains can work. Co-Author: Brad King <brad.king@kitware.com>
* CompilerId: Guard the platform-default compiler code with a parameter.Stephen Kelly2014-05-071-0/+1
|
* CompilerId: Allow specifying the compiler-specific components to generate.Stephen Kelly2014-05-071-1/+4
|
* Project: Split the compiler id detection into a separate function.Stephen Kelly2014-05-071-74/+2
| | | | | This can be extended with parameters to control the output and re-used in other contexts.
* Project: Generate the CXX compiler Id test from multiple files.Stephen Kelly2014-05-071-0/+77
| | | | | | This will allow sharing of the logic of the order to test compilers in and the preprocessor macros used to do that and to determine the version components.
* Merge branch 'master' into osx-init-earlyBrad King2014-04-291-18/+13
|\ | | | | | | | | Resolve conflict in Source/cmGlobalGenerator.cxx by integrating changes from both sides.
| * Remove .* expressions from beginning and end of MATCHES regexsRolf Eike Beer2014-04-141-7/+7
| | | | | | | | | | | | | | | | | | All these expressions work the same: "foo" ".*foo.*" "^.*foo.*$" This assumes that the "Intel*" expressions were meant to be "Intel.*".
| * Replace string(REGEX REPLACE) with string(REPLACE) where possibleRolf Eike Beer2014-04-141-1/+1
| | | | | | | | The simple replacement is much faster.
| * Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)Rolf Eike Beer2014-04-141-10/+5
| | | | | | | | | | | | The matches have already been calculated and can simply be taken from CMAKE_MATCH_n variables. This avoids multiple compilations of the same or very similar regular expressions.
* | Xcode: Use sysroot and deployment target to identify compilerBrad King2014-04-291-0/+11
|/ | | | | | | | Use CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET to set the Xcode SDKROOT and MACOSX_DEPLOYMENT_TARGET build settings. This is necessary because some versions of Xcode select a different compiler based on these settings. We need to make sure the compiler identified during language initialization matches what will be used for the actual build.
* QNX: Introduce QCC compiler id for that QNX platform compiler.Stephen Kelly2014-01-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Introduce policy CMP0047 to control resetting the id for compatibility. De-duplicate content in the QNX platform file by including the GNU one. QNX is a form of GNU platform. Do not clear CMAKE_SHARED_LIBRARY_${lang}_FLAGS variables. They are populated again later by the Compiler/GNU.cmake file anyway. Modify the CMAKE_CXX_COMPILE_OBJECT variable only when the QCC compiler id is in use, and the language is CXX. Use the QNX recommended flag for QCC instead of the gcc compatible -x flag. Populate new module files to handle system includes and depfiles when using the QCC compiler. Remove code which unsets the system include and depfiles related variables. When a GNU driver is used instead of the QCC one, the appropriate flags will be used. These variables were previously cleared for lowest-common-denominator compatibility with both drivers.
* Merge topic 'xcode-5.1'Brad King2013-12-191-1/+1
|\ | | | | | | | | 65ee85d CMakeDetermineCompilerId: Fix compiler line match for Xcode 5.1
| * CMakeDetermineCompilerId: Fix compiler line match for Xcode 5.1Ted Kremenek2013-12-091-1/+1
| | | | | | | | | | | | Xcode 5.1 output no longer puts "./" in the path to the linker output for the CompilerId test binary. Update our regex to match the path with or without the component.
* | Merge topic 'cleanup-build-commands'Brad King2013-12-051-14/+23
|\ \ | | | | | | | | | | | | | | | e420124 CMakeDetermineCompilerId: Use CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND 0c55729 VS: Add CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND variables