Commit Graph

14 Commits

Author SHA1 Message Date
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 b42866a34a Drop Visual Studio 6 generator
This generator has been deprecated since CMake 3.3.  Remove it.
Update documentation, modules, and tests to drop content specific
to this generator.
2016-03-09 09:42:18 -05:00
Brad King 2c470b775a add_library: Allow arbitrary non-linked sources in OBJECT libraries
Loosen this restriction on OBJECT libraries to allow source files of any
name to be generated by custom commands or listed for reference in IDE
projects so long as they would not affect linking of a normal library.
Update the rejection message to be more specific about the looser
restriction.

Extend the ObjectLibrary test to cover a ".cmake" file generated by a
custom command in an OBJECT library.
2014-07-09 09:43:42 -04:00
Brad King de4f3e2c82 Tests: Fix broken dependency in ObjectLibrary test
The add_custom_command DEPENDS option needs a full path.
2014-07-07 08:58:08 -04:00
Brad King 54bf5858cd Tests: Resolve TODO comment left in ObjectLibrary test
We now have a generic way to add -fPIC without explicitly modifying
CMAKE_C_FLAGS, so use it.
2014-07-07 08:58:08 -04:00
Ben Boeckel ac8879ce91 Ninja: Add order-only dependencies to link commands (#14728)
A library or executable target that consists only of a reference to an
object library may have no sources to compile or custom commands to run.
The command in the target is the link (or archive) command.  Add missing
order-only dependencies to link commands so that target ordering
dependencies are satisfied for it without depending on an intermediate
compilation rule.

Extend the ObjectLibrary test to cover this case.

Co-Author: Brad King <brad.king@kitware.com>
2014-07-01 10:14:28 -04:00
Stephen Kelly 310aef959b Make ExportLanguages a subtest of the ObjectLibrary test
It was a subtest of the RunCMake.ObjectLibrary test. However, we need
to test a build with ExternalProject after running CMake, which RunCMake tests
do not do.
2013-10-24 19:05:34 +02:00
Stephen Kelly faa927e273 Make sure INTERFACE properties work with OBJECT libraries. 2013-02-08 20:10:22 +01:00
Stephen Kelly 510fdcb188 Whitelist target types in target_{include_directories,compile_definitions}
Setting include directories or compile definitions on a target created
with add_custom_target does not make sense.
2013-02-08 19:21:30 +01:00
Brad King 94c08b368c Tests/ObjectLibrary: Do not enable CXX in subdirectories
In commit b237dbd8 (Xcode: Fix object library references in
multi-project trees, 2012-08-03) we accidentally enabled CXX in the
subdiretories of this test by invoking project() with only one argument.
The top-level directory of the test enables only C, so do this in the
subdirectories too.
2012-08-20 14:47:33 -04:00
Brad King b237dbd8c3 Xcode: Fix object library references in multi-project trees (#13452)
In cmGlobalXCodeGenerator::Generate we generate a .xcodeproj for each
directory in the tree containing a project() command.  First we
iteratively use SetGenerationRoot to add "ALL_BUILD" and other targets
to each project.  This leaves "CurrentProject" set to the last project
when we invoke cmGlobalGenerator::Generate, which is not the same as the
top-level project if any subdirectories invoke the project() command.

When cmGlobalGenerator::Generate reaches CreateGeneratorTargets it
constructs cmGeneratorTarget and calls ComputeTargetObjects exactly once
per target.  In this context the value of CurrentProject is undefined so
we cannot pass it to GetObjectsNormalDirectory.  Use "$(PROJECT_NAME)"
instead so it will adapt automatically to each project.

Also teach Tests/ObjectLibrary to cover this case.
2012-08-03 10:17:49 -04:00
Brad King fb7348f644 Fix ObjectLibrary test on Watcom
The Watcom compiler interprets "-DB" as option

 -db generate browsing information

so define "A_DEF" and "B_DEF" instead of just "A" and "B".

Skip CMAKE_SHARED_LIBRARY_C_FLAGS for Watcom because it is set to

 -bd  build Dynamic link library

which adds a DLL entry point to each object.
2012-03-20 15:09:57 -04:00
Brad King c3242500b6 Test OBJECT library use without other sources
Reference OBJECT libraries for inclusion in targets that have no other
sources to verify that the linker language propagates correctly from the
object libraries.  Test with a STATIC library, a SHARED library, and an
EXECUTABLE target.  Use the static and shared libraries each in
executables that end up using the object library symbols.

In VS 6, 7, and 7.1 add a dummy object file to convince the IDE to build
the targets without sources.  In Xcode add a dummy source file to
convince it to build targets without sources.
2012-03-16 10:12:30 -04:00
Brad King 69d3d1835c Test OBJECT library success cases
Add "ObjectLibrary" test to build and use OBJECT libraries.  Build
multiple object libraries in separate directories with different flags.
Use a custom command to generate a source file in one OBJECT library.

Reference the OBJECT libraries for inclusion in a STATIC library, a
SHARED library, and an EXECUTABLE target.  Use the static and shared
libraries each in executables that end up using the object library
symbols.  Verify that object library symbols are exported from the
shared library.
2012-03-16 10:12:30 -04:00