The API for retrieving per-config COMPILE_DEFINITIONS has long
existed because of the COMPILE_DEFINITIONS_<CONFIG> style
properties. Ensure that the provided configuration being generated
is also used to evaluate the generator expressions
in cmTarget::GetCompileDefinitions.
Both the generic COMPILE_DEFINITIONS and the config-specific
variant need to be evaluated with the requested configuration. This
has the side-effect that the COMPILE_DEFINITIONS does not need to
be additionally evaluated with no configuration, so the callers can
be cleaned up a bit too.
In some languages the compiler may need to know the path of the final
target file for which an object is being compiled. Honor the <TARGET>
placeholder for compilation rules to support such cases.
Note that this cannot work with OBJECT library targets because the final
target path is not known during compilation (there can even be more than
one final target).
Suggested-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This allows a dependee to inform a target that it should have its
POSITION_INDEPENDENT_CODE property set to ON, or OFF. The value of
the POSITION_INDEPENDENT_CODE property, if set, must be consistent
with any INTERFACE_POSITION_INDEPENDENT_CODE properties on dependees.
Add a test covering the consistency checks on platforms where they run.
Use cmComputeLinkInformation::GetFrameworkPaths to get the list of
framework paths needed by the linker. Drop the now unused framework
information from the old-style cmTarget link dependency analysis.
Commit 08cb4fa4 (Process generator expressions in the
INCLUDE_DIRECTORIES property, 2012-09-18) contained an incorrect
assumption that CMAKE_BUILD_TYPE was set on the makefile for each
generated configuration in multi-config generators. Fix that by making
the GetIncludeDirectories API depend on the config.
2ccca05 Run PDBDirectoryAndName test on MSVC and Intel
efc83b3 Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6
b294457 Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
3f60dbf Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
This enables changing the name and output folder of the debug symbol
files produced by MS compilers.
Inspired-by: Thomas Bernard <thomas.bernard@ipetronik.com>
This way we don't need to check the definitions from the Makefile when
generating later, and can more easily add generator expressions.
Duplication is not a problem as the definitions are de-duplicated before
generating.
There is no need to do so. Be consistent with include directories and
ensure uniqueness.
This requires changing the API of the cmLocalGenerator::AppendDefines
method, and changing the generators to match.
The test unfortunately can't test for uniqueness, but it at least verifies
that nothing gets lost.
CMAKE_SHARED_LIBRARY_<lang>_FLAGS has flags on various platforms for a
variety of purposes that are correlated with shared libraries but not
exclusive to them. Refactor generation of these flags to use new
purpose-specific platform variables
CMAKE_<lang>_COMPILE_OPTIONS_DLL
CMAKE_<lang>_COMPILE_OPTIONS_PIC
CMAKE_<lang>_COMPILE_OPTIONS_PIE
Activate the DLL flags specifically for shared libraries. Add a new
POSITION_INDEPENDENT_CODE target property to activate PIC/PIE flags, and
default to true for shared libraries to preserve default behavior.
Initialize the new property from CMAKE_POSITION_INDEPENDENT_CODE to
allow easy global configuration in projects.
Although the default behavior is unchanged by this refactoring, the new
approach ignores CMAKE_SHARED_LIBRARY_<lang>_FLAGS completely. We must
leave it set in case projects reference the value. Furthermore, if a
project modifies CMAKE_SHARED_LIBRARY_<lang>_FLAGS it expects the new
value to be used. Add policy CMP0018 to handle compatibility with
projects that modify this platform variable.
Add a PositionIndependentCode test on platforms where we can get
meaningful results.
Header files listed in a target's PUBLIC_HEADER or similar properties
are marked as OS X Framework content. Refactoring performed by
commit 11d9b211 (Add cmGeneratorTarget to represent a target during generation, 2012-03-07)
commit 45c2f932 (Simplify cmMakefileTargetGenerator using cmGeneratorTarget, 2012-03-07)
commit 328c0f65 (Simplify cmVisualStudio10TargetGenerator source classification, 2012-03-19)
and related commits accidentally removed such files from treatment as
normal header files by the VS generator (generators other than Makefiles
and Xcode). Move handling of such files out of cmGeneratorTarget and
back to cmMakefileTargetGenerator. The central cmGeneratorTarget
classification will always treat them as header or extra sources.
For now do not allow an OBJECT library to reference other object
libraries. Teach cmTarget::ComputeLinkImplementation to include the
languages of object libraries used by a target.
Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked
during cmGeneratorTarget construction. Implement it in the Makefile
generator to pre-compute all object file names for each target. Use
the results during generation instead of re-computing it later.
Eliminate callers of cmMakefile::GetIncludeDirectories.
All callers of GetIncludeDirectories should go through the local generator
object.
Only the local generator calls cmTarget::GetIncludeDirectories directly.
Teach the Windows-GNU.cmake platform file to look for Visual Studio
tools matching the target ABI. Add an extra step to the link command
for shared libraries and executables that export symbols and on which a
new GNUtoMS property is set (initialized by the CMAKE_GNUtoMS option).
Tell the GNU linker to output a module definition (.def) file listing
exported symbols in addition to the GNU-format import library (.dll.a).
Pass the .def file to the MS "lib" tool to construct a MS-format DLL
import library (.lib).
Teach the install(TARGETS) command to install the MS import library next
to the GNU one. Teach the install(EXPORT) and export() command to set
the IMPORTED_IMPLIB property pointing at the import library to use the
import library matching the tools in the importing project.
Define a "Fortran_FORMAT" target and source file property. Initialize
the target property from a "CMAKE_Fortran_FORMAT" variable. Interpret
values "FIXED" and "FREE" to indicate the source file format. Append
corresponding flags to the compiler command line.
Older versions of GCC, the HP compiler, and the SGI MIPSpro compiler do
not like the use of make_pair in this case and the conversions it
requires:
a value of type "const char *" cannot be used to initialize an entity
of type "char [1]"
/usr/include/g++-3/stl_pair.h:68: assignment of read-only location
Instead use a map lookup pattern already used throughout the rest of our
source tree.
Create platform option CMAKE_<lang>_USE_RESPONSE_FILE_FOR_INCLUDES to
enable use of response files for passing the list of include directories
to compiler command lines.
Move the GetDefineFlags call from cmLocalGenerator::GetIncludeFlags to
all call sites so that the method exclusively constructs a string of
include search path flags.
Commit 60cd72d0 (Cleaned up generation of symbolic rules, 2006-02-15)
incorrectly made these Makefile targets .PHONY even though the build
rule touches an actual file. Correct it so that the copy_f90_mod and
touch steps do not happen on every "make".
Commit 34e1ac24 (Create Fortran info variables for .mod behavior,
2010-11-12) incorrectly taught GetFortranModuleDirectory to return a
relative path. We really want to use "." as the module directory only
as a workaround for compilers that do not do so by default. Therefore
we need this default only when generating the compiler command line and
not when scanning dependencies.
Revert the previous change to GetFortranModuleDirectory and apply the
change only at one of its call sites.
Define CMAKE_Fortran_MODDIR_DEFAULT and CMAKE_Fortran_MODOUT_FLAG
variables to help some Fortran compilers generate .mod files in the
current working directory.