Commit Graph

828 Commits

Author SHA1 Message Date
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
Brad King 9a2c60eb83 Classify known header file extensions as headers
Commit 328c0f65 (Simplify cmVisualStudio10TargetGenerator source
classification, 2012-03-19) introduced the first use of source
classification from cmGeneratorTarget (which originated as Makefile
generator logic) in a Visual Studio generator for handling of header
files.  Fix classification of header files to match known header
extensions instead of only the HEADER_FILE_ONLY property.  Make it
consistent with the "Header Files" source group.
2012-03-28 08:59:14 -04:00
David Cole b063599603 Add a default source group for object files. 2012-03-16 14:25:21 -04:00
Brad King b87d7a60a0 Add OBJECT_LIBRARY target type
This library type can compile sources to object files but does not link
or archive them.  It will be useful to reference from executable and
normal library targets for direct inclusion of object files in them.

Diagnose and reject the following as errors:

* An OBJECT library may not be referenced in target_link_libraries.

* An OBJECT library may contain only compiling sources and supporting
  headers and custom commands.  Other source types that are not normally
  ignored are not allowed.

* An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD
  commands.

* An OBJECT library may not be installed, exported, or imported.

Some of these cases may be supported in the future but are not for now.

Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just
like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior.
2012-03-13 14:37:32 -04:00
Brad King 9c0a00d6dd Rename/constify build-time config placeholder lookup
Rename cmGlobalGenerator::GetCMakeCFG{InitDirectory => IntDir} to
have a shorter name without a typo.  Add a 'const' qualifier since
the method is only for lookup and never needs to modify anything.
2012-03-09 15:16:03 -05: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 d662dff769 Fix shadowed variable warning on dashboard results 2012-02-23 08:11:09 -05:00
David Cole 8233636dbe Update the documentation regarding INCLUDE_DIRECTORIES.
It is now a target property and is affected by the use
of the include_directories command.
2012-02-22 15:22:03 -05:00
David Cole d899eb71b5 Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES
For strict backwards compatibility only. This should be unnecessary at
this point, but introducing a policy to deprecate it properly is a
whole different topic branch...
2012-02-22 07:29:32 -05: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
Stephen Kelly 840509babb Keep the INCLUDE_DIRECTORIES target property up to date.
The directory level property changes need to be added to it.
2012-02-22 06:31:50 -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 3db2973bd2 Refactor TargetTypeNames.
Make it a static method instead of an array. It is safer for the
type checking and if we add a new target type we will be warned to add
a case to the switch.
2011-10-02 18:30:42 +01:00
David Cole 28cba226b3 Merge topic 'UsingCMakeLikePkgConfig2'
59238dc Fix --find-package mode on Cygwin, where enable_language(RC) is called
98472e4 Require the current cmake version in --find-package mode
a6ccf3c Use $(CXXFLAGS) and $(LDFLAGS) in the --find-package test Makefile
4386918 Fix line length
7d69310 Only enable the test when using GNU make
3011149 Make the test harder by always having a space in the include dirs
ab57ff6 Make the --find-package test harder
626fc71 Much improved test, should now be executed on all UNIXes
ec6982d Disable any STATUS output in --find-package mode
e552ae7 Dont check for -isysroot and -mmacosx-version on OSX in --find-package mode
e589589 Rename helper macros print_compile_flags() to set_compile_flags_var()
aecfc1f Fix test on OpenBSD with BSD make
6bb4ca3 The makefile for the test was kindof wrong
fd15b5e Only run the test if we are using a makefile generator under UNIX
9fc87c6 Add a test for the new --find-package mode
d3ae0ff Improve documentation for --find-package mode
bf07375 Add a cmake.m4 for using cmake in autoconf projects instead of pkgconfig
b0e3578 Use the file-utility to test for 64bit if there is no /usr/lib64
53edfb2 Better support for lib64 and Debian multiarch
b8fdaa1 Fix copyright notice in new CMakeFindPackageMode.cmake
7690edf Replace cmake::GetScriptMode() with GetWorkingMode()
e4f603b Implement find-package mode of cmake
a91d662 Add find-package mode, which does nothing yet
b976e70 Make clLocalGenerator::GetTargetFlags() public
2011-08-25 15:40:49 -04:00
Alex Neundorf ec6982dc8c Disable any STATUS output in --find-package mode
Any STATUS output will be fed directly to the compiler, which
will not understand any status messages. Error messages
are fine, since they are errors and it is ok if the compiler
fails in such cases.

Alex
2011-08-16 00:40:59 +02:00
Alex Neundorf 83b730cd1a Add AUTOMOC to the add_library() command
Alex
2011-08-14 15:58:08 +02:00
Alex Neundorf 7690edffd9 Replace cmake::GetScriptMode() with GetWorkingMode()
GetWorkingMode() returns a new enum WorkingMode, which is one of
NORMAL_MODE, SCRIPT_MODE and FIND_PACKAGE_MODE.

Alex
2011-08-09 16:32:45 +02:00
Brad King 119dce33d3 Merge topic 'SetPropertyAppendString'
9dbba1b Fix #12342: Add APPEND_STRING option to set_property()
2011-07-26 14:57:32 -04: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
Alex Neundorf a91d662f46 Add find-package mode, which does nothing yet
-add command line argument --find-package and handle it,
 i.e. call an empty function cmake::FindPackage()
-add basic help

Alex
2011-07-02 17:50:05 +02:00
Bill Hoffman 3e4ba898c1 Only pay for unused variable checking if it is on. 2011-06-21 15:59:10 -04:00
Brad King c7278633a7 Merge topic 'validate-custom-commands-issue-11963'
339d592 Validate custom command arguments (#11963)
2011-03-15 14:47:51 -04:00
Brad King 339d5922d9 Validate custom command arguments (#11963)
Reject quoted commands immediately with an error message instead of
allowing a later assertion failure.
2011-03-14 17:49:30 -04: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 182eb7c7ef Merge topic 'dev/strict-mode'
dd2f814 Merge branch 'dev/add_test-working-directory' into dev/strict-mode
949d32c Unwatch manual variables upon removal in cmake-gui
3939032 Unwatch manual variables upon removal in ccmake
8354413 Add method to unwatch a manual variable
8ed3c85 Give a better message for unused variables
729db48 Fix ArgumentExpansion test expected results
89c2544 Checking for a definition is a usage
5625dee Don't output to stderr in the GUI
ad25a96 Merge branch 'ImprovedDotSupport2' into dev/strict-mode
c128abe Merge branch 'AddCMAKE_CURRENT_LIST_DIR' into dev/strict-mode
9bcaff0 Merge branch 'cmake-guiRememberAdvancedCheckbox' into dev/strict-mode
544d0c3 Fix expected output for WarnUninitialized test
4e3bea4 Update expected messages to new format
8e8c9e4 Don't check at destruction for usage
668e005 Use cmake::IssueMessage for warnings
88cd4c1 Use 'CMake Warning' versus 'warning' for CDash
3c3b98d Initialize the class before setting warn flags
cf8b15a Ignore files under the CMakeFiles directory
fd50f06 Don't check for unused vars at configure time
447a04c Don't warn during configure when doing everything
b97ee21 Check for unused variables at the end of generate
c18c977 When checking for variables, specify a reason
3f1121f Use a long int since Line is a long as well
2507f93 Change the failure case string to 'Unexpected'
fe390a2 Add 'ArgumentExpansion' test
8dbb209 Wrong boolean value for CLI warnings
d4ee998 Hard-code the --no-warn-unused-cli flag
a267b99 Fix line lengths
82ed104 Flag that the directories have been set
5aa535b Add argument to arg parsing to not set directories
367e5c3 Revert "Revert "When calling CMake, set the args and the cache""
ab5d4e4 Revert "When calling CMake, set the args and the cache"
9b90040 When calling CMake, set the args and the cache
fe56002 Fix long lines for KWStyle
5d30cfc Set a watch on variables added through the gui
33c63b1 Add a method to put a watch for variables
535253f Initialize the warning variables earlier
cbb286c Fix the path detection to work for top-level
62be1f7 Initialize the usage stack earlier
c6e7fab Factor out the checks for unused variables
5e41ba8 When using the API, check for Add vs. Remove
dee1976 Fix typo in VariableUnusedViaUnset test
f231ce5 Remove old false positive avoidance code
a117e02 Revert "Add test for unused warnings at the end of scope"
2c82f2b Exempt CMAKE(CURRENT|PARENT)_LIST_FILE from usage
6d7d449 Ignore CLI warnings for ABI determination
7740a73 Only return local keys that are defined
bef3aee Use the API so that warnings can be tracked
05cb0f4 Check for unused variables in the dtor
91c4c99 Add test for unused warnings at the end of scope
ca90f67 Fix detection of unused variables when setting
f7438ca Add test for unused detection via setting it
995cfb0 Don't warn if the variable wasn't defined
aefc91d Add test for usage checks via unset
a8e97f8 Remove VarRemoved code since it's been superceded
59463ef Rework CheckVariableForUnused usage
f117423 Fix line lengths to be no more than 78
e49a935 Improve unused warning logic
e01e40c Mark ARGC, ARGV*, and ARGN as used
a17aff7 Ignore CMAKE_MATCH_* variables for usage
02a114d Add method to allow variables to be marked as used
a0b0d23 CMAKE_DO_TRY_COMPILE is no longer used
ae3eff3 Fix the path used for ignoring system warnings
056b441 Fix missing case for usage of a variable
980e048 Factor out checks for unused variables
83acb0a Remove now unused variables
3801463 Use built-ins for readability and maintainability
8b52015 Push the initialize and unused states when copying
439877f Be consistent with single and double quotes
4cf1706 Add documentation for check-system-vars
b74777f Fix the spelling of the flag for warn-unused-vars
b948120 Change logic of flag to turn off cli unused checks
f047a17 Add test for uninitialized variables
75bda38 Add tests for unused command line variables
300fc15 Fix detection of system files
d784e6a Run the unused variables check on the final pass
9efc057 VariableWatch is not available when bootstrapping
2e78224 Add a missing comma to the warning message
7499700 Add a flag to warn about system files
fff9f6d Rename flags again and use variablewatch for cli
786e269 Add warn-unused to the Qt interface
636e6c4 Default to marking things as used
4ff0340 Rename find-unused to warn-unused
d7999e9 Rename strict-mode to warn-uninitialized
e141bc9 Detect unused variables
d3e8eb5 Add flags to detect unused variables
f332e14 Complete strict-mode checks for uninitialized vars
52f9637 Add method to get the local scope variables
f794d58 Make --strict-mode option, and integrate with cmake-gui
48b5b85 Add a warning when variables are used uninitialized.
cd626ea For macros make sure the FilePath points to a valid pointer in the args.
2011-01-27 15:34:07 -05:00
Brad King dd2f81491e Merge branch 'dev/add_test-working-directory' into dev/strict-mode
Conflicts:
	Tests/CMakeLists.txt
2011-01-27 14:39:55 -05:00
Brad King 833b8aa902 Merge topic 'recursive-CMAKE_USER_MAKE_RULES_OVERRIDE'
c83a834 try_compile: Allow only languages loaded in caller (#11469)
2011-01-26 15:25:18 -05:00
Brad King c83a834d29 try_compile: Allow only languages loaded in caller (#11469)
During a try_compile cmGlobalGenerator::EnableLanguage uses results from
the outer project.  Reject attempts to enable languages in the test
project that are not "ready" in the outer project.  Mark a language as
"ready" when all its information has been loaded and we are ready to
generate build rules.

This also avoids infinite recursion introduced by commit 295b5b60 (Honor
CMAKE_USER_MAKE_RULES_OVERRIDE in try_compile, 2010-06-29) for projects
that set CMAKE_USER_MAKE_RULES_OVERRIDE to a file that uses try_compile.
The file is loaded along with the information for a given langauge so
the language is not yet "ready".
2011-01-24 10:00:45 -05:00
Brad King 3a1975c529 Merge topic 'try_compile-Makefile-config'
052c2ae Document CMAKE_TRY_COMPILE_CONFIGURATION variable
56efc60 Honor CMAKE_TRY_COMPILE_CONFIGURATION in Makefile generators (#10809)
2011-01-19 14:28:32 -05:00
Brad King 56efc60fa0 Honor CMAKE_TRY_COMPILE_CONFIGURATION in Makefile generators (#10809)
Previously this was used only in multi-configuration generators to
choose the configuration of try_compile and try_run at their build time.
Teach CMake to honor the variable in single-configuration generators as
the CMAKE_BUILD_TYPE.
2011-01-17 17:21:30 -05:00
Brad King 668ce6b1e8 Combine duplicate COMPILE_DEFINITIONS disclaimer 2011-01-17 07:55:48 -05:00
Brad King 729db484ef Fix ArgumentExpansion test expected results
Teach the ArgumentExpansion test to expect flattened lists as has always
been the case in the CMake language.  Now that the test should pass
enable the failure regex even when CMAKE_STRICT is not on.  Replace the
reference to the old ArgumentExpansion test behavior in the workaround
comment in cmMakefile::TryCompile with a full inline explanation.
2011-01-11 17:10:28 -05:00
Brad King 764015c284 Merge topic 'policy-CMP0017'
ce28737 Remove usage of CMAKE_CURRENT_LIST_DIR now that we have CMP0017
7db8db5 Improve documentation and messages for the new CMP0017
db44848 Prefer files from CMAKE_ROOT when including from CMAKE_ROOT
1e69c6f Merge branch 'user-policy-defaults' into policy-CMP0017
65a0a2a Merge branch 'include-command-whitespace' into policy-CMP0017
2011-01-11 15:52:13 -05:00
Alex Neundorf db44848f44 Prefer files from CMAKE_ROOT when including from CMAKE_ROOT
This patch makes include() and find_package() prefer cmake files
located in CMAKE_ROOT over those in CMAKE_MODULE_PATH.
This makes sure that the including file gets that file included
which it expects, i.e. the one from cmake with which it was tested.
It only changes behaviour when such an included file exists both
in CMAKE_MODULE_PATH and in CMAKE_ROOT.
This comes together with a new policy CMP0017, with default
behaviour it behaves as it always did, but warns.
With NEW behaviour it includes the file from CMAKE_ROOT
instead from CMAKE_MODULE_PATH. This fixes (if CMP0017 is set)
building KDE 4.5 with cmake >= 2.8.3.
Also a basic test for this policy in included.
2011-01-04 08:06:20 -05:00
Ben Boeckel 89c25443a6 Checking for a definition is a usage 2011-01-03 08:47:04 -05:00
Brad King 9f46051490 Merge topic 'cygwin'
85c0a69 Cygwin: Do not define 'WIN32' (#10122)
62c6d2d Merge branch 'cmake_--system-information_min-version' into cygwin
72db20f Merge branch 'tests-if-CYGWIN' into cygwin
5adef16 Merge branch 'cygwin-module-prefix' into cygwin
cbc3258 Merge branch 'try-compile-min-version' into cygwin
2010-12-21 14:06:32 -05:00
Brad King 31b0657e7d Merge topic 'custom-command-generator-expressions'
4499d50 Mark CustomCommand test perconfig.out as SYMBOLIC
f0cdb60 Introduce "generator expression" syntax to custom commands (#11209)
4749e4c Record set of targets used in cmGeneratorExpression
ef9e9de Optionally suppress errors in cmGeneratorExpression
45e1953 Factor per-config sample targets out of 'Testing' test
4091bca Factor generator expression docs out of add_test
bfb7288 Record backtrace in cmCustomCommand
2010-12-21 14:03:24 -05:00
Brad King 85c0a69a92 Cygwin: Do not define 'WIN32' (#10122)
One of Cygwin's goals is to build projects using the POSIX API with no
Windows awareness.  Many CMake-built projects have been written to test
for UNIX and WIN32 but not CYGWIN.  The preferred behavior under Cygwin
in such projects is to take the UNIX path but not the WIN32 path.

Unfortunately this change is BACKWARDS INCOMPATIBLE for Cygwin-aware
CMake projects!  Some projects that previously built under Cygwin and
are Cygwin-aware when they test for WIN32 may now behave differently.
Eventually these projects will need to be updated, but to help users
build them in the meantime we print a warning about the change in
behavior.  Furthermore, one may set CMAKE_LEGACY_CYGWIN_WIN32 to request
old behavior during the transition.

Normally we avoid backwards incompatible changes, but we make an
exception in this case for a few reasons:

(1) This behavior is preferred by Cygwin's design goals.

(2) A warning provides a clear path forward for everyone who may see
incompatible behavior, and CMAKE_LEGACY_CYGWIN_WIN32 provides a
compatibility option.  The warning and compatibility option both
disappear when the minimum required version of CMake in a project is
sufficiently new, so this issue will simply go away over time as
projects are updated to account for the change.

(3) The fixes required to update projects are fairly insignificant.
Furthermore, the Cygwin distribution has no releases itself so project
versions that predate said fixes tend to be difficult to build anyway.

(4) This change enables many CMake-built projects that did not
previously build under Cygwin to work out-of-the-box.  From bug #10122:

  "I have built over 120 different source packages with (my patched)
   CMake, including most of KDE4, and have found that NOT defining
   WIN32 on Cygwin is much more accurate." -- Yaakov Selkowitz

A fully compatible change would require patches on top of these project
releases for Cygwin even though they otherwise need not be aware of it.

(5) Yaakov has been maintaining a fork of CMake with this change for the
Cygwin Ports distribution.  It works well in practice.  By accepting the
change in upstream CMake we avoid confusion between the versions.

CMake itself builds without WIN32 defined on Cygwin.  Simply disable
CMAKE_LEGACY_CYGWIN_WIN32 explicitly in our own CMakeLists.txt file.
2010-12-17 14:19:58 -05:00
Brad King ad25a968b9 Merge branch 'ImprovedDotSupport2' into dev/strict-mode
Conflicts:
	Source/cmake.cxx
2010-12-17 10:32:01 -05:00
Brad King c128abe383 Merge branch 'AddCMAKE_CURRENT_LIST_DIR' into dev/strict-mode
Conflicts:
	Source/cmMakefile.cxx
2010-12-17 10:31:41 -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
Brad King bfb7288f81 Record backtrace in cmCustomCommand
This will be used to report custom command errors to the user with a
backtrace pointing at the add_custom_command or add_custom_target call.
2010-12-15 14:53:24 -05:00
Brad King 999ce0aa9c Document target_link_libraries target scope (#11058)
The target_link_libraries command requires its first argument to be a
target in the current directory.  Document this and update the error
message to be more specific.  While at it, format the error message with
a call stack.
2010-12-15 12:18:59 -05:00
Brad King 0621362668 Fix dependency tracing of INSTALL and PACKAGE (#11598)
Commit e01cce28 (Allow add_dependencies() on imported targets,
2010-11-19) started using cmMakefile::FindTargetToUse to follow
dependencies, including those of GLOBAL_TARGETs like INSTALL and
PACKAGE.  Since global targets exist in every directory, dependencies
between them must be traced within each directory too.

Teach FindTargetToUse to check the current directory before checking
globally.  For global targets this will find the local copy.  For for
normal targets this will be a no-op because they are globally unique.
2010-12-13 12:56:47 -05:00
Ben Boeckel 8e8c9e4924 Don't check at destruction for usage 2010-12-07 16:38:37 -05:00
Ben Boeckel 668e005db5 Use cmake::IssueMessage for warnings 2010-12-07 16:38:25 -05:00
Ben Boeckel 88cd4c1e92 Use 'CMake Warning' versus 'warning' for CDash 2010-12-07 14:40:21 -05:00
Ben Boeckel 3c3b98ddd3 Initialize the class before setting warn flags
Since Initialize sets variables that we don't want to warn about, don't
leak the original class' settings.
2010-12-03 12:52:36 -05:00
Ben Boeckel cf8b15a5c1 Ignore files under the CMakeFiles directory 2010-12-03 12:49:37 -05:00
Ben Boeckel fd50f06b21 Don't check for unused vars at configure time
The generate step should catch all of them.
2010-12-02 16:57:30 -05:00
Ben Boeckel c18c977ce8 When checking for variables, specify a reason
Allow reasons to begiven for checking for unused variables.
2010-11-15 10:32:15 -05:00
David Cole b0fb2ad3e1 Merge topic 'AddCMAKE_CURRENT_LIST_DIR'
b011840 Use absolute path to FindPackageHandleStandardArgs.cmake everywhere
41e4f1a Add automatic variable CMAKE_CURRENT_LIST_DIR(dir of CMAKE_CURRENT_LIST_FILE)
f9fc79c Remove trailing whitespace
2010-10-19 15:53:16 -04:00
Ben Boeckel 3f1121f722 Use a long int since Line is a long as well 2010-10-08 13:49:39 -04:00
Ben Boeckel 8dbb2090a2 Wrong boolean value for CLI warnings 2010-10-07 12:28:25 -04:00
Ben Boeckel d4ee998b61 Hard-code the --no-warn-unused-cli flag 2010-10-07 12:22:00 -04:00
Ben Boeckel 82ed104dcb Flag that the directories have been set 2010-10-05 13:45:34 -04:00
Ben Boeckel 367e5c37bb Revert "Revert "When calling CMake, set the args and the cache""
This reverts commit ab5d4e43d9.
2010-10-05 12:27:37 -04:00
Ben Boeckel ab5d4e43d9 Revert "When calling CMake, set the args and the cache"
This reverts commit 9b90040edb.
2010-10-01 16:52:16 -04:00
Ben Boeckel 9b90040edb When calling CMake, set the args and the cache 2010-10-01 13:44:55 -04:00
Bill Hoffman 3d68dd230d Fix for bug #11274, VS10 custom commands that create files in INTDIR fix. 2010-09-29 17:02:04 -04:00
Alex Neundorf 41e4f1a210 Add automatic variable CMAKE_CURRENT_LIST_DIR(dir of CMAKE_CURRENT_LIST_FILE)
Comes with a simple test and docs.

Alex
2010-09-28 22:10:47 +02:00
Alex Neundorf f9fc79cac5 Remove trailing whitespace
Alex
2010-09-28 21:44:22 +02:00
Ben Boeckel 535253f385 Initialize the warning variables earlier 2010-09-22 12:46:15 -04:00
Ben Boeckel cbb286c0b2 Fix the path detection to work for top-level 2010-09-22 12:46:15 -04:00
Ben Boeckel 62be1f78ae Initialize the usage stack earlier 2010-09-22 12:46:15 -04:00
Ben Boeckel c6e7fabc0f Factor out the checks for unused variables 2010-09-22 12:46:15 -04:00
Ben Boeckel 5e41ba8e4a When using the API, check for Add vs. Remove 2010-09-17 10:13:19 -04:00
Ben Boeckel 2c82f2b759 Exempt CMAKE(CURRENT|PARENT)_LIST_FILE from usage 2010-09-16 17:50:07 -04:00
Ben Boeckel bef3aeebab Use the API so that warnings can be tracked 2010-09-16 16:06:16 -04:00
Ben Boeckel 05cb0f4daf Check for unused variables in the dtor 2010-09-16 16:05:59 -04:00
Ben Boeckel ca90f673a0 Fix detection of unused variables when setting 2010-09-16 13:53:41 -04:00
Ben Boeckel 995cfb0e2a Don't warn if the variable wasn't defined 2010-09-16 13:52:17 -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 f117423336 Fix line lengths to be no more than 78 2010-09-16 11:49:58 -04:00
Ben Boeckel e49a935c20 Improve unused warning logic
Only warn when changing the definition of an initialized variable.
2010-09-15 11:41:27 -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 ae3eff35b4 Fix the path used for ignoring system warnings 2010-09-14 17:14:25 -04:00
Ben Boeckel 056b44113f Fix missing case for usage of a variable 2010-09-14 17:10:22 -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 3801463c9f Use built-ins for readability and maintainability 2010-09-08 12:03:42 -04:00
Ben Boeckel 8b520158c3 Push the initialize and unused states when copying 2010-09-07 15:12:15 -04:00
Ben Boeckel 300fc15779 Fix detection of system files
Instead of looking to see if the file is under CMAKE_ROOT, check to see
if it is instead under the source or binary directories in use.
2010-09-02 11:33:34 -04:00
Ben Boeckel d784e6af4d Run the unused variables check on the final pass 2010-09-02 11:29:05 -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 636e6c4ef7 Default to marking things as used
If we don't then:

    cmake --warn-unused --warn-unused-all

acts differently than:

    cmake --warn-unused-all --warn-unused
2010-09-01 13:08:15 -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 3ebb41d58a Merge branch 'version' 2010-05-17 13:34:29 -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 5bfffd6f29 New version scheme to support branchy workflow
Prepare to switch to the workflow described by "git help workflows".  In
this workflow, the "master" branch is always used to integrate topics
ready for release.  Brand new work merges into a "next" branch instead.
We need a new versioning scheme to work this way because the version on
"master" must always increase.

We no longer use an even/odd minor number to distinguish releases from
development versions.  Since we still support cvs checkout of our source
tree we cannot depend on "git describe" to compute a version number
based on the history graph.  We can use the CCYYMMDD nightly date stamp
to get a monotonically increasing version component.

The new version format is "major.minor.patch.(tweak|date)".  Releases
use a tweak level in the half-open range [0,20000000), which is smaller
than any current or future date.  For tweak=0 we do not show the tweak
component, leaving the format "major.minor.patch" for most releases.
Development versions use date=CCYYMMDD for the tweak level.  The
major.minor.patch part of development versions on "master" always
matches the most recent release.

For example, a first-parent traversal of "master" might see

        v2.8.1      2.8.1.20100422    v2.8.2
           |              |              |
  ----o----o----o----o----o----o----o----o----

Since the date appears in the tweak component, the next release can
increment the patch level (or any more significant component) to be
greater than any version leading to it.  Topic branches not ready for
release are published only on "next" so we know that all versions on
master lead between two releases.
2010-04-23 09:44:23 -04:00
Brad King 59f6f383e9 Warn on set(PARENT_SCOPE) at top scope
Previously we silently ignored such calls and set nothing.  The commit
"Initialize directory scope with closure of parent" inroduced a bad test
for the top scope.  This commit fixes the test to avoid dereferencing a
null pointer, and adds a warning when the case is encountered.
2009-11-02 11:56:17 -05: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 1b5a986a42 Do not collapse path of NOTFOUND values
In cmMakefile::AddCacheDefinition we collapse paths specified in PATH or
FILEPATH cache entries originally specified on the command line with
UNINITALIZED type.  This commit fixes the logic to avoid collapsing
<var>-NOTFOUND and other false values.  The change allows other CMake
code to force a NOTFOUND value on an entry with UNINITALIZED type.
2009-10-07 14:37:19 -04:00
Brad King 78f0811628 Create explicit cmTarget::FinishConfigure step
This method is called during ConfigureFinalPass on every target.  It
gives each target a chance to do some final processing after it is known
that no more commands will affect it.  Currently we just call the old
AnalyzeLibDependencies that used to be called directly.
2009-10-05 09:06:29 -04:00
Brad King c513962701 Create INTERPROCEDURAL_OPTIMIZATION build feature
This commit creates target and directory properties to enable the Intel
interprocedural optimization support on Linux.  Enabling it adds the
compiler option '-ipo' and uses 'xiar' to create archives.

See issue #9615.
2009-10-02 13:52:13 -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 ef8434284f Remove old check for duplicate subdirectories
In cmMakefile::AddSubDirectory we were checking for addition of the same
source directory multiple times.  However, the check code was incorrect
because it compared pointers instetad of pointed-to strings.  Since the
check was written, a better check was added right after it to enforce
unique binary directories (in which case duplicate sources are fine).
This commit simply removes the old-style check code.
2009-09-17 08:25:33 -04:00
Brad King 24861459b5 Initialize directory scope with closure of parent
The commit "Improve dynamic variable scope implementation" optimized
function scopes using an efficient parent scope pointer.  However, the
parent scope used to initialize a new directory might not exist later
(like add_subdirectory called inside a function of the parent scope).
This caused CMake to crash when following the dangling pointer to the
original parent scope.

We fix the problem in this commit by always computing the closure of the
parent scope at directory initialization time so that no parent scope
pointer is needed.  See issue #9538.
2009-09-16 09:51:47 -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
Brad King afbe088309 Remove barely-used cmMakefile::AddCacheDefinition
The boolean overload of this method was used only to implement option().
We re-implement option() in terms of the main method and removes the
now-unused signature.  This removes some duplicate code that had already
fallen behind on changes (it was not removing the local definition
instead of setting it).
2009-09-10 16:59:36 -04:00
Brad King 0bc050677f Record backtrace for every add_test command
We teach cmTest to hold a backtrace for the add_test command that
created it.  This will be used later to report context for errors at
generate time.
2009-08-11 09:07:28 -04:00
Brad King 80c947b397 No /fast targets in try_compile project mode
The try_compile command builds the cmTryCompileExec executable using the
cmTryCompileExec/fast target with Makefile generators in order to save
time since dependencies are not needed.  However, in project mode the
command builds an entire source tree that may have dependencies.
Therefore we can use the /fast target approach only in one-source mode.
2009-08-04 14:37:46 -04:00
Brad King 71c0e1417b ENH: Keep only FinalPass commands in memory
In cmMakefile we save all invoked commands so that FinalPass can be
called on them later.  Most commands have no final pass, so we should
keep only the few that do.
2009-07-24 13:31:34 -04:00
Brad King fd10589995 ENH: Improve dynamic variable scope implementation
Previously each new variable scope (subdirectory or function call) in
the CMake language created a complete copy of the key->value definition
map.  This avoids the copy using transitive lookups up the scope stack.
Results of queries answered by parents are stored locally to maintain
locality of reference.

The class cmDefinitions replaces cmMakefile::DefinitionsMap, and is
aware of its enclosing scope.  Each scope stores only the definitions
set (or unset!) inside it relative to the enclosing scope.
2009-07-22 14:22:45 -04:00
Bill Hoffman 300514fd25 ENH: make sure GUIDs for filters are cached 2009-07-17 10:05:54 -04:00
Bill Hoffman 28b1912aa3 ENH: add group support and fix borland error 2009-07-11 00:05:20 -04:00
Bill Hoffman 7491f52992 ENH: first pass at VS 10, can bootstrap CMake, but many tests still fail 2009-06-25 16:41:57 -04:00
Brad King f74b876a58 ENH: Clarify COMPILE_DEFINITIONS separator in docs
The COMPILE_DEFINITIONS properties are semicolon-separated lists.
Make this clear in the documentation.  See issue #9199.
2009-06-24 09:36:29 -04:00
Brad King c790b1fabb ENH: Create CMP0013 to disallow duplicate dirs
In CMake 2.6.3 and below we silently accepted duplicate build
directories whose build files would then conflict.  At first this was
considured purely a bug that confused beginners but would not be used in
a real project.  In CMake 2.6.4 we explicitly made it an error.

However, some real projects took advantage of this as a "feature" and
got lucky that the subtle build errors it can cause did not occur.
Therefore we need a policy to deal with the case more gracefully.
See issue #9173.
2009-06-17 13:40:09 -04:00
Brad King 708d1cf1ee ENH: Support more preprocessor values in VS6
Previously we rejected all preprocessor definition values containing
spaces for the VS6 IDE generator.  In fact VS6 does support spaces but
not in combination with '"', '$', or ';', and only if we use the sytnax
'-DNAME="value with spaces"' instead of '-D"NAME=value with spaces"'.
Now we support all definition values that do not have one of these
invalid pairs.  See issue #8779.
2009-04-24 11:18:06 -04:00
Brad King 4085454658 ENH: Support preprocessor def values in VS6
The add_definitions() command and COMPILE_DEFINITIONS dir/tgt/src
properties support preprocessor definitions with values.  Previously
values were not supported in the VS6 generator even though the native
tool supports them.  It is only values with spaces that VS6 does not
support.  This enables support and instead complains only for values
with spaces.  See issue #8779.
2009-03-23 14:48:09 -04:00
Brad King 66d69f864a ENH: Refactor generation of CTestTestfile content
This moves code which generates ADD_TEST and SET_TESTS_PROPERTIES calls
into CTestTestfile.cmake files out of cmLocalGenerator and into a
cmTestGenerator class.  This will allow more advanced generation without
cluttering cmLocalGenerator.  The cmTestGenerator class derives from
cmScriptGenerator to get support for per-configuration script
generation (not yet enabled).
2009-03-16 10:40:46 -04:00
Brad King 1d3308156e ENH: Enforce unique binary directories
The second argument of add_subdirectory must name a unique binary
directory or the build files will clobber each other.  This enforces
uniqueness with an error message.
2009-02-27 11:23:14 -05:00
Brad King b604b98c56 ENH: Define RULE_LAUNCH_* properties
This defines global, directory, and target properties
RULE_LAUNCH_COMPILE, RULE_LAUNCH_LINK, and RULE_LAUNCH_CUSTOM.  Their
values specify 'launcher' command lines which are prefixed to compile,
link, and custom build rules by Makefile generators.
2009-02-10 08:51:15 -05:00
Brad King 7d6a5e097f ENH: More robust property lookup
This teaches cmMakefile::GetProperty and cmake::GetProperty methods to
return NULL when the property name is NULL, making them more robust and
consistent with the behavior of cmTarget::GetProperty.
2009-02-02 13:27:30 -05:00
Brad King c332e0bf3c ENH: Isolate policy changes in included scripts
Isolation of policy changes inside scripts is important for protecting
the including context.  This teaches include() and find_package() to
imply a cmake_policy(PUSH) and cmake_policy(POP) around the scripts they
load, with a NO_POLICY_SCOPE option to disable the behavior.  This also
creates CMake Policy CMP0011 to provide compatibility.  See issue #8192.
2009-01-22 13:18:40 -05:00
Brad King 3028ca756c ENH: Better policies for functions and macros
This teaches functions and macros to use policies recorded at creation
time when they are invoked.  It restores the policies as a weak policy
stack entry so that any policies set by a function escape to its caller
as before.
2009-01-22 13:16:47 -05:00
Brad King 26bf8b2cda ENH: Create notion of a 'weak' policy stack entry
A 'weak' poilcy stack entry responds normally to queries.  However,
setting a policy in a weak entry will recursively set the policy in the
next entry too.  This also gives the internal interface to create a weak
entry the option to provide an initial PolicyMap for it.
2009-01-22 13:16:27 -05:00
Brad King dfc181a1dc ENH: Create policy scope barriers
This creates a barrier mechanism to prevent user code from using
cmake_policy(POP) to pop a scope it didn't push with cmake_policy(PUSH).
2009-01-22 10:57:16 -05:00
Brad King a01eb6b27b ENH: Create automatic policy push/pop helper
This creates cmMakefile::PolicyPushPop to push and pop policy scope
automatically.  It also enforces balanced push/pop pairs inside the
scope it handles.
2009-01-22 10:56:50 -05:00
Brad King 8997f4760a ENH: Refactor policy stack representation
This defines PolicyMap as a public member of cmPolicies.  Its previous
role as a policy stack entry is now called PolicyStackEntry and
represented as a class to which more information can be added later.
2009-01-22 10:56:39 -05:00
Brad King 1dcc5b4558 ENH: Better handling of mismatched blocks
If a logical block terminates with mismatching arguments we previously
failed to remove the function blocker but replayed the commands anyway,
which led to cases in which we failed to report the mismatch (return
shortly after the ending command).  The recent refactoring of function
blocker deletion changed this behavior to produce an error on the ending
line by not blocking the command.  Furthermore, the function blocker
would stay in place and complain at the end of every equal-level block
of the same type.

This teaches CMake to treat the begin/end commands (if/endif, etc.) as
correct and just warns when the arguments mismatch.  The change allows
cases in which CMake 2.6.2 silently ignored a mismatch to run as before
but with a warning.
2009-01-21 09:49:00 -05:00
Brad King bca1026250 ENH: Better error message for unclosed blocks
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.).  We record the line at which each
block is opened so it can be reported in the error message.
2009-01-21 09:48:20 -05:00
Brad King b8f5a934ec ENH: Refactor logical block enforcement
This uses a stack of 'barriers' to efficiently divide function blockers
into groups corresponding to each input file.  It simplifies detection
of missing block close commands and factors it out of ReadListFile.
2009-01-21 09:48:00 -05:00
Brad King 2c81e5fb5c ENH: Refactor function blocker deletion
When a function blocker decides to remove itself we previously removed
it at every return point from the C++ scope in which its removal is
needed.  This teaches function blockers to transfer ownership of
themselves from cmMakefile to an automatic variable for deletion on
return.  Since this removes blockers before they replay their commands,
we no longer need to avoid running blockers on their own commands.
2009-01-20 14:36:18 -05:00
Brad King a541cac325 ENH: Improve response to bad if or elseif
Previously bad arguments to an if() or elseif() would cause some
subsequent statements in the corresponding block to execute.  This
teaches CMake to stop processing commands with a fatal error.  It also
provides context to bad elseif() error messages.
2009-01-20 14:35:22 -05:00
Bill Hoffman e4048118de BUG: fix crash with empty properties 2009-01-18 12:05:45 -05:00
Brad King d602a3db85 BUG: Enforce matching policy PUSH/POP in all files
The documentation of cmake_policy PUSH and POP states that they must
always match.  Previously we enforced this only for the top scope of
each CMakeLists.txt file.  This enforces the requirement for all files.
2009-01-15 14:37:14 -05:00
Brad King 35e391c93b ENH: Provide variable CMAKE_VERSION
This creates the variable CMAKE_VERSION containing the full version of
cmake in "major.minor.patch" format.  It is particularly useful with the
component-wise version comparison provided by the if() command.
2009-01-15 08:57:44 -05:00
Brad King ed3bb743f4 ENH: Improve test property speed with a map
Previously we stored a vector of tests to preserve their order.
Property set/get operations would do a linear search for matching tests.
This uses a map to efficiently look up tests while keeping the original
order with a vector for test file generation.
2009-01-05 15:00:57 -05:00
Bill Hoffman 0c24570ee4 BUG: fix issue with -D and cache force 2008-11-21 16:32:39 -05:00
Brad King 0d425cd501 BUG: Finish fix to old DEFINITIONS property
The cmMakefile::DefineFlagsOrig ivar was created to help preserve the
old DEFINITIONS property behavior now that definitions are moved from
DefineFlags to the COMPILE_DEFINITIONS directory property.  This fixes
propagation of the original value into subdirectories.
2008-10-09 13:52:25 -04:00
Brad King 0ad5eb177b ENH: Return utility target after creation
After creating a utility target with AddUtilityCommand, return a pointer
to the cmTarget instance so the caller may further modify the target as
needed.
2008-10-09 11:00:54 -04:00
Bill Hoffman ecf312ccc8 STYLE: fix line length stuff for KWStyle 2008-10-01 09:04:27 -04:00
Brad King 5f57efb417 BUG: Skip a command if its arguments fail to parse
If the arguments to a command fail to parse correctly due to a syntax
error, the command should not be invoked.  This avoids problems created
by processing of commands with bad arguments.  Even though the build
system will not be generated, the command may affect files on disk that
persist across CMake runs.
2008-09-24 08:51:33 -04:00
Brad King d524f3675e ENH: Improve argument parsing error messages
Previously error messages produced by parsing of command argument
variable references, such as bad $KEY{VAR} syntax or a bad escape
sequence, did not provide good context information.  Errors parsing
arguments inside macro invocations gave no context at all.  Furthermore,
some errors such as a missing close curly "${VAR" would be reported but
build files would still be generated.

These changes teach CMake to report errors with good context information
for all command argument parsing problems.  Policy CMP0010 is introduced
so that existing projects that built despite such errors will continue
to work.
2008-09-24 08:51:19 -04:00
Brad King 33e865c041 ENH: Add unset() command.
This introduces the unset() command to make it easy to unset CMake
variables, environment variables, and CMake cache variables.  Previously
it was not even possible to unset ENV or CACHE variables (as in
completely remove them).  Changes based on patch from Philip Lowman.
See issue #7507.
2008-08-25 10:31:29 -04:00
Brad King 8ee5c92015 BUG: Linking to modules is for 2.2 compat only
The compatibility check to allow linking to modules should test for
CMake 2.2, not the unreleased 2.3.  See issue #7500.  Furthermore, the
message should be more clear about fixing the code instead of setting
CMAKE_BACKWARDS_COMPATIBILITY unless one is just trying to build an
existing project.
2008-08-19 10:28:22 -04:00
Brad King f50ed1fd88 ENH: Improve errors when a policy is REQUIRED
In the future some policies may be set to REQUIRED_IF_USED or
REQUIRED_ALWAYS.  This change clarifies the error messages users receive
when violating the requirements.
2008-08-18 16:29:00 -04:00
Bill Hoffman 6f31b0dfbd ENH: add a --trace option 2008-07-31 10:33:25 -04:00
Brad King b9b11903ab BUG: Fix computed directory property DEFINITIONS.
- The property tracks the value formed by add_definitions
    and remove_definitions command invocations.
  - The string should be maintained for use in returning for the
    DEFINITIONS property value.
  - It is no longer used for any other purpose.
  - The DEFINITIONS property was recently documented as deprecated.
  - See bug #7239.
2008-06-26 13:30:10 -04:00
Brad King d8e05b43a1 ENH: Update documentation of computed directory properites.
- Fix documentation of get_directory_property command.
  - Convert its list of computed directory properties to be
    defined/documented directory properties.
2008-06-26 10:58:44 -04:00
Brad King 2ca9a70fd1 BUG: Fix PARENT_DIRECTORY property in top-level to not crash. 2008-06-26 10:58:16 -04:00
Bill Hoffman 02ff910044 BUG: fix for bug 7239, DEFINITIONS property not backwards compatible to 2.4 2008-06-25 09:44:56 -04:00
Brad King 7fc72e6471 ENH: Allow custom commands with VERBATIM option to have $(SomeVar) make variable replacement. 2008-06-04 12:10:52 -04:00
Ken Martin 0080c2b9b5 COMP: fix warning 2008-06-02 09:39:13 -04:00
Ken Martin d0d3c6c212 ENH: make end of file checking for close if, foreach, macro, functions etc enabled. Not sure why it was disabled to start with, but I suspect I will find out. In reponse to Bill email about a ctest -S script with a function that waqs not closed. Closure was only checked for regular listfiles not other files. 2008-05-31 08:15:00 -04:00
Brad King a1bb7e90ef ENH: Allow users to specify macro-like #include line transforms for dependency scanning.
- Define IMPLICIT_DEPENDS_INCLUDE_TRANSFORM property on targets and directories.
  - Make the directory version inherited.
  - See issue #6648.
2008-05-14 11:54:52 -04:00
Brad King 1381aab4b7 BUG: Remove check for files written by file(WRITE) being loaded.
- CMake 1.8 and below did not do the check but could get in
    infinite loops due to the local generate step.
  - CMake 2.0 added the check but failed to perform it in directories
    with no targets (see bug #678).
  - CMake 2.2 removed the local generate which fixed the problem but
    did not remove the check.
  - Between CMake 2.4 and 2.6.0rc6 the check was fixed to work even
    when no targets appear in a directory (see bug #6923).
  - Bottom line: the check is no longer needed.
2008-04-30 13:42:40 -04:00
Bill Hoffman 10c91ded4f ENH: add support for Intel Fortran Visual studio IDE 2008-04-30 13:26:04 -04:00
Brad King fb8c255c2d ENH: In cmMakefile::IssueMessage report the directory-level context even if no list file is currently being processed. 2008-04-29 14:17:28 -04:00
Brad King e3666a1de5 ENH: Allow policy CMP0000 to be set explicitly
- Message for missing cmake_minimum_required is not issued
    until the end of processing the top CMakeLists.txt file
  - During processing a cmake_policy command may set behavior
  - OLD behavior is to silently ignore the problem
  - NEW behavior is to issue an error instead of a warning
2008-03-31 13:33:09 -04:00
Brad King 3374d12ff0 BUG: Fix impl of CMP0005 regex to match value-less definitions. 2008-03-13 17:38:51 -04:00
Brad King 9a83ce6efc ENH: Add policy CMP0005 to decide whether add_definitions should escape defs. 2008-03-13 17:11:57 -04:00
Brad King fb0296656d ENH: Improve error message when invalid policy is given. 2008-03-13 14:13:44 -04:00
Brad King f7f03347a6 ENH: Improve new error/warning message generation
- Add cmListFileBacktrace to record stack traces
  - Move main IssueMessage method to the cmake class instance
    (make the backtrace an explicit argument)
  - Change cmMakefile::IssueMessage to construct a backtrace
    and call the cmake instance version
  - Record a backtrace at the point a target is created
    (useful later for messages issued by generators)
2008-03-13 13:48:57 -04:00
Ken Martin 73df9a5cd4 ENH: change CMP_ to CMP 2008-03-13 11:38:46 -04:00
Bill Hoffman 5ab6c0f0ed ENH: remove abort calls and replace with an IssueMessage INTERANL_ERROR, better to not crash on the end user. 2008-03-12 21:06:32 -04:00
Bill Hoffman c559ce8f6f STYLE: fix line len 2008-03-12 09:25:14 -04:00
Bill Hoffman 84cea9806f ENH: fix warning message a bit 2008-03-11 17:27:24 -04:00
Bill Hoffman a547ff61cd ENH: add a way to suppress the new policy warnings, still need ccmake and gui's 2008-03-11 15:17:58 -04:00
Bill Hoffman dc9245df6c ENH: add enum to IssueMessage 2008-03-11 10:29:56 -04:00
Brad King 7f2bf83132 ENH: Enforce matching PUSH/POP calls for cmake_policy. 2008-03-10 15:41:07 -04:00
Brad King eb6b300978 ENH: Add directory-level context information to error/warning messages when no call stack is present. 2008-03-10 15:40:57 -04:00
Brad King b2d7a839a4 COMP: Avoid using operator-> on const_reverse_iterator to help old compilers. 2008-03-08 09:21:30 -05:00
Brad King 192de486df ENH: Cleanup policy generic documentation. Cleanup some policy error/warning messages. 2008-03-08 09:13:13 -05:00
Brad King 46bf0347a3 ENH: Finish creating, documenting, and enforcing policy CMP_0002. 2008-03-07 16:36:57 -05:00
Brad King d4f66dfa32 ENH: In cmMakefile::IssueMessage use cmDocumentationFormatterText to format the message nicely. 2008-03-07 16:01:22 -05:00
Brad King 5233b75a77 ENH: Improve handling of old-style compatibility.
- Remove CMP_0001 (no slash in target name) and restore
    old CMAKE_BACKWARDS_COMPATIBILITY check for it
  - Replace all checks of CMAKE_BACKWARDS_COMPATIBILITY
    with cmLocalGenerator::NeedBackwardsCompatibility calls
  - Create new CMP_0001 to determine whether or not
    CMAKE_BACKWARDS_COMPATIBILITY is used.
    (old = use, new = ignore)
  - Show CMAKE_BACKWARDS_COMPATIBILITY in cache only when
    CMP_0001 is set to OLD or WARN
  - Update documentation of cmake_policy and cmake_minimum_required
    to indicate their relationship and the 2.4 version boundary
  - When no cmake policy version is set in top level makefile
    implicitly call cmake_policy(VERSION 2.4) which restores
    CMAKE_BACKWARDS_COMPATIBILITY and other 2.4 compatibility
  - Fix tests MakeClean and Preprocess to call
    cmake_policy(VERSION 2.6) because they depend on new policies
2008-03-07 15:30:35 -05:00
Brad King 52ad7a5a97 BUG: Do not produce whitespace-only lines when indenting messages in new error/warning format. 2008-03-07 09:09:21 -05:00
Brad King 680104a490 ENH: New format for warning and error messages
- Add cmMakefile methods IssueError and IssueWarning
  - Maintain an explicit call stack in cmMakefile
  - Include context/call-stack info in messages
  - Nested errors now unwind the call stack
  - Use new mechanism for policy warnings and errors
  - Improve policy error message
  - Include cmExecutionStatus pointer in call stack
    so that errors deeper in the C++ stack under
    a command invocation will become errors for the
    command
2008-03-07 08:40:36 -05:00
Ken Martin adddcea5d7 BUG: change the handling of CMAKE_MINIMUM_REQUIRED and BACKWARDS_COMPATIBILITY and extend the documentaiton quite a bit 2008-03-06 10:57:59 -05:00
Brad King 49549560b2 ENH: Improve cmake_policy command signature
- Replace NEW and OLD modes with a SET mode for clarity
  - Enforce VERSION argument validity (major.minor[.patch])
2008-03-05 18:21:10 -05:00
Ken Martin f2c6e9e480 BUG: some fixes, still a few to go 2008-03-05 11:41:25 -05:00
Brad King ddd6ce04ec BUG: Make sure at least one policy stack entry is created for every cmMakefile instance. 2008-03-04 18:57:14 -05:00
Ken Martin 7b5d1c4c1e COMP: fix warning 2008-03-02 09:11:26 -05:00
Ken Martin 6f6b80fded BUG: bad loop index unsigned compared to zero 2008-03-01 16:21:41 -05:00
Ken Martin d7db2d086c COMP: fix some warnings 2008-03-01 15:44:17 -05:00
Ken Martin d49ef18f8a ENH: add first cut and policies still need to add the doc support 2008-03-01 15:20:35 -05:00
Bill Hoffman f386c2aae0 ENH: make CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS the default and remove the property. If any value is specified in an endif, endforeach, endwhile, etc then make sure it matches the start string. If no values are given then it is no longer an error. 2008-02-29 12:18:11 -05:00
Brad King 1c0595c73f ENH: Add global property ALLOW_DUPLICATE_CUSTOM_TARGETS to help existing projects that depend on having duplicate custom targets. It is allowed only for Makefile generators. See bug#6348. 2008-02-14 16:42:29 -05:00
Brad King 5b02a4a864 ENH: Re-enable diagnosis of non-unique target names.
- Re-enable enforcement in cmMakefile::EnforceUniqueName
  - Improve error message to help user resolve the problem
  - Fix Modules/CTestTargets.cmake to not duplicate testing targets
  - Move commands used by the changes to Modules/CTestTargets.cmake
    to build during bootstrap: DEFINE_PROPERTY, GET_PROPERTY
2008-02-14 11:58:32 -05:00
Brad King 8175b10078 BUG: Disable enforcement of unique target names until CTestTargets can be fixed. 2008-02-12 10:19:38 -05:00
Brad King ac0e58dcfb ENH: Enforce global target name uniqueness.
- Error if imported target is involved in conflict
  - Error for non-imported target conflict unless
    CMAKE_BACKWARDS_COMPATIBILITY <= 2.4
  - Include OUTPUT_NAME property in error message
  - Update add_executable and add_library command documentation
2008-02-11 13:35:39 -05:00
Brad King 739a463539 ENH: Add cmMakefile::NeedBackwardsCompatibility method to pass through to cmLocalGenerator::NeedBackwardsCompatibility for convenience. 2008-02-11 13:35:30 -05:00
Brad King 45d0dd1344 BUG: Fix misuse of stl vector that caused definitions to be dropped by cmMakefile::PushScope. 2008-01-30 08:37:38 -05:00
Brad King 5594ad4885 ENH: Updated exporting and importing of targets to support libraries and configurations.
- Created cmExportFileGenerator hierarchy to implement export file generation
  - Installed exports use per-config import files loaded by a central one.
  - Include soname of shared libraries in import information
  - Renamed PREFIX to NAMESPACE in INSTALL(EXPORT) and EXPORT() commands
  - Move addition of CMAKE_INSTALL_PREFIX to destinations to install generators
  - Import files compute the installation prefix relative to their location when loaded
  - Add mapping of importer configurations to importee configurations
  - Rename IMPORT targets to IMPORTED targets to distinguish from windows import libraries
  - Scope IMPORTED targets within directories to isolate them
  - Place all properties created by import files in the IMPORTED namespace
  - Document INSTALL(EXPORT) and EXPORT() commands.
  - Document IMPORTED signature of add_executable and add_library
  - Enable finding of imported targets in cmComputeLinkDepends
2008-01-28 08:38:36 -05:00
Brad King 7213408287 ENH: Added cmMakefile::NeedCacheCompatibility method and support for it in cmCacheManager. This will allow commands to modify their behavior when running with a cache loaded from an earlier CMake version. 2008-01-24 07:37:08 -05:00
Ken Martin 0e69d38004 ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class 2008-01-23 10:28:26 -05:00
Alexander Neundorf 52b96e5bd9 BUG: don't crash if cmMakefile::RaiseScope() is called from a cmake file in
the top level directory in normal code (i.e. not within a function)

Alex
2008-01-18 17:11:50 -05:00
Brad King 9d57dbd098 ENH: Make per-configuration COMPILE_DEFINITIONS_<CONFIG> directory property initialized from parent. 2008-01-17 20:34:10 -05:00
Brad King 7f589c9f23 BUG: COMPILE_DEFINITIONS directory property needs to be inherited from parent when a directory is created. 2008-01-17 19:50:39 -05:00
Brad King 433099ecdd ENH: Converted cmMakefile DefineFlags added by ADD_DEFINITIONS command into a COMPILE_DEFINITIONS directory property. 2008-01-17 19:29:43 -05:00
Brad King caca9b8065 ENH: Add AppendProperty methods for use by C++ code in CMake. Simplify implementation of SET_PROPERTY command by using them. 2008-01-17 18:13:55 -05:00
Amitha Perera 4d9259c15b STYLE: Spelling fixes on documentation 2008-01-09 22:09:19 -05:00
Ken Martin ac4c2f675a ENH: change raise_scope signature to be safer for returned varuables 2008-01-03 11:22:33 -05:00
Brad King dcd9a1b59f BUG: Make RAISE_SCOPE function work when variable is not defined. 2008-01-02 17:49:16 -05:00
Bill Hoffman b479c6a8a9 ENH: add ability to have manifest files and incremental linking with make and nmake 2008-01-01 15:13:41 -05:00
Alexander Neundorf 3a304f8e1b STYLE: nicer error message:
"Command options() is not scriptable" is IMO better to understand than
"Command options not scriptable" (with all uppercase commands it was easier to see)

Alex
2007-12-19 16:46:15 -05:00
Ken Martin f4b1c3880b ENH: add functions and raise scope 2007-12-03 13:35:41 -05:00
Ken Martin 433a914910 ENH: different way of testing properties 2007-11-06 14:16:00 -05:00
Ken Martin 923b51ece0 COMP: fix for when STRICT is defined, and fix for props that have no docs 2007-10-23 10:40:49 -04:00
Ken Martin 6cdf032505 ENH: change to make the documentation class more generic, about halfway there, also provides secitons for Variables now 2007-10-22 12:49:09 -04:00
Alexander Neundorf fc9f19b202 COMP: explicitely cast to int to silence warning with msvc8
Alex
2007-08-28 16:27:10 -04:00
Alexander Neundorf f55dd81190 COMP: parent is not used anymore with this patch, since now the name is
given as a vector of components

Alex
2007-08-26 03:17:11 -04:00
Alexander Neundorf 9220e97401 BUG: fix #4057 (which had several duplicates): handle recursivew source groups better, i.e. multiple sourcegroups with the same end component work now
Alex
2007-08-24 14:21:49 -04:00
Alexander Neundorf 512e0d40ef ENH: set UNIX, WIN32 and APPLE in cmMakefile.cxx as it was before, so it
works for scripts, then reset them in CMakeSystemSpecificInformation.cxx, so
the platform modules can set them again for the target system

Alex
2007-08-10 09:07:39 -04:00
Alexander Neundorf 176fe63d15 ENH: UNIX, CYGWIN, WIN32, APPLE, QNXNTO and BEOS are not longer set in
cmMakefile.cxx, but now in the platform files and are now valid for the
target platform, not the host platform.
New variables CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE and
CMAKE_HOST_CYGWIN have been added in cmMakefile.cxx (...and have now to be
used in all cmake files which are executed before
CMakeSystemSpecificInformation.cmake is loaded). For compatibility the old
set is set to the new one in CMakeDetermineSystem.cmake and reset before the
system platform files are loaded, so custom language or compiler modules
which use these should still work.

Alex
2007-08-09 14:45:23 -04:00
Brad King d7118006de BUG: Target exclusion-from-all tests should always use the root local generator associated with the all target being tested. 2007-08-03 15:44:25 -04:00
Alexander Neundorf 581518919b STYLE: even more output when --debug-output is used
Alex
2007-07-20 08:48:32 -04:00
Alexander Neundorf 55303d6dd2 STYLE: fix line lengths
Alex
2007-07-20 08:36:16 -04:00
Alexander Neundorf 8c77fe55dc STYLE: fix some typos, nicer debug output
Alex
2007-07-19 11:13:01 -04:00
Alexander Neundorf 95a8331edb ENH: produce a lot more output when running with --debug-output
-try to fix build error on HPUX

Alex
2007-07-17 09:25:08 -04:00
Alexander Neundorf fac8604810 BUG: GET_DIRECTORY_PROPERTY(INCLUDE_DIRECTORIES|LINK_DIRECTORIES) wasn't
working, for both the result was always empty, since
cmMakefile::GetProperty() recognized it as a special property, constructed a
correct return value and called cmMakefile::SetProperty() with this list of
directories, which then didn't actually set the property, but applied it to
the internal vector of include/link directories. The following
getPropertyValue in cmMakefile::GetProperty() then still didn't find it and
returned nothing. Now for all special property the static string output is
used and its content is returned. I'm not sure it is the right way to fix
this problem but at least it seems to work and it fixes the Paraview3 build

Alex
2007-07-16 13:26:56 -04:00
Alexander Neundorf ab10b43ec5 ENH: change the way #cmakedefine is changed to #undef, so it is similar to
what autoconf does. This makes porting software from autoconf to cmake
easier, since it's easier to diff the resulting config headers.

Now the following
#cmakedefine HAVE_STRING_H 1
#cmakedefine HAVE_STRLCAT 1

produce:

#define HAVE_STRING_H 1
/* #undef HAVE_STRLCAT */

whereas before they produced:

#define HAVE_STRING_H 1
/* #undef HAVE_STRLCAT 1 */

Since it's commented out anyway, it's now change in behaviour.

Alex
2007-07-11 15:50:32 -04:00
Ken Martin 8c641677e9 ENH: some cleanup of get property commands 2007-07-10 13:52:41 -04:00
Alexander Neundorf 43de8c8628 ENH: add OPTIONAL keyword to ENABLE_LANGUAGE, so it will be possible to do
something like this:

ENABLE_LANGUAGE(ASM-ATT)
IF(CMAKE_ASM-ATT_COMPILER_WORKS)
  ... do assembler stufff
ELSE(CMAKE_ASM-ATT_COMPILER_WORKS)
  ... fallback to generic C/C++
ENDIF(CMAKE_ASM-ATT_COMPILER_WORKS)

Alex
2007-06-28 09:09:26 -04:00
Ken Martin 509f1fb9cb ENH: some property cleanup and added GetProperty 2007-06-25 09:51:37 -04:00
Alexander Neundorf f7d4f27c2a ENH: add IMPORT keyword to ADD_LIBRARY, dependencies are not yet working
STYLE: fix line lengths and indentation, use enum as argument to AddLibrary() instead of int (which was initialized from a bool in some cases)

Alex
2007-06-22 09:58:10 -04:00
Brad King 35936433e1 ENH: Merging changes from branch CMake-SourceFile2-b between tags
CMake-SourceFile2-bp and CMake-SourceFile2-b-mp1 to trunk.  This
commit is surrounded by tags CMake-SourceFile2-b-mp1-pre and
CMake-SourceFile2-b-mp1-post on the trunk.

The changes re-implement cmSourceFile and the use of it to allow
instances to be created much earlier.  The use of cmSourceFileLocation
allows locating a source file referenced by a user to be much simpler
and more robust.  The two SetName methods are no longer needed so some
duplicate code has been removed.  The strange "SourceName" stuff is
gone.  Code that created cmSourceFile instances on the stack and then
sent them to cmMakefile::AddSource has been simplified and converted
to getting cmSourceFile instances from cmMakefile.  The CPluginAPI has
preserved the old API through a compatibility interface.

Source lists are gone.  Targets now get real instances of cmSourceFile
right away instead of storing a list of strings until the final pass.

TraceVSDependencies has been re-written to avoid the use of
SourceName.  It is now called TraceDependencies since it is not just
for VS.  It is now implemented with a helper object which makes the
code simpler.
2007-06-18 11:59:23 -04:00
Brad King 28e94533dd BUG: More problems with cmMakefile copy-constructor. It seems the regular expression class cannot be assigned but does not enforce this limitation at compile time. 2007-06-11 10:25:40 -04:00
Brad King 5e0da0b0eb BUG: Copy constructor needs to copy regular expression members. 2007-06-08 17:44:36 -04:00
Alexander Neundorf 0ddc9f62e5 ENH: add cmExternalMakefileProjectGenerator, which should make it easier to
write generators for IDE projects, which use already existing makefiles
(current the kdevelop generator)
-first stept of the export interface, iniitial export() command
-more replacements for the FIND_XXX docs

Alex
2007-06-08 11:57:16 -04:00
Brad King db0f26e852 BUG: Fixed @ONLY configuration to not try to parse ${} syntax at all. This fixes the original fix to bug#4393 and adds a test. 2007-06-06 16:20:02 -04:00
Brad King d2f62e6ac3 ENH: Made cmTarget::GetSourceLists return a reference to const so that all additions of sources must go through access methods in cmTarget. 2007-05-28 09:59:08 -04:00
Brad King ba7780a3c4 ENH: Fixed INSTALL_FILES and INSTALL_PROGRAMS commands to not create targets. No targets of type cmTarget::INSTALL_FILES or cmTarget::INSTALL_PROGRAMS are created, so we do not need to check for them everywhere anymore. 2007-05-23 15:40:12 -04:00
Alexander Neundorf 4878c00905 ENH: add the IMPORT keyword to ADD_EXECUTABLE(), which generates an
"imported" executable target. This can then be used e.g. with
ADD_CUSTOM_COMMAND() to generate stuff. It adds a second container for
"imported" targets, and FindTarget() now takes an additional argument bool
useImportedTargets to specify whether you also want to search in the
imported targets or only in the "normal" targets.

Alex
2007-05-22 10:24:59 -04:00
Brad King 9a5b4eba97 BUG: All variable accesses should produce watch callbacks, including IF(DEFINED <var>) ones. Instead we define a new access type for IF(DEFINED) so that the error does not show up for backward compatibility variables. 2007-05-17 17:40:59 -04:00
Brad King b8928b0c8e BUG: Do not complain about missing watched variables when they are accessd with IF(DEFINED VAR). 2007-05-17 15:12:13 -04:00
Brad King bdc7792e40 COMP: GCC 2.95 does not have std::string::clear() method. 2007-05-17 14:47:18 -04:00
Alexander Neundorf 61d3444f93 ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions

Alex
2007-05-17 13:20:44 -04:00
Alexander Neundorf 7f11536704 ENH: now target names can be used in add_custom_command() and
add_custom_target() as COMMAND, and cmake will recognize them and replace
them with the actual output path of these executables. Also the dependency
will be added automatically. Test included.
ENH: moved TraceVSDependencies() to the end of GlobalGenerator::Configure(),
so it is done now in one central place

Alex
2007-05-09 08:25:45 -04:00
Alexander Neundorf 16b1f05fc2 COMP: fix warning on VS8: conversion unsigned int -> size_t
Alex
2007-05-04 09:50:39 -04:00
Alexander Neundorf ef0b9ff2cc BUG: fix cmake listfile stack: if a file could not be opened, remove it from
the stack (usually CMakeCInformation.cmake and CMakeCXXInformation.cmake
which both put Linux-gcc.cmake on the stack without removing it again:
INCLUDE(... OPTIONAL) )
STYLE: better readable output formatting of the listfile stack, now in the
same order as in gdb or with include files

Alex
2007-05-01 11:46:47 -04:00
Andy Cedilnik f9f1ccadb3 ENH: Add variable watch command 2007-04-11 15:13:05 -04:00
Brad King cc13a060c6 STYLE: Fix line-too-long. 2007-04-05 09:19:29 -04:00
Andy Cedilnik 6fb9e2781a ENH: Add variable for the current list file 2007-04-04 12:05:10 -04:00
Brad King 5a32aa5919 ENH: Added target property ENABLE_EXPORTS for executable targets. It enables the executables for linking by loadable modules that import symbols from the executable. This finishes the executable import library support mentioned in bug #4210. 2007-03-22 09:45:25 -04:00
Ken Martin f52d37c26f BUG: change in how set cache overrides local definitions. Should mainly be a NOP change for most cases 2007-03-15 13:48:15 -04:00