mattwallace
mattwallace

Reputation: 4222

How do I add a .framework file to my cmake file

I downloaded the SDL2 library to use in my C++ project. I'm on OSX. I moved the SDL2.framework into my /Library/Frameworks directory.

I have no idea how to refer to this file in my cmake file in my c++ project. Wonder if someone could shed some light on this?

Upvotes: 3

Views: 969

Answers (1)

Velkan
Velkan

Reputation: 7592

As any other library:

find_package(SDL2 REQUIRED)

Then use ${SDL2_INCLUDE_DIR} and ${SDL2_LIBRARY} variables where needed (for example in places like target_include_directories(), target_link_libraries() or set_target_properties()).

If it complains about missing *.cmake script, then get somewhere on the Internet a FindSDL2.cmake file. Put it into modules/ directory in your project, and add that to the main CMakeLists.txt:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules/")

Upvotes: 1

Related Questions