Commit Graph

245 Commits

Author SHA1 Message Date
Chuck Atkins 02d177c9cc Add additional <= and >= comparison operators
This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION
equivalents to use the combined <= and >= functionality.
2016-08-09 09:30:34 -04:00
Daniel Pfeifer 7a649111cd Use string(APPEND) in Tests
Automate with:

find Tests -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2016-07-28 00:43:04 +02:00
Brad King 4786ec515f Source: Remove long-unused .cvsignore file 2016-07-08 13:36:38 -04:00
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King e1c7747253 Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -04:00
Mariusz Pluciński 1902c293ba Tests: fix complexOneConfig building on Clang/C2 2016-03-10 09:11:41 -05:00
Gregor Jasny 5b04aa31b8 Xcode: Disable test for system include dirs 2016-02-08 12:48:35 +01:00
Brad King 560b3e9f1d Tests: Remove incorrect indentation from Complex test comment 2015-01-22 14:11:46 -05:00
Clinton Stimpson 9a8ab86645 Encoding: Modify tests to work using non-ascii paths.
For complex*, CustomCommand and OutDir tests, non-ascii paths
are avoided in test code by using relative paths, and setting
the working when running the test.  This also avoids the
need to internationalize the test code.

For RunCMake.GeneratorExpression, use a UTF-8 encoding in
file(STRINGS) to retrieve the compiled absolute path correctly.
2015-01-08 20:56:51 -07:00
Brad King fb95f820e0 Tests: Set policies in 'complex' tests
These tests cover the OLD behavior of some policies.  Set them to
OLD to avoid warnings in the test output.  Leave a comment that
explains why this is done here but not recommended in general.
2014-07-22 09:36:57 -04:00
Ben Boeckel 7db77a828a tests: allow RelWithDebInfo and MinSizeRel configs to work 2014-06-05 12:42:13 -04:00
Rolf Eike Beer b0f277db38 HP aCC: record compiler flag for Ansi C++98 support for version 3.80 onwards
Old versions of aCC need a special compiler flag to get full C++98 template
support as e.g. CMake itself or the Complex and ComplexOneConfig tests need.
The same versions need a special flag to get a proper C++ library, too.
2014-04-25 17:59:57 +02:00
Rolf Eike Beer f21ac16edd Replace MATCHES test on numbers with EQUAL test
The MATCHES tests were actually wrong, as "a4b" and "42" would also cause a
match when it should not.
2014-04-14 18:17:49 +02:00
Rolf Eike Beer b0b4b4602f Remove .* expressions from beginning and end of MATCHES regexs
All these expressions work the same:
  "foo"
  ".*foo.*"
  "^.*foo.*$"

This assumes that the "Intel*" expressions were meant to be "Intel.*".
2014-04-14 18:17:11 +02:00
Daniele E. Domenichelli 15610bb5b1 Drop use of configure_file IMMEDIATE option
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
2013-11-13 10:12:17 -05:00
Brad King 7d47c69365 Drop compatibility with CMake < 2.4
Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
a value lower than 2.4, and generate an error when projects or the user
attempt to do so.  In the error suggest using a CMake 2.8.x release.

Teach cmake_minimum_required to warn about projects that do not require
at least CMake 2.4.  They are not supported by CMake >= 3.0.

Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
reference to policy CMP0001.
2013-10-23 08:54:31 -04:00
Adrien Destugues 7ebc1cb2ff Haiku: Several fixes to platform module
* Do not define BEOS anymore (this includes workarounds which we don't
  need most of the time in Haiku, so we prefer opt-in IF(HAIKU) in the
  cmake files instead).
* On the other hand, do define UNIX (we are trying to be compliant) and
  HAIKU (there is still a number of things we don't do like the
  average UNIX clone)
* Do not use UnixPaths, as our filesystem hierarchy isn't anything like
  what it expects.
* Do not use -nostart, which the compiler doesn't know about anymore.
  This used to be an Haiku extension to gcc, and is equivalent to
  -shared which is the default gcc option.
* While "dl" functions are provided in libroot, this is always
  implicitly linked so there is no need to tell cmake about it.
* Forcing position-independent code is not needed, so remove it.
* On the other hand, include appropriate linker options for executables
  and shared libraries.
* Support for the two available compilers in Haiku (gcc2 and gcc4) and
  pick the right headers and libraries according to the currently
  selected one.
* With the adoption of the package manager, the directory layout was
  changed. Tell cmake where to look for header files and libraries.
* As we don't define BEOS anymore, enable the workaround we still need
  for HAIKU as well. This is the lack of a libm (it is part of the
  implicitly linked in libroot)

Applied-by: Rolf Eike Beer <eike@sf-mail.de>
2013-10-08 09:54:46 -04:00
Rolf Eike Beer cd4451d1e7 replace string(... MATCHES "^const$) with string(... STREQUAL "const") 2013-06-02 22:18:19 +02:00
Brad King ec1ba9b0ae get_filename_component: Add explicit unit tests
Add test RunCMake.get_filename_component to cover cases of the command.
Remove redundant coverage of these cases from the "complex" tests.
2013-04-16 09:35:29 -04:00
Kitware Robot 9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot 77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King 53d31c2426 complex: Remove unused option to test CMakeLib
Now that the Complex tests do not depend on cmSystemTools or other
classes from CMakeLib the COMPLEX_TEST_CMAKELIB option is useless.
2011-12-23 16:16:57 -05:00
Brad King c1789e6986 complex: Remove test dependence on cmSystemTools
Use C standard 'remove' and POSIX standard 'stat'.
2011-12-23 16:16:56 -05:00
Brad King 569cee1d9e complex: Move cmSystemTools::UpperCase test to CMakeLibTests
This test belongs in the CMakeLibTests test driver executable which
correctly links to CMakeLib.
2011-12-23 16:16:54 -05:00
Brad King 49d6dd67f1 complex: Simplify test for single-character exe name
Run the test executable as a custom command instead of depending on
cmSystemTools::RunSingleCommand.
2011-12-23 16:16:52 -05:00
Brad King 76ac88b730 complex: Move GeneratedFileStream test to CMakeLibTests
This test belongs in the CMakeLibTests test driver executable which
correctly links to CMakeLib.  Fix incorrect library link order in the
Complex tests exposed by this change.
2011-12-23 16:16:50 -05:00
Brad King 137e5974bc complex: Remove dynamic loader tests
Everything covered by these tests is now covered by the KWSys
DynamicLoader test and the Plugin test.
2011-12-23 16:16:49 -05:00
Brad King 63379207e1 complex: Sync Tests/ComplexOneConfig with Tests/Complex
The two test sources must remain identical.  Apply to ComplexOneConfig
the change that commit f578381e (Fix vs2010 project generation error
when HEADER_FILE_ONLY is set, 2010-12-20) made to Complex.
2011-12-23 16:16:47 -05:00
Brad King 6a7582124c complex: Remove ancient unused ComplexRelativePaths test 2011-12-23 16:16:45 -05:00
Bill Hoffman fb51d98562 Switch to using libarchive from libtar for cpack and cmake -E tar
This allows for a built in bzip and zip capability, so external tools
will not be needed for these packagers.  The cmake -E tar xf should be
able to handle all compression types now as well.
2009-10-30 13:10:56 -04:00
Brad King 7dcfc8d23a Make Complex test of CMakeLib more optional
Previously we passed inputs to the decision to each Complex test and let
the test source decide.  This commit moves the decision out of the tests
and makes it an option() in their source.  This makes it possible to
build the Complex tests from outside the CMake test tree.
2009-10-07 16:11:52 -04:00
Bill Hoffman 5c4208f50e ENH: only 5 failing tests for VS 10 2009-07-10 09:12:39 -04:00
Brad King d1aa17a7b0 ENH: Remove CMAKE_ANSI_CFLAGS from tests
As of CMake 2.6 this variable is not defined, and the ANSI flags for the
HP compiler are simply hard-coded in the default C flags.
2009-07-08 11:41:48 -04:00
Brad King 430cc2b4b7 ENH: Always imply CLEAN_DIRECT_OUTPUT target prop
This property was left from before CMake always linked using full path
library names for targets it builds.  In order to safely link with
"-lfoo" we needed to avoid having both shared and static libraries in
the build tree for targets that switch on BUILD_SHARED_LIBS.  This meant
cleaning both shared and static names before creating the library, which
led to the creation of CLEAN_DIRECT_OUTPUT to disable the behavior.

Now that we always link with a full path we do not need to clean old
library names left from an alternate setting of BUILD_SHARED_LIBS.  This
change removes the CLEAN_DIRECT_OUTPUT property and instead uses its
behavior always.  It removes some complexity from cmTarget internally.
2009-05-01 10:38:35 -04:00
Brad King 493f88ce55 ENH: Allow projects to disable per-rule echo lines
This creates global property RULE_MESSAGES which can be set to disbale
per-rule progress and action reporting.  On Windows, these reports may
cause a noticable delay due to the cost of starting extra processes.
This feature will allow scripted builds to avoid the cost since they do
not need detailed information anyway.  This replaces the RULE_PROGRESS
property created earlier as it is more complete.  See issue #8726.
2009-03-16 16:55:58 -04:00
Brad King 2f651c2e59 ENH: Allow projects to disable per-rule progress
This creates global property RULE_PROGRESS which can be set to disbale
per-rule progress reporting.  On Windows, progress reports may cause a
noticable delay due to the cost of starting an extra process.  This
feature will allow scripted builds to avoid the cost since they do not
need detailed progress anyway.  See issue #8726.
2009-03-16 16:22:19 -04:00
Bill Hoffman 46b9a884ac ENH: make this test pass if new curl is on 2008-11-21 16:10:09 -05:00
Bill Hoffman 0f88ea3993 ENH: only link in curl directories that exist, this will help with vs6 nmake 2008-11-20 14:06:57 -05:00
Bill Hoffman bc1f0e1b11 ENH: make it work if new curl is on 2008-11-19 01:15:41 -05:00
Bill Hoffman 32ac624352 ENH: make it work if new curl is on 2008-11-18 09:37:31 -05:00
Brad King fff812db95 ENH: Add if(TARGET) command
It is useful to be able to test if a target has been created.  Often
targets are created only inside conditions.  Rather than storing the
result of the condition manually for testing by other parts of the
project, it is much easier for the other parts to just test for the
target's existence.  This will also be useful when find-modules start
reporting results with IMPORTED targets and projects want to test if a
certain target is available.
2008-08-20 11:45:16 -04:00
Brad King 7f7068e9d4 ENH: Add cmake_policy(GET) command mode
It is likely that projects or CMake modules in the future will need to
check the value of a policy setting.  For example, if we add a policy
that affects the results of FindXYZ.cmake modules, the module code will
need to be able to check the policy.
2008-08-18 09:53:06 -04:00
Ken Martin 19e891532a ENH: support parenthesis as arguments and in conditionals feature request #6191 2008-06-26 13:01:35 -04:00
Brad King a6a673979d ENH: Add "if(POLICY policy-id)" option for IF command.
- This will help projects support multiple CMake versions.
  - In order to set a policy when using a newer CMake but still
    working with an older CMake one may write
      if(POLICY CMP1234)
        cmake_policy(SET CMP1234 NEW)
      endif(POLICY CMP1234)
  - Note that since CMake 2.4 does not have if(POLICY) supporting
    it will also require using "if(COMMAND cmake_policy)"
2008-03-20 18:25:59 -04:00
Brad King b459ec9f57 ENH: Updated DEFINE_PROPERTY command to be more extendible and more consistent with new SET_PROPERTY and GET_PROPERTY signatures. 2008-02-14 13:36:23 -05:00
Bill Hoffman 378ca535a4 ENH: complex must link to curl now 2008-02-07 08:55:56 -05:00
Brad King 96fd5909d9 ENH: Implement linking with paths to library files instead of -L and -l separation. See bug #3832
- This is purely an implementation improvement.  No interface has changed.
  - Create cmComputeLinkInformation class
  - Move and re-implement logic from:
      cmLocalGenerator::ComputeLinkInformation
      cmOrderLinkDirectories
  - Link libraries to targets with their full path (if it is known)
  - Dirs specified with link_directories command still added with -L
  - Make link type specific to library names without paths
    (name libfoo.a without path becomes -Wl,-Bstatic -lfoo)
  - Make directory ordering specific to a runtime path computation feature
    (look for conflicting SONAMEs instead of library names)
  - Implement proper rpath support on HP-UX and AIX.
2008-01-22 09:13:04 -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 88b31bd007 ENH: Adding test for using HEADER_FILE_ONLY to avoid building a .cxx file. 2007-11-19 14:27:43 -05:00