I am currently trying to include SFML in my C++ application. I am using CMake to link the libraries.
Steps I followed / to reproduce:
Downloaded latest official release of SFML. (clang arm64)
Copied the files in the downloaded folder to system paths:
SFML/include/* -> usr/local/include/
SFML/lib/* -> usr/local/lib/
SFML/Frameworks/* -> Libraries/Frameworks/
SFML/extlibs/* -> Libraries/Frameworks/
- Linked the libraries using CMake
.
.
.
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)
.
.
.
target_link_libraries(
${PROJECT_NAME}
PRIVATE
${SFML_LIBRARIES}
)
.
.
.
target_include_directories(
${PROJECT_NAME} PUBLIC
${SFML_INCLUDE_DIR}
)
.
.
.
- Created app bundle for macOS in CMakeLists.txt:
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER app.yildirimege.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
CMake build is successful, finds the SFML include dirs and libraries. and successfully links.
When I try to run the app in QtCreator, (or manually by running make and ./app) the same messagebox occurs: "sfml-*.framework is damaged and can't be opened.
My Application Output:
'/Library/Frameworks/sfml-system.framework/Versions/2.6.0/sfml-system' not valid for use in process: library load disallowed by system policy)
However, I have a clue. When I print ${SFML_LIBRARIES}
in CMake, this is the output:
-- Found SFML .. in /Library/Frameworks/SFML.framework
SFML LIBRARIES:/Library/Frameworks/sfml-system.framework/Library/Frameworks/sfml-window.framework/Library/Frameworks/sfml-graphics.framework/Library/Frameworks/sfml-network.framework/Library/Frameworks/sfml-audio.framework
the libraries cmake trys to link are not the libraries in usr/local/lib, but the frameworks inside the Libraries/Frameworks. Is this the common behavior?
Also just saw this:
-- SFML INCLUDE DIR:/Library/Frameworks/SFML.framework
-- Found SFML .. in /Library/Frameworks/SFML.framework
Include dir is also wrong. I am using the official FindSFML.cmake config file
What I've Tried:
- Since this might be caused by invalid app signature, I selected "Allow apps to run downloaded from anywhere, in Settings -> Privacy & Security.
- Re-downloaded the SFML 2.6.0 after step 1.
- Downgraded SFML to below versions.
My system:
macOS Version: Ventura 13.4.1
M2 Pro Apple Silicon