Hi,
In a project of mine, some of my dependencies apparently use the Accelerate framework. When linking against them, I get link lines that look like (I’m not sure why the -framework Accelerate
is duplicated, but deduplicating it manually didn’t seem to make a difference):
/Users/sam/code/project/dep/install/bin/clang++ -g -arch arm64 -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-search_paths_first
-Wl,-headerpad_max_install_names -Wl,-no_compact_unwind
tests/CMakeFiles/my_test.dir/my_test.cpp.o -o tests/my_test
-l/Users/sam/code/project/dep/install/lib/libstrumpack.a
-Xlinker -framework -Xlinker Accelerate -lm -ldl
-Xlinker -framework -Xlinker Accelerate -lm -ldl
which ends up failing with
ld: framework not found Accelerate
The accelerate framework is in the standard place:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
and if I manually point the compiler at that directory with
target_link_options(mylib PUBLIC
"-Wl,-F/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/")
then things work correct correctly.
I’m trying to find out why this isn’t being done automatically, or how to work around it without hardcoding a machine-specific path in my CMakeLists.txt.
I see that there is a variable named CMAKE_SYSTEM_FRAMEWORK_PATH
, and it has
the value of:
message(${CMAKE_SYSTEM_FRAMEWORK_PATH})
#output (verbatim)
~/Library/Frameworks/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Network/Library/Frameworks/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Library/Developer/CommandLineTools/Library/Frameworks/Library/Developer/CommandLineTools/Library/Frameworks/Library/Frameworks/Network/Library/Frameworks/System/Library/Frameworks
Is this the expected output, with no whitespace or semicolon separators? If so, how can I extract the relevant framework directory from this variable?
Thank you