Commit Graph

119 Commits

Author SHA1 Message Date
Stephen Kelly 9ce1b9ef29 Add CMAKE_BUILD_INTERFACE_INCLUDES build-variable.
This makes

 set(CMAKE_BUILD_INTERFACE_INCLUDES ON)

add the equivalent of

 set_property(TARGET tgt APPEND PROPERTY
   INTERFACE_INCLUDE_DIRECTORIES
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}>
 )

to every target.

If the headers are in CMAKE_CURRENT_SOURCE_DIR, and the generated headers
are in CMAKE_CURRENT_BINARY_DIR, this is a convenient way to build a target
bar, which depends on foo, just by using target_link_libraries() and adding
the INTERFACE_INCLUDE_DIRECTORIES to the INCLUDE_DIRECTORIES of the target
being linked. There will be more-convenient porcelain API to consume the
property in the future.
2013-01-08 14:14:27 -05:00
Brad King c2cde7f104 Merge topic 'osx-implicit-link-dirs'
cc676c3 OS X: Detect implicit linker framework search paths
2dd67c7 OS X: Detect implicit link directories on modern toolchains
ba58d0c OS X: Link with all framework search paths, not just the last
2013-01-07 14:23:04 -05:00
Stephen Kelly 0941d6232a Add a way to print the origins of used include directories. 2013-01-03 13:45:40 -05:00
Brad King cc676c3a08 OS X: Detect implicit linker framework search paths
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.
2012-12-11 15:15:52 -05:00
Brad King 017d90c500 Documentation: Clarify handling of implicit link directories
Extend documentation for CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES to
explain how it is used by CMake and how it can be influenced by
environment variables.

Inspired-by: Alex Neundorf <neundorf@kde.org>
2012-12-11 14:00:23 -05:00
Brad King ed9763136a Optionally skip link dependencies on shared library files
Add target property LINK_DEPENDS_NO_SHARED and initialization variable
CMAKE_LINK_DEPENDS_NO_SHARED to enable this behavior.

Suggested-by: Leif Walsh <leif.walsh@gmail.com>
2012-10-26 08:28:16 -04:00
Brad King 15cc55fe08 Merge topic 'documentation-cleanup'
4ad0233 Remove period at the end of the check message.
50b1ea5 Fix minor typos.
19c3206 Remove unused parameter marker and the unused parameter.
9d462b2 Document that generator expressions can be used in target properties.
daf88c3 Fix punctuation in some variables documentation.
3172cde Fix the layout of the generator expression documentation.
2012-10-01 14:05:44 -04:00
Stephen Kelly daf88c3698 Fix punctuation in some variables documentation. 2012-09-29 18:42:56 +02:00
Yuchen Deng 3f60dbf148 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>
2012-09-25 15:23:35 -04:00
Rolf Eike Beer f35e35b058 add documentation for all MSVCxxx version variables (#12567) 2012-09-18 08:45:01 +02:00
Brad King 0d094e3a77 Merge topic 'msvc-compiler-info'
32b7c72 Merge branch 'cmake-platform-info-version' into msvc-compiler-info
f3ddfef Modernize MSVC compiler information files
485a940 VS: Simplify MSVC version reporting
32db033 VS: Remove support for "free" version 2003 tools
2012-08-30 11:06:30 -04:00
David Cole 34a0284603 Merge topic 'ide-compiler-id'
403ead6 Document CMAKE_<LANG>_COMPILER_(ID|VERSION) values
8be51f6 Test variables CMAKE_(C|CXX|Fortran)_COMPILER(|_ID|_VERSION)
ec22a9b Cleanly enable a language in multiple subdirectories
66cb335 VS: Detect the compiler id and tool location
89595d6 VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable
965a69d Xcode: Detect the compiler id and tool location
9a9e1ee CMakeDetermineCompilerId: Prepare to detect IDE compiler id
b8b5c83 Re-order C/C++/Fortran compiler determination logic
2012-08-24 14:25:40 -04:00
David Cole 56591cb9b4 Merge topic 'pic-docs'
c82fbe0 Fix unfortunate documentation error for PIC feature.
2012-08-24 14:24:01 -04:00
David Cole 4f7731d814 Merge topic 'minor-docs-fixes'
ee949d8 Remove duplicate 'of' from docs.
ecc1acb Remove incorrect doc string for link type enum
805f5e5 Fix some typos in the docs.
389d423 Add missing whitespace to docs.
2012-08-24 14:23:52 -04:00
Brad King 32db033b27 VS: Remove support for "free" version 2003 tools
Several more recent Visual Studio Express editions are now available and
they support debug builds.  Simplify our VS platform files by removing
support for these old tools.  If anyone still uses them we can restore
support with a more modern way to test for them.
2012-08-23 10:51:27 -04:00
Brad King 403ead6594 Document CMAKE_<LANG>_COMPILER_(ID|VERSION) values
These values are now available almost everywhere and are tested.
Document them for general use and list possible ID values.
2012-08-22 16:35:54 -04:00
Brad King 89595d6bce VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable
When the VS 10 generator selects a non-default PlatformToolset to
specify for MSBuild, report the selected name in this variable.
2012-08-22 16:35:46 -04:00
Stephen Kelly c82fbe0c1f Fix unfortunate documentation error for PIC feature.
The wrong variable is documented, and it is not referred to in
the target-specific property.
2012-08-20 22:33:27 +02:00
Stephen Kelly 805f5e5c1e Fix some typos in the docs.
s/static the static/the static/

Make Visual Studio capitalized.
2012-08-19 23:31:09 +02:00
Eric NOULARD d593cef58f Enhance DESTDIR documentation. Fixes #0012374. 2012-08-14 20:15:22 +02:00
Zack Galbreath 76d6c59358 Clean up documentation formatting so that it is rendered properly in HTML. 2012-08-03 14:52:32 -04:00
Rolf Eike Beer ee158b367c fix 2 space bugs in variable documentation 2012-06-27 23:44:54 +02:00
Stephen Kelly bd34963002 Refactor generation of shared library flags
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.
2012-06-12 15:38:48 -04:00
David Cole db1857e142 Merge topic 'CPackNSIS-warnDESTDIRandABSOLUTE'
4986d52 Use CPACK_xxx and CMAKE_xxx in a consistent way.
f90223c Fix KWStyle warning
47f0dbd CPack add necessary check to detect/warns/error on ABSOLUTE DESTINATION
6ba055b CPack add easy possibility to warn about CPACK_SET_DESTDIR
2012-05-24 13:38:03 -04:00
Eric NOULARD 4986d525af Use CPACK_xxx and CMAKE_xxx in a consistent way.
CMAKE_xxx vars are now used in the CMake-generated cmake_install.cmake
script while CPACK_xxx equivalent vars are used from within CPack.
CPack is responsible for getting/forwarding definitions of
CPACK_xxxx var corresponding to CMAKE_xxxx when invoking
CMake-generated install scripts.
As a consequence:
CMAKE_ABSOLUTE_DESTINATION_FILES
CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
may be used from outside CPack as well.
e.g.
cmake -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=1 -P cmake_install.cmake
works as expected.
2012-05-20 17:28:54 +02:00
Alex Neundorf b71e731b9b -add docs for ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
Alex
2012-05-14 22:19:30 +02:00
David Cole 50f9db9b00 Merge topic 'skip-install-rpath'
635bf50 Add an option to skip RPATH during installation.
2012-03-06 15:27:54 -05:00
Stephen Kelly 635bf50c27 Add an option to skip RPATH during installation. 2012-03-05 22:24:57 +01:00
Stephen Kelly 761c146a4c Add default initializers for WIN32_EXECUTABLE and MACOSX_BUNDLE
This allows downstreams to use

set(CMAKE_WIN32_EXECUTABLE ON)
set(CMAKE_MACOSX_BUNDLE ON)

to create executables with the WIN32_EXECUTABLE and MACOSX_BUNDLE
properties set on by default.
2012-03-05 15:50:55 +01:00
David Cole 0ee7b8ea03 Merge topic 'find_package-improve-messages'
eeaaffc find_package: Test error and warning messages in failure cases
52dffb9 Merge branch 'test-CMakeCommands' into find_package-improve-messages
d365104 find_package: Optionally warn when implicitly using Config mode
31ead5f find_package: Reject mixed use of MODULE- and CONFIG-only options
6d83083 find_package: mention requested version number in error message
9c39bbd find_package: add CONFIG mode keyword alias for NO_MODULE
f310f67 find_package: add MODULE mode to use only Find-modules
7d67dcf find_package: improve error message when no Find module is present
978d89b find_package: rename NoModule to UseFindModules
2012-03-02 11:48:38 -05:00
Brad King d3651041e9 find_package: Optionally warn when implicitly using Config mode
Define variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE for use by a project
that wants to use an explicit mode in every call to find_package in
order to generate more specific failure messages.  Word the warning
using the new CONFIG and MODULE mode keywords when the minimum required
version of CMake is new enough to have them.  Otherwise word the warning
using the old NO_MODULE mode keyword.

Inspired-by: Alex Neundorf <neundorf@kde.org>
2012-02-28 10:01:44 -05:00
Yury G. Kudryashov a5edfc4fb7 Fix typo in documentation 2012-02-27 08:26:05 -05:00
Stephen Kelly 33eee2c36f Add whitespace after '.' in CMAKE_SKIP_RPATH docs. 2012-01-31 01:46:34 +01:00
David Cole 4dd47eb6c3 Merge topic 'compiler-version'
0df1942 Detect SGI MIPSpro compiler version with its id
a5e892c Document compiler version macro formats used for detection
d7c6f41 Detect HP compiler version with its id
3dd9fa9 Detect SunPro compiler version with its id
c198730 Detect Watcom compiler version with its id
5899b98 Detect Clang compiler version with its id
b8cfa65 Detect PGI compiler version with its id
6dae666 Detect IBM XL compiler version with its id
4080d55 Detect Borland compiler version with its id
2cc205a Detect Intel compiler version with its id (#11937)
a6d83cc Detect MSVC compiler version with its id
a662855 Detect GNU compiler version with its id (#6251)
fa7141f Add framework to detect compiler version with its id (#12408)
2012-01-17 16:22:53 -05:00
Alex Neundorf 96fc5d5d07 automoc: default to strict mode, use CMAKE_AUTOMOC_RELAXED_MODE
automoc now defaults to strict mode, also with Qt4, i.e. it behaves as
the documentation says by default. I also inverted the switch
CMAKE_AUTOMOC_STRICT_MODE to CMAKE_AUTOMOC_RELAXED_MODE.
Docs and test adapted accordingly.

Alex
2011-12-13 22:11:47 +01:00
David Cole 2d1195123e Merge branch 'master' into AutomocIncludedDotMocFileHandling
Conflicts:
	Source/cmTarget.cxx
2011-12-07 16:29:13 -05:00
Brad King fa7141f5ad Add framework to detect compiler version with its id (#12408)
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.
2011-12-07 08:59:51 -05:00
Alex Neundorf 1eca18fd52 automoc: add documentation for CMAKE_AUTOMOC_STRICT_MODE
Alex
2011-12-06 20:42:20 +01:00
Brad King afb00fef19 Add CMAKE_GNUtoMS option to convert GNU .dll.a to MS .lib
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.
2011-12-05 18:13:49 -05:00
Brad King a603250a13 Load platform files that need to know the ABI when possible
Load platform files named in CMAKE_<lang>_ABI_FILES for each language
once the ABI sizeof(void*) is known.  During the first configuration
this is after the test for working compiler and ABI detection checks.
During later configurations the ABI information is immediately available
because it has been saved in CMake<lang>Compiler.cmake.
2011-12-05 16:35:42 -05:00
David Cole 3452dadf89 Merge topic 'AddMocOptionsToAutomoc'
2c648ab add documentation for the AUTOMOC_MOC_OPTIONS property
52719a1 automoc: fix #12541, support moc options
2011-11-08 14:42:51 -05:00
Alex Neundorf 2c648ab7e2 add documentation for the AUTOMOC_MOC_OPTIONS property
Alex
2011-11-01 19:54:04 +01:00
Eric NOULARD 83b13a250c Fix old reference to CMAKE_MAKE_PROGRAM inside CMAKE_BUILD_TOOL doc. 2011-10-30 22:34:18 +01:00
Stephen Kelly d9cbba7c2c Initialize LINK_INTERFACE_LIBRARIES target property with a variable
Define variable CMAKE_LINK_INTERFACE_LIBRARIES to initialize the
value of this property when a target is created.  This allows authors
to write

  set(CMAKE_LINK_INTERFACE_LIBRARIES "")

to disable transitive linking to implementation dependencies of shared
libraries on platforms where it is possible.
2011-10-24 16:09:29 -04:00
Brad King 5c0c635a09 Fortran: Add support for free- and fixed-form flags
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.
2011-08-31 10:24:43 -04:00
Alex Neundorf 77a5c6e0d8 Add documentation for AUTOMOC, add initialization via CMAKE_AUTOMOC
Alex
2011-08-16 22:05:33 +02:00
Brad King 1f641de4b8 Documentation: WIN32 not defined on Cygwin (#12334)
Since commit 85c0a69a (Cygwin: Do not define 'WIN32', 2010-12-17) WIN32
is not defined on Cygwin.  Update documentation of the WIN32 variable
accordingly.
2011-07-29 18:40:56 -04:00
Alex Neundorf a66df08543 Add documentation for the CMAKE_DISABLE_FIND_PACKAGE_<Name> switch
Alex
2011-06-23 11:09:41 +02:00
Brad King b41ad3b399 Teach find_(library|package) about Linux multiarch (#12037)
Implement support for multiarch as specified here:

  http://wiki.debian.org/Multiarch
  https://wiki.ubuntu.com/MultiarchSpec

Detect the <arch> part of <prefix>/lib/<arch> from the implicit library
search path from each compiler to set CMAKE_<lang>_LIBRARY_ARCHITECTURE.
Define CMAKE_LIBRARY_ARCHITECTURE using one of these values (they should
all be the same).  Teach the find_library and find_package commands to
search <prefix>/lib/<arch> whenever they would search <prefix>/lib.
2011-06-08 10:04:44 -04:00
Brad King d7d71ebda3 Fix case typo in CMAKE_BUILD_TYPE docs (#12148)
Reported-by: Stephen Kelly <steveire@gmail.com>
2011-05-03 12:49:41 -04:00