Commit Graph

86 Commits

Author SHA1 Message Date
Ben Boeckel 29c3edb87a Avoid if() quoted auto-dereference
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.
2014-10-20 11:49:16 -04:00
Brad King d09b60f563 VS: Detect compiler id of Nsight Tegra-Android toolchains
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.
2014-09-29 16:05:53 -04:00
Chuck Atkins 3e84e78c3f Use a more reliable regex for extracting binary INFO strings
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.
2014-09-03 17:00:48 -04:00
Brad King dbb5a7ee31 CMakeDetermineCompilerId: Fix detection for VS ARM platform
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>
2014-08-12 10:08:37 -04:00
Gilles Khouzam b94ddf6cd7 CMakeDetermineCompilerId: Recognize WindowsPhone and WindowsStore
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>
2014-07-31 14:08:48 -04:00
Stephen Kelly 23f451bb33 CompilerId: Guard the platform-default compiler code with a parameter. 2014-05-07 14:00:00 +02:00
Stephen Kelly 36ed589484 CompilerId: Allow specifying the compiler-specific components to generate. 2014-05-07 14:00:00 +02:00
Stephen Kelly 9a083bce83 Project: Split the compiler id detection into a separate function.
This can be extended with parameters to control the output and re-used
in other contexts.
2014-05-07 14:00:00 +02:00
Stephen Kelly 9d285600d4 Project: Generate the CXX compiler Id test from multiple files.
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.
2014-05-07 14:00:00 +02:00
Brad King bbc358c3fc Merge branch 'master' into osx-init-early
Resolve conflict in Source/cmGlobalGenerator.cxx by integrating
changes from both sides.
2014-04-29 09:36:55 -04:00
Brad King 0cce556b5f Xcode: Use sysroot and deployment target to identify compiler
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.
2014-04-29 09:36:15 -04:00
Rolf Eike Beer b0b4b4602f Remove .* expressions from beginning and end of MATCHES regexs
All these expressions work the same:
  "foo"
  ".*foo.*"
  "^.*foo.*$"

This assumes that the "Intel*" expressions were meant to be "Intel.*".
2014-04-14 18:17:11 +02:00
Rolf Eike Beer 5bd48ac534 Replace string(REGEX REPLACE) with string(REPLACE) where possible
The simple replacement is much faster.
2014-04-14 18:17:05 +02:00
Rolf Eike Beer 2622bc3f65 Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
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.
2014-04-14 18:16:58 +02:00
Stephen Kelly e00db59d6c QNX: Introduce QCC compiler id for that QNX platform compiler.
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.
2014-01-22 08:47:32 -05:00
Brad King b891af9290 Merge topic 'xcode-5.1'
65ee85d CMakeDetermineCompilerId: Fix compiler line match for Xcode 5.1
2013-12-19 10:12:18 -05:00
Ted Kremenek 65ee85d0c5 CMakeDetermineCompilerId: Fix compiler line match for Xcode 5.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.
2013-12-09 10:40:42 -05:00
Brad King 520ead7200 Merge topic 'cleanup-build-commands'
e420124 CMakeDetermineCompilerId: Use CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND
0c55729 VS: Add CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND variables
2013-12-05 09:24:59 -05:00
Brad King e4201248ce CMakeDetermineCompilerId: Use CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND
In the code path for launching the VS IDE tools, avoid using
CMAKE_MAKE_PROGRAM.  Instead use the variables CMAKE_VS_DEVENV_COMMAND,
CMAKE_VS_MSBUILD_COMMAND, and CMAKE_VS_MSDEV_COMMAND to lookup the
location of the build tool needed.  Choose the proper tool based on
availability and necessity for the language (e.g. Intel Fortran must
build with devenv.com and not MSBuild.exe).
2013-12-04 11:06:44 -05:00
Stephen Kelly f41ecd1db4 CMakeDetermineCompilerId: Look for internal file only on host
The find_file this module uses to locate the compiler id source file
must always look on the host and never in CMAKE_FIND_ROOT_PATH, even
when a toolchain file has

 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Add NO_CMAKE_FIND_ROOT_PATH to the find_file call to avoid rerooting.
2013-11-19 12:36:27 -05:00
Daniele E. Domenichelli 15610bb5b1 Drop use of configure_file IMMEDIATE option
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
2013-11-13 10:12:17 -05:00
Dragos Carp e65c788767 CMakeDetermineCompilerId: Load src from CMAKE_MODULE_PATH (#14481)
Support new languages using CMAKE_MODULE_PATH.
2013-10-28 08:54:40 -04:00
Brad King 6007f7ca01 CMakeDetermineCompilerId: Always use compiler detected from IDE
When compiler id detection also provides a CMAKE_<LANG>_COMPILER
value, use it unconditionally.  It is known to be the compiler
that is actually in use by IDE builds in VS and Xcode.  Do not
let a stray cache entry try to say otherwise.
2013-10-28 08:36:14 -04:00
Brad King 705ae00491 Quote ${CMAKE_<LANG>_COMPILER} while enabling a language
Even though this variable gets set to CMAKE_<LANG>_COMPILER-NOTFOUND when
the compiler is not found, CMake<LANG>Compiler.cmake gets removed by
cmGlobalGenerator::EnableLanguage so in try compiles the value is empty.
Quote references to the variable in

 Modules/CMake(C|CXX|Fortran)Information.cmake
 Modules/CMakeDetermineCompilerId.cmake

to avoid dropping arguments from commands that expect them.
2013-10-22 14:09:37 -04:00
Brad King 18a253732d CMakeDetermineCompilerId: Do not test vendor without a compiler
If no CMAKE_${lang}_COMPILER is available then do not try to run
it to determine the compiler vendor.
2013-10-22 13:59:56 -04:00
Brad King 1b7117a824 VS 6: Do not try Intel Fortran .vfproj file with msdev
Teach CMakeDetermineCompilerId to skip trying to build a .vfproj
file for Intel Fortran under Visual Studio 6.  The msdev command-line
build produces a popup error dialog that hangs the configuration.
2013-10-19 06:37:22 -04:00
Brad King af40e8c312 VS: Detect Intel Fortran compiler id and version
Teach CMakeDetermineCompilerId to use a .vfproj project file to
build the Fortran compiler id source file under the Visual Studio
generators.
2013-10-18 09:55:59 -04:00
Brad King 2d36c9ab60 CMakeDetermineCompilerId: Fix Intel Fortran compiler id detection
The Intel Fortran compiler needs the /fpp option to enable C
preprocessing.  Without the option the compiler may warn and ignore
preprocessor lines instead of failing with an error.  Detect the
warning and treat it as failure so that we move on to try /fpp and
detect the correct id.  Without this it works only by luck because
Intel is the first compiler id in our detection source file.
2013-10-16 10:37:48 -04:00
Brad King a6fd17ce50 VS: Fix CMAKE_<LANG>_COMPILER detection with Intel toolset (#14471)
When the platform toolset is from Intel, look for "icl.exe" instead of
"cl.exe".
2013-10-16 10:37:48 -04:00
Brad King 5a6c15155c Merge topic 'clang-cl-compiler'
3d8356d Clang: Support Windows variants for GNU and MSVC (#13035, #14458)
51ab85c CMakeDetermineCompilerId: Add notion of "simulated" id/version
be10826 CMakeDetermineCompilerId: Fix local var init
2013-10-08 10:58:56 -04:00
Brad King ea574d98ed Merge topic 'vs-compiler-id-tolerate-diagnostics'
8c891f8 VS: Tolerate diagnostic output while detecting cl (#14387)
2013-10-07 15:42:51 -04:00
Brad King 51ab85c398 CMakeDetermineCompilerId: Add notion of "simulated" id/version
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.
2013-10-04 13:25:06 -04:00
Brad King be10826bf1 CMakeDetermineCompilerId: Fix local var init
Add initialization of the ARCHITECTURE_ID local and fix the
initialization of the COMPILER_ID_TWICE local.
2013-10-04 10:33:16 -04:00
Patrick Gansterer 8bb3b3d344 VS: Use version-specific subsystem for WinCE compiler id (#14440)
The subsystem must be set to WINDWOSCE for some SDKs to link an
executable. Set it to 9 for VS2005 and to 8 for VS2008, since the
value differs between the different Visual Studio versions.
2013-09-25 08:29:03 -04:00
Brad King 8c891f86cc VS: Tolerate diagnostic output while detecting cl (#14387)
When the VS IDE build output setting

  Tools -> Options -> Projects and Solutions ->
   Build and Run -> MSBuild project output verbosity

is set to "Diagnostic" the build output contains a " (TaskId:###)"
suffix on the CMAKE_<lang>_COMPILER= line used to extract the compiler
executable location.  Strip this suffix before checking that the
reported location exists.
2013-09-03 14:04:25 -04:00
Brad King 5b141a7b29 Merge topic 'peheader'
bd827f9 WIN: Use COFF file header header for architecture detection (#14083)
2013-08-06 16:55:15 -04:00
Patrick Gansterer bd827f98ef WIN: Use COFF file header header for architecture detection (#14083)
Read the machine field from the COFF file header to get the exact
target architecture for ARM and SHx on the Windows platform.
2013-08-05 20:04:44 +02:00
Patrick Gansterer b02f09d434 VS: Replace ArchitectureId with PlatformName
Since we do not need the information about the target architecture
we can use the PlatformName only to specify the this information.
This also removes setting of the MSVC_*_ARCHITECTURE_ID variable
which is not required, because this variable gets set by the
compiler detection code in CMAKE_DETERMINE_COMPILER_ID_CHECK().
2013-08-05 13:38:26 +02:00
Patrick Gansterer 4b15dc855d VS: Set CMAKE_VS_PLATFORM_NAME for VS7 and VS71 too
Move the code which sets CMAKE_VS_PLATFORM_NAME from
cmGlobalVisualStudio8Generator to cmGlobalVisualStudio7Generator.
2013-08-05 13:38:23 +02:00
Patrick Gansterer 60e568cf79 VS10: Do not set the TargetMachine when detecting the compiler
The Microsoft linker is intelligent enough to detect the target
machine type depending on the input files. This allows us to
get the target architecture from the compiler instead of
maintaining the mapping to the platform name.
2013-08-05 13:38:21 +02:00
Patrick Gansterer dfbfe6f166 VS6: Hardcode id_machine_6 for compiler detection
id_machine6 is never set to an other value than x86. So it is
safe to remove the replacements with "x86" directly.
2013-08-05 13:38:19 +02:00
Alexander Mohr e4c046521f VS: Detect MSVC compiler id on ARM toolchain
This enables detection with the VS2012 CTP for windows Blue (8.1).
To build native ARM you need to have the WOA SDK (Windows on ARM).
2013-05-08 09:10:52 -04:00
Brad King f980a80495 Xcode: Implement generator toolset selection (#9831, #13802)
Implement generator toolset selection (cmake -T) for Xcode > 2.0 by
adding the GCC_VERSION build setting to project files.
2013-02-07 11:07:48 -05:00
Patrick Gansterer 8e85822e2b VS: Add the entry point when compiling for WindowsCE
Set the entry point to mainACRTStartup to make sure that main()
can be found when linking the application to check the compiler.
2012-11-30 15:15:06 +01:00
Patrick Gansterer 5bf9fd8253 VS: Set the correct SubSystem when determinating the CompilerId
Some WinCE linker only work when the subsystem is set to WINDOWSCE.
2012-11-30 14:14:27 +01:00
Patrick Gansterer 40c36c9f7b VS: Make DetermineCompilerId working with WinCE too
Add a dummy mainCRTStartup() function, since the linker searches for
it instead of main() and set the CMAKE_SYSTEM_* variables depending
on the MSVC_C_ARCHITECTURE_ID and CMAKE_VS_WINCE_VERSION variables.
2012-11-27 08:31:19 -05:00
Patrick Gansterer d41d4d3d61 VS: Add CMAKE_VS_PLATFORM_NAME definition to cmMakefile
When adding more platforms to the Visual Studio generators a simple
regular expressing can not handle all cases anymore. This new
define holds the name of the Visual Studio target platform.
2012-11-26 09:33:24 -05:00
Patrick Gansterer 14861f88d2 VS: Remove TargetMachine for linker when checking compiler id
If the TargetMachine isn't defined the linker will choose
the correct target depending on the input file. This helps
us later with additional compiler platforms for WinCE.
2012-11-20 19:15:39 +01:00
Brad King df928646ba OS X: Ignore MACOSX_DEPLOYMENT_TARGET during Xcode compiler id
Xcode honors this environment variable if the project file does not set
it.  Hide it from Xcode while building the compiler id project.
2012-09-24 14:44:07 -04:00
Brad King 7ee3cee919 VS11: Add VS 2012 Express support (#13348)
Use the registry entries that vsvars32.bat uses to detect the location of
MSBuild.exe in the framework directory.  Invoke MSBuild with the option

 /p:VisualStudioVersion=$version

so it knows from which VS version to load the system build rules.  Teach
cmGlobalVisualStudio11Generator to set its ExpressEdition member using the
registry.
2012-09-18 14:03:02 -04:00