Page MenuHomePhabricator

[CMAKE] Fix the build with Xcode as a generator
ClosedPublic

Authored by Fabien on Feb 27 2020, 11:57.

Details

Summary

Xcode (like Visual Studio) manages build configurations from the IDE and
append this configuration name as a subdirectory for the built targets.
It allows the tools to maintain several configuration builds under the
same tree.

This is causing an issue with native executables, as it becomes
impossible to retrieve the path to the generated native executable.

This diff solves the issue by disabling the subfolder creation for
native executables.
One consequence is that the binary might be overriden on configuration
change. This is unlikely to occur because the configuration is not
passed down when building the native executables, so it should always
fallback to use the same default configuration.

This does not solve all the issues, e.g. the check target still fails
to find the test_bitcoin executable (the target path expansion does
not work since it's wrapped into a shell script). This is left for
another diff.

Depends on D5333.

Test Plan

Test there is no regression with ninja ...:

cmake -GNinja ..
ninja

... nor make:

cmake -G"Unix Makefiles" ..
make

The build now succeeds with Xcode (run on OSX):

cmake -GXcode ..
cmake --build ${PWD} # No idea how to invoke xcode, but cmake knows !

Run the Gitian builds.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Feb 28 2020, 23:50