Skip to content

Commit 41a605b

Browse files
committed
Improving handling of library dependencies
This way we don't look for the extension libraries unless we need them for the project we're building.
1 parent 1c0e390 commit 41a605b

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
2323
endif()
2424

2525
find_package(SDL2 REQUIRED)
26-
find_package(SDL2_image REQUIRED)
27-
find_package(SDL2_ttf REQUIRED)
28-
2926
include_directories(${SDL2_INCLUDE_DIR})
30-
include_directories(${SDL2_IMAGE_INCLUDE_DIR})
31-
include_directories(${SDL2_TTF_INCLUDE_DIR})
3227

3328
add_subdirectory(Lesson0)
3429
add_subdirectory(Lesson1)

Lesson3/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
project(Lesson3)
2+
3+
find_package(SDL2_image REQUIRED)
4+
include_directories(${SDL2_IMAGE_INCLUDE_DIR})
5+
26
add_executable(Lesson3 src/main.cpp)
37
target_link_libraries(Lesson3 ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY})
48
install(TARGETS Lesson3 RUNTIME DESTINATION ${BIN_DIR})

Lesson4/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
project(Lesson4)
2+
3+
find_package(SDL2_image REQUIRED)
4+
include_directories(${SDL2_IMAGE_INCLUDE_DIR})
5+
26
add_executable(Lesson4 src/main.cpp)
37
target_link_libraries(Lesson4 ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY})
48
install(TARGETS Lesson4 RUNTIME DESTINATION ${BIN_DIR})

Lesson5/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
project(Lesson5)
2+
3+
find_package(SDL2_image REQUIRED)
4+
include_directories(${SDL2_IMAGE_INCLUDE_DIR})
5+
26
add_executable(Lesson5 src/main.cpp)
37
target_link_libraries(Lesson5 ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY})
48
install(TARGETS Lesson5 RUNTIME DESTINATION ${BIN_DIR})

Lesson6/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
project(Lesson6)
2+
3+
find_package(SDL2_ttf REQUIRED)
4+
include_directories(${SDL2_TTF_INCLUDE_DIR})
5+
26
add_executable(Lesson6 src/main.cpp)
3-
target_link_libraries(Lesson6 ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2_TTF_LIBRARY})
7+
target_link_libraries(Lesson6 ${SDL2_LIBRARY} ${SDL2_TTF_LIBRARY})
48
install(TARGETS Lesson6 RUNTIME DESTINATION ${BIN_DIR})
59

Lesson6/src/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <string>
22
#include <iostream>
33
#include <SDL.h>
4-
#include <SDL_image.h>
54
#include <SDL_ttf.h>
65
#include "asset.h"
76

0 commit comments

Comments
 (0)