diff options
author | fuzzard <fuzzard@kodi.tv> | 2021-12-10 16:49:38 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2021-12-10 17:01:26 +1000 |
commit | e51a952f26ec74ec0a554607e407f3a77c7c1fdf (patch) | |
tree | 59c13f924a9e23800ec673470e8c98764c5e5421 /CMakeLists.txt | |
parent | 97576f95d36e30de4fa099859e1b83b3bc90420d (diff) |
[cmake] work around target gen expression issues for xcode projects
cmake has known shortcomings regarding generator expressions and xcode projects.
https://gitlab.kitware.com/cmake/cmake/-/issues/21039
The issue that shows up for kodi is arm64 build host building an x86_64 target, The
$<TARGET_OBJECTS:compileinfo> call can not detect the target arch type at build time,
and falls back to system arch at cmake generation time.
Build failure then occurs due to attempting to link compileinfo.o into libkodi.o from an
incorrect build folder (eg $(PROJECT_NAME).build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/compileinfo.build/$(OBJECT_FILE_DIR_normal:base)/arm64/CompileInfo.o)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e4dff92e6..1990efedc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,7 +307,17 @@ endif() set(GLOBAL_TARGET_DEPS ffmpeg dvdnav crossguid fmt Spdlog::Spdlog fstrcmp flatbuffers ${PLATFORM_GLOBAL_TARGET_DEPS}) # main library (used for main binary and tests) -add_library(lib${APP_NAME_LC} STATIC $<TARGET_OBJECTS:compileinfo>) +if(CMAKE_GENERATOR STREQUAL Xcode) + add_library(compileinfo_obj OBJECT IMPORTED) + set_property(TARGET compileinfo_obj PROPERTY IMPORTED_OBJECTS + "${CMAKE_BINARY_DIR}/$(PROJECT_NAME).build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/compileinfo.build/$(OBJECT_FILE_DIR_normal:base)/$(CURRENT_ARCH)/CompileInfo.o" + ) + add_library(lib${APP_NAME_LC} STATIC) + add_dependencies(lib${APP_NAME_LC} compileinfo) + target_link_libraries(lib${APP_NAME_LC} PUBLIC compileinfo_obj) +else() + add_library(lib${APP_NAME_LC} STATIC $<TARGET_OBJECTS:compileinfo>) +endif() add_dependencies(lib${APP_NAME_LC} ${GLOBAL_TARGET_DEPS}) set_target_properties(lib${APP_NAME_LC} PROPERTIES PREFIX "") |