Commit Graph

4 Commits

Author SHA1 Message Date
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