Commit Graph

308 Commits

Author SHA1 Message Date
Brad King 41a2fb5ba0 Merge topic 'tid-system-argument'
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
1925cff Add a SYSTEM parameter to target_include_directories (#14180)
286f227 Extend the cmTargetPropCommandBase interface property handling.
83498d4 Store system include directories in the cmTarget.
f1fcbe3 Add Target API to determine if an include is a system include.
2679a34 Remove unused variable.
2013-07-16 13:59:07 -04:00
Stephen Kelly d7dd01083a Add target property debugging for COMPILE_DEFINITIONS
Use constructs similar to those for COMPILE_OPTIONS. This is a little
different because there is a command to remove_definitions(), so
we can't populate the equivalent target property until generate-time
in cmGlobalGenerator.
2013-07-12 16:57:36 +02:00
Stephen Kelly 83498d4135 Store system include directories in the cmTarget.
Entries from the cmMakefile are processed and maintained similarly
to other include directories. The include_directories(SYSTEM)
signature affects all following targets, and all prior targets
in the same makefile.
2013-07-02 16:40:02 +02:00
Robert Maynard 6dbd4a5f17 cmMakefile: Refactor AddCMakeDependFile and AddCMakeOutputFile.
AddCMakeDependFile and AddCMakeOutputFile both store as std::string
and all calling sites use std::string. So instead of creating more
temporary objects, lets just use std::strings.
2013-06-24 10:43:20 -04:00
Stephen Kelly a984f3257e Introduce add_compile_options command.
This command is similar to add_definitions, in that it affects
the compile options of all targets which follow it. The implementation
is similar to the implementation of the include_directories command,
in that it is based on populating a COMPILE_OPTIONS directory property
and using that to initialize the same property on targets.

Unlike the include_directories command however, the add_compile_options
command does not affect previously defined targets. That is, in
the following code, foo will not be compiled with -Wall, but bar
will be:

 add_library(foo ...)
 add_compile_options(-Wall)
 add_library(bar ...)
2013-06-04 11:36:55 +02:00
Stephen Kelly 5b88504f65 Rename the IncludeDirectoriesEntry to be more generic. 2013-02-12 10:39:35 +01:00
Stephen Kelly 1714c27a74 Process generator expressions for 'system' include directories.
Since commit 08cb4fa4 (Process generator expressions in the
INCLUDE_DIRECTORIES property., 2012-09-18), it is possible to use
generator expressions with the include_directories command.

As that command can also have a SYSTEM argument, ensure that the
result of using that argument with generator expressions gives a
sane result.
2013-02-07 10:03:30 +01:00
Stephen Kelly d70204a86a Only output includes once after the start of 'generate-time' when debugging.
During configure-time, GetIncludeDirectories may be called too, for example
if using the export() command. As the content can be different, it should
be output each time then.
2013-01-21 09:12:22 +01:00
Stephen Kelly 0d46e9a029 Store includes from the same include_directories call together.
Otherwise, we get a separate IncludeDirectoriesEntry for each include,
and that causes unnecessary and confusing splitting in the output when
debugging the INCLUDE_DIRECTORIES property.
2013-01-21 09:12:22 +01:00
Stephen Kelly 18a3195ad5 Keep track of INCLUDE_DIRECTORIES as a vector of structs.
The struct can keep track of where the include came from, which gives
us proper backtraces.
2013-01-03 13:45:40 -05:00
Brad King 711b63f7e0 Add policy CMP0019 to skip include/link variable re-expansion
Historically CMake has always expanded ${} variable references in the
values given to include_directories(), link_directories(), and
link_libraries().  This has been unnecessary since general ${}
evaluation syntax was added to the language a LONG time ago, but has
remained for compatibility with VERY early CMake versions.

For a long time the re-expansion was a lightweight operation because it
was only processed once at the directory level and the fast-path of
cmMakefile::ExpandVariablesInString was usually taken because values did
not have any '$' in them.  Then commit d899eb71 (Call
ExpandVariablesInString for each target's INCLUDE_DIRECTORIES,
2012-02-22) made the operation a bit heavier because the expansion is
now needed on a per-target basis.  In the future we will support
generator expressions in INCLUDE_DIRECTORIES with $<> syntax, so the
fast-path in cmMakefile::ExpandVariablesInString will no longer be taken
and re-expansion will be very expensive.

Add policy CMP0019 to skip the re-expansion altogether in NEW behavior.
In OLD behavior perform the expansion but improve the fast-path
heuristic to match ${} but not $<>.  If the policy is not set then warn
if expansion actually does anything.  We expect this to be encountered
very rarely in practice.
2012-12-07 09:51:19 -05:00
Stephen Kelly 04421042b3 GenEx: Add an accessor for imported targets in a makefile. 2012-10-22 14:01:35 -04:00
Stephen Kelly 5285458342 Add convenience for getting a cmGeneratorTarget to use. 2012-09-19 15:32:25 +02:00
Stephen Kelly 14bf7783f4 Store cmGeneratorTargets with the makefile. 2012-09-19 15:29:07 +02:00
Peter Kümmel 7b2bf28e18 Ninja: suppress cmcldeps only for source file signature try_compiles 2012-09-05 14:38:49 +02:00
Brian Helba b3b095a933 Print any evaluated 'elseif'/'else' commands in trace mode (#13220)
In trace mode ('--trace'), any 'elseif' or 'else' commands that are
evaluated as part of a conditional block will be printed.  Previously,
only the opening 'if' command of a conditional block was printed.
2012-05-16 09:07:55 -04:00
David Cole 8df7aa54f0 Merge topic 'module-no-soname'
fdb3f87 Test NO_SONAME property (#13155)
e1409ac Support building shared libraries or modules without soname (#13155)
2012-05-01 14:09:59 -04:00
Modestas Vainius e1409ac59b Support building shared libraries or modules without soname (#13155)
Add a boolean target property NO_SONAME which may be used to disable
soname for the specified shared library or module even if the platform
supports it.  This property should be useful for private shared
libraries or various plugins which live in private directories and have
not been designed to be found or loaded globally.

Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and
hard-coded -install_name flags with a conditional <SONAME_FLAG> which is
expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG
definition as long as soname supports is enabled for the target in
question.  Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in
rules in case third party projects still use it.  Such projects would
not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be
expanded.  Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well.  Since
-install_name is soname on OS X, this should not be a problem if this
variable is expanded only if soname is enabled.

The Ninja generator performs rule variable substitution only once
globally per rule to put its own placeholders.  Final substitution is
performed by ninja at build time.  Therefore we cannot conditionally
replace the soname placeholders on a per-target basis.  Rather than
omitting $SONAME from rules.ninja, simply do not write its contents for
targets which have NO_SONAME.  Since 3 variables are affected by
NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if
soname is enabled.
2012-04-30 11:50:27 -04:00
Brad King f9b758e91a Cleanup custom command .rule file internal handling
Teach cmMakefile::AddCustomCommandToOutput to return the cmSourceFile
instance to which the custom command is attached.  Use the return value
instead of separately adding a .rule extension and searching for the
source.  Mark CMake-generated .rule files explicitly with a property
instead of trusting the file extension.
2012-04-18 15:48:50 -04:00
David Cole 580171185b Merge topic 'target-include-directories'
d662dff Fix shadowed variable warning on dashboard results
f66e735 Fix compiler warning reported on older Borland dashboard.
d90eed4 Fix compiler error reported on older Borland dashboard.
8233636 Update the documentation regarding INCLUDE_DIRECTORIES.
d899eb7 Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES
c21db87 Make search paths ordered and unique
22021f0 Remove cmMakefile::GetIncludeDirectories
9106b56 Extract and use the INCLUDE_DIRECTORIES target properties.
840509b Keep the INCLUDE_DIRECTORIES target property up to date.
a4d5f7b Add API to get the ordered includes for a target.
8adaee2 CMake: Eliminate cmMakefile::IncludeDirectories
7620932 Remove include flags memoization.
97a5faa Make it safe to call this method without creating duplicates.
edd5303 Refactor GetIncludeFlags to take includes instead of fetching them
2012-03-08 15:13:15 -05:00
Yury G. Kudryashov 89403bf87f Rename UsedCommands to FinalPassCommands
When I read 'UsedCommands' I thought that it holds all commands used in the
file, not only those that have FinalPass().
2012-02-29 11:49:42 +04:00
David Cole 22021f07f8 Remove cmMakefile::GetIncludeDirectories
After making the changes to use the new target level INCLUDE_DIRECTORIES
property, there are no more callers of this method.
2012-02-22 07:29:32 -05:00
David Cole 8adaee2b0b CMake: Eliminate cmMakefile::IncludeDirectories
Instead, re-implement it in terms of the directory property INCLUDE_DIRECTORIES.
2012-02-22 06:31:49 -05:00
Brad King ca39c5cdd1 Optionally allow IMPORTED targets to be globally visible
Consider the case motivating commit e01cce28 (Allow add_dependencies()
on imported targets, 2010-11-19).  An imported target references a file
generated at build time by a custom target on which it depends.  Had the
file been built directly using add_library or add_executable its target
name would have been visible globally.  Therefore the imported target
representing the file should be globally visible also.

Teach the IMPORTED signature of add_(executable|library) to accept a new
"GLOBAL" option to make the imported target visible globally.
2012-01-25 14:42:31 -05:00
Peter Kuemmel a087490697 Add NEWLINE_STYLE option to configure_file (#3957) 2011-11-28 13:48:59 -05:00
Nicolas Despres a92f14f338 Doxygen: Fix warnings. 2011-10-23 22:18:08 +02:00
Nicolas Despres d3d7e45df2 Remove trailing white-spaces. 2011-10-23 22:15:20 +02:00
Alex Neundorf 83b730cd1a Add AUTOMOC to the add_library() command
Alex
2011-08-14 15:58:08 +02:00
Alex Neundorf 9dbba1b464 Fix #12342: Add APPEND_STRING option to set_property()
set_property() has APPEND, which creates a list. E.g. when
appending to COMPILE_FLAGS a string is needed, not a list.
With the APPEND_STRING option the value is append as string,
not as list.

Alex
2011-07-15 20:57:33 +02:00
David Cole 106958c047 Add CMAKE_ARGC and CMAKE_ARGV0..N-1 variables (#2828)
For now, these variables are only available in -P script mode.
2011-02-02 21:19:01 -05:00
David Cole 94d1684a8f Add CMAKE_SCRIPT_MODE_FILE variable (#2828)
New CMake variable is set when processing a -P script file,
but not when configuring a project.
2011-02-02 18:18:14 -05:00
Brad King 9bcaff02ff Merge branch 'cmake-guiRememberAdvancedCheckbox' into dev/strict-mode
Conflicts:
	Source/QtDialog/CMakeSetupDialog.cxx
2010-12-17 10:31:19 -05:00
Ben Boeckel c6e7fabc0f Factor out the checks for unused variables 2010-09-22 12:46:15 -04:00
Ben Boeckel a8e97f8a08 Remove VarRemoved code since it's been superceded 2010-09-16 13:50:39 -04:00
Ben Boeckel 59463ef1a3 Rework CheckVariableForUnused usage 2010-09-16 11:50:57 -04:00
Ben Boeckel 02a114dfe8 Add method to allow variables to be marked as used 2010-09-15 11:34:35 -04:00
Ben Boeckel 980e048a7d Factor out checks for unused variables 2010-09-14 17:10:04 -04:00
Brad King b06fb16684 No CMAKE_CONFIGURATION_TYPES in single-config generators (#10202)
Factor out reading of CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE
into cmMakefile::GetConfigurations.  Read the former only in
multi-config generators.
2010-09-08 14:54:49 -04:00
Ben Boeckel 74997000c8 Add a flag to warn about system files 2010-09-01 13:09:08 -04:00
Ben Boeckel fff9f6d6f7 Rename flags again and use variablewatch for cli 2010-09-01 13:09:08 -04:00
Ben Boeckel 4ff03402fc Rename find-unused to warn-unused 2010-09-01 13:08:14 -04:00
Ben Boeckel e141bc950a Detect unused variables 2010-09-01 13:08:14 -04:00
Ben Boeckel f332e14ff2 Complete strict-mode checks for uninitialized vars 2010-09-01 13:08:14 -04:00
Bill Hoffman 48b5b85593 Add a warning when variables are used uninitialized. 2010-09-01 13:08:13 -04:00
Brad King 6e1b510319 Remove unused cmData and cmMakefile::DataMap
These were implementation details of the unused methods

  cmMakefile::RegisterData
  cmMakefile::LookupData

We simply remove the methods, members, and class cmData.
2010-04-26 14:22:51 -04:00
Brad King 9a77f65da7 Remove CMake Policy CMP0015 until it is revised
We revert commit "Create CMake Policy CMP0015 to fix set(CACHE)" because
the NEW behavior of the policy breaks a valid use case:

  # CMakeLists.txt
  option(BUILD_SHARED_LIBS "..." ON)
  add_library(mylib ...)
  set(BUILD_SHARED_LIBS OFF) # we want only mylib to be shared
  add_subdirectory(ThirdParty)

  # ThirdParty/CMakeLists.txt
  option(BUILD_SHARED_LIBS "..." ON)
  # uh, oh, with NEW behavior this dir uses shared libs!!!

We'll re-introduce the policy later with a different change in behavior
to resolve the motivating case, which was more subtle but less common.

See issue #9008.
2009-10-08 14:56:15 -04:00
Brad King 1e48243591 Introduce "build feature" lookup framework
This creates cmTarget::GetFeature and cmMakefile::GetFeature methods to
query "build feature" properties.  These methods handle local-to-global
scope and per-configuration property lookup.  Specific build features
will be defined later.
2009-10-02 13:52:01 -04:00
Brad King 56d1a1780d Create cmMakefile::PlatformIs64Bit helper method
This method centralizes tests for whether CMAKE_SIZEOF_VOID_P is 8.
2009-09-30 13:45:14 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Brad King ee2b446c95 Create CMake Policy CMP0015 to fix set(CACHE)
The set(CACHE) and option() commands should always expose the cache
value.  Previously we failed to expose the value when it was already set
if a local variable definition hid it.  When set to NEW, this policy
tells the commands to always remove the local variable definition to
expose the cache value.  See issue #9008.
2009-09-10 16:59:45 -04:00