Skip to content
Permalink
Browse files

Use modern cmake modules for more vcpkg packages

sdl2-mixer and freetype come with cmake modules in vcpkg. Use them instead of
the old FindXXX scripts for those packages when we use vcpkg.

When we update to cmake 3.10 we can get rid of the old path for Freetype.
SDL2 ships with a cmake module upstream, so we might already be able to drop
the alternative path for that dependency.
  • Loading branch information...
TheCycoONE committed Jun 11, 2019
1 parent ca13445 commit 33356037c05e3b8b4ca3cc3b29ef11f5f470d722
Showing with 26 additions and 16 deletions.
  1. +26 −16 CorsixTH/CMakeLists.txt
@@ -133,13 +133,18 @@ target_link_libraries(CorsixTH ${CMAKE_THREAD_LIBS_INIT})

# Find SDL_mixer
if(CORSIX_TH_USE_SDL_MIXER)
find_package(SDL2_mixer REQUIRED)
if(SDLMIXER_FOUND)
target_link_libraries(CorsixTH ${SDLMIXER_LIBRARY})
include_directories(${SDLMIXER_INCLUDE_DIR})
message(" SDL_mixer found")
if(MSVC AND USE_VCPKG_DEPS)
find_package(sdl2-mixer CONFIG REQUIRED)
target_link_libraries(CorsixTH SDL2::SDL2_mixer)
else()
message(FATAL_ERROR "Error: SDL_mixer library not found, even though it was selected to be included")
find_package(SDL2_mixer REQUIRED)
if(SDLMIXER_FOUND)
target_link_libraries(CorsixTH ${SDLMIXER_LIBRARY})
include_directories(${SDLMIXER_INCLUDE_DIR})
message(" SDL_mixer found")
else()
message(FATAL_ERROR "Error: SDL_mixer library not found, even though it was selected to be included")
endif()
endif()
endif()

@@ -176,17 +181,22 @@ endif()

# Find Freetype2
if(CORSIX_TH_USE_FREETYPE2)
find_package(Freetype REQUIRED)
if(FREETYPE_FOUND)
target_link_libraries(CorsixTH ${FREETYPE_LIBRARIES})
include_directories(${FREETYPE_INCLUDE_DIRS})
if(APPLE)
target_link_libraries(CorsixTH libz.dylib)
target_link_libraries(CorsixTH libbz2.dylib)
endif()
message(" FreeType2 found")
if(MSVC AND USE_VCPKG_DEPS)
find_package(Freetype REQUIRED)
target_link_libraries(CorsixTH Freetype::Freetype)
else()
message(FATAL_ERROR "Error: FreeType2 library not found, even though it was selected to be used")
find_package(Freetype REQUIRED)
if(FREETYPE_FOUND)
target_link_libraries(CorsixTH ${FREETYPE_LIBRARIES})
include_directories(${FREETYPE_INCLUDE_DIRS})
if(APPLE)
target_link_libraries(CorsixTH libz.dylib)
target_link_libraries(CorsixTH libbz2.dylib)
endif()
message(" FreeType2 found")
else()
message(FATAL_ERROR "Error: FreeType2 library not found, even though it was selected to be used")
endif()
endif()
endif()

0 comments on commit 3335603

Please sign in to comment.
You can’t perform that action at this time.