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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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().
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.
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.
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.
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.
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.
At the top of a build tree we configure inside the CMakeFiles directory
files such as "CMakeSystem.cmake" and "CMake<lang>Compiler.cmake" to
save information detected about the system and compilers in use. The
method of detection and the exact results store varies across CMake
versions as things improve. This leads to problems when loading files
configured by a different version of CMake. Previously we ignored such
existing files only if the major.minor part of the CMake version
component changed, and depended on the CMakeCache.txt to tell us the
last version of CMake that wrote the files. This led to problems if the
user deletes the CMakeCache.txt or we add required information to the
files in a patch-level release of CMake (still a "feature point" release
by modern CMake versioning convention).
Ensure that we always have version-consistent platform information files
by storing them in a subdirectory named with the CMake version. Every
version of CMake will do its own system and compiler identification
checks even when a build tree has already been configured by another
version of CMake. Stored results will not clobber those from other
versions of CMake which may be run again on the same tree in the future.
Loaded results will match what the system and language modules expect.
Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to
CMAKE_PLATFORM_INFO_DIR to clarify its purpose. The new variable points
at the version-specific directory while the old variable did not.
Configure a hand-generated Visual Studio project to build the compiler id
source file since we cannot run the compiler command-line tool directly.
Add a post-build command to print out the full path to the compiler tool.
Parse the full path to the compiler tool from the build output.
Configure a hand-generated Xcode project to build the compiler id source
file since we cannot run the compiler command-line tool directly. Add a
post-build shell script phase to print out the compiler toolset build
setting. Run xcodebuild to compile the identification binary. Parse
the full path to the compiler tool from the xcodebuild output.
Teach CMAKE_DETERMINE_COMPILER_ID to check for variable
CMAKE_${lang}_COMPILER_ID_TOOL after CMAKE_DETERMINE_COMPILER_ID_BUILD
to use as CMAKE_${lang}_COMPILER since it will not be known until after
the IDE runs.
In CMAKE_DETERMINE_COMPILER_ID_BUILD prepare a cascading "if" so we can
use a generator-specific method to compile the identification source
file. Leave "if(0)" as a placeholder for now and put the direct
compiler invocation in "else()". After running the compiler to build
the compiler identification source we file(GLOB) the list of output
files as candidates for extracting the compiler information. An IDE may
create directories, so exclude exclude directories from this list.
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
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.