Xcode fails to compile project because of missing library path in master branch of CMake
CMake script which reproduces the problem:
cmake_minimum_required (VERSION 3.18)
project(CheckLibPath)
set (CMAKE_Swift_LANGUAGE_VERSION 5)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
enable_language (Swift)
add_library (framework_dependency_static STATIC)
target_sources (framework_dependency_static PRIVATE dummy.cpp)
foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER "${config}" ucase_config)
set_target_properties(framework_dependency_static PROPERTIES
LIBRARY_OUTPUT_DIRECTORY_${ucase_config} "${PROJECT_BINARY_DIR}/another/${config}/lib"
ARCHIVE_OUTPUT_DIRECTORY_${ucase_config} "${PROJECT_BINARY_DIR}/another/${config}/lib")
endforeach()
add_library (framework_test SHARED dummy.swift)
target_link_libraries (framework_test PRIVATE
framework_dependency_static)
set_target_properties (framework_test PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION A
MACOSX_FRAMEWORK_IDENTIFIER "framework.test"
VERSION "1.0"
SOVERSION 1.0
MACOSX_BUNDLE TRUE)
I configure project with cmake .. -GXcode
. When i try to compile it i get error: ld: library not found for -lframework_dependency_static
. The reason is that there should be either full path to llibframework_dependency_static.a
or library path should be added with -L option.
Also this issue seems fixed in this pull request: !5036 (merged) by @gusc