Record the availability of this feature for GNU 4.8 on (UNIX AND
NOT APPLE) only. In the future, availability can be recorded for
earlier GNU, for other platforms and for other compilers. Initially
the affected configurations are as restricted as possible to allow
for easy testing while extending the features vector in only one
dimension.
The error message when using the set_property API directly is not
very good, but follow up commits will provide origin debugging of
the property and a target_compile_features command which will
provide a configure-time backtrace when possible.
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.
Store in new platform variables
CMAKE_${lang}_COMPILE_OPTIONS_PIC
CMAKE_${lang}_COMPILE_OPTIONS_PIE
flags for position independent code generation.
In almost all cases, this means duplication of the
CMAKE_SHARED_LIBRARY_${lang}_FLAGS for the _PIC case and using the
assumed pie equivalent for the _PIE case. Note that the GNU compiler
has supported -fPIE since 3.4 and that there is no -fPIC on GNU for
Windows or Cygwin.
There is a possibility that the _PIE variables are not correct.
However, as there is no backwards compatibility to be concerned about
(as the POSITION_INDEPENDENT_CODE property is not used anywhere yet),
the current state suffices.
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.
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.