Skip to content

Instantly share code, notes, and snippets.

@ebarlas
Created May 10, 2022 16:14
Show Gist options
  • Save ebarlas/8f7be484a3b1a0e9a2da838ed49f86b5 to your computer and use it in GitHub Desktop.
Save ebarlas/8f7be484a3b1a0e9a2da838ed49f86b5 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.20)
project(sdl_demo)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_VERBOSE_MAKEFILE ON)
include(FetchContent)
FetchContent_Declare(
SDL
GIT_REPOSITORY https://github.com/libsdl-org/SDL
GIT_TAG release-2.0.22)
FetchContent_MakeAvailable(SDL)
if (APPLE)
set(CMAKE_MACOSX_RPATH ON)
enable_language(OBJC)
enable_language(OBJCXX)
endif (APPLE)
FetchContent_Declare(
SDL_image
GIT_REPOSITORY https://github.com/libsdl-org/SDL_image
GIT_TAG abe5a02ef8b8b181e03b0aaa515390c393c11a89)
FetchContent_MakeAvailable(SDL_image)
FetchContent_Declare(
SDL_mixer
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer
GIT_TAG 2832ea6404c3e14fbb88c94792eaaaab1cd5c0d0)
FetchContent_MakeAvailable(SDL_mixer)
FetchContent_Declare(
SDL_ttf
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf
GIT_TAG ab576e803b9761b1abde5d9ddb17913aa4c98d8d)
FetchContent_MakeAvailable(SDL_ttf)
FetchContent_Declare(
SDL_net
GIT_REPOSITORY https://github.com/ebarlas/SDL_net
GIT_TAG cmake)
FetchContent_MakeAvailable(SDL_net)
add_executable(main main.cpp)
target_link_libraries(
main
PRIVATE
SDL2_mixer
SDL2_image
SDL2_ttf
SDL2_net
SDL2::SDL2
SDL2::SDL2main
)
@ebarlas
Copy link
Author

ebarlas commented May 10, 2022

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -I/Users/elliotb/Code/CLionProjects/sdl-demo/build/_deps/sdl_mixer-src/include -I/Users/elliotb/Code/CLionProjects/sdl-demo/build/_deps/sdl_image-src -I/Users/elliotb/Code/CLionProjects/sdl-demo/build/_deps/sdl-src/include -I/Users/elliotb/Code/CLionProjects/sdl-demo/build/_deps/sdl_ttf-src -isystem /usr/local/opt/freetype/include/freetype2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.5 -std=gnu++17 -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d -o CMakeFiles/main.dir/main.cpp.o -c /Users/elliotb/Code/CLionProjects/sdl-demo/main.cpp
/Users/elliotb/Code/CLionProjects/sdl-demo/main.cpp:5:10: fatal error: 'SDL_net.h' file not found
#include "SDL_net.h"
         ^~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment