Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake/osx] Fix generating Xcode projects #10495

Merged
merged 1 commit into from
Sep 19, 2016

Conversation

fetzerch
Copy link
Member

Fixes broken Xcode project generation after #10372.

core_add_library does a different thing depending on the generator. For makefiles, it creates a new static library target (everytime it gets called). This leads to hunderts of small libraries (one per each directory). For Xcode or VS there is one libkodi static library and core_add_library only appends to that one. This was done to get a decent project structure in the IDEs. Using the same thing for makefiles leads to >60s linking time (every time you touch only a single line).

So in CMakeLists.txt files inside of the xbmc directory, make sure to always use the CORE_LIBRARY variable when specifying compile options or dependencies.

Unfortunately this is currently not very well documented, and I expect errors like this to appear from now and then. Don't yet have a good idea how to prevent them. One thing I could imagine is to have a script that runs some checks on the project files in CI.

Fixes errors such as:
CMake Error at xbmc/utils/CMakeLists.txt:194
(target_compile_options):
  Cannot specify compile options for target "utils" which is not built
  by this project.

Introduced by xbmc#10372.

For Xcode (and VS) core_add_library adds the files to compile to the
libkodi target. Therefore options have to be set for CORE_LIBRARY
which is set by core_add_library and expands to the correct library
depending on the generator.
@fetzerch fetzerch added Type: Fix non-breaking change which fixes an issue Platform: macOS CMake labels Sep 19, 2016
@mention-bot
Copy link

@fetzerch, thanks for your PR! By analyzing the annotation information on this pull request, we identified @wsnipex, @AchimTuran and @stefansaraev to be potential reviewers

@fetzerch
Copy link
Member Author

@hudokkow, @Paxxi: Ping just to make sure that you're aware of this black magic

@fetzerch fetzerch merged commit 75f3e64 into xbmc:master Sep 19, 2016
@fetzerch fetzerch deleted the cmake_fix_xcode branch September 19, 2016 15:58
@Paxxi
Copy link
Member

Paxxi commented Sep 19, 2016

Thanks, that's some non obvious behavior :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake Platform: macOS Type: Fix non-breaking change which fixes an issue v17 Krypton
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants