mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-16 05:09:04 +08:00
4ebf188da4
* [sdl2pp] Fix find_package error * [sdl2pp] Update to version 0.16.1
83 lines
3.1 KiB
Diff
83 lines
3.1 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index cdfd2a6..dc08748 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -23,11 +23,15 @@ ENDIF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
|
|
|
# depends
|
|
FIND_PACKAGE(SDL2 REQUIRED)
|
|
-SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
|
-SET(SDL2_ALL_LIBRARIES ${SDL2_LIBRARY})
|
|
+SET(SDL2_ALL_INCLUDE_DIRS )
|
|
+IF (BUILD_SHARED_LIBS)
|
|
+ SET(SDL2_ALL_LIBRARIES SDL2::SDL2)
|
|
+ELSE()
|
|
+ SET(SDL2_ALL_LIBRARIES SDL2::SDL2-static)
|
|
+ENDIF()
|
|
SET(SDL2_ALL_PKGCONFIG_MODULES sdl2)
|
|
-SET(SDL2PP_EXTRA_LIBRARIES ${SDL2MAIN_LIBRARY})
|
|
-SET(SDL2PP_EXTRA_PKGCONFIG_LIBRARIES ${SDL2MAIN_LIBRARY})
|
|
+SET(SDL2PP_EXTRA_LIBRARIES SDL2::SDL2main)
|
|
+SET(SDL2PP_EXTRA_PKGCONFIG_LIBRARIES SDL2::SDL2main)
|
|
|
|
IF(MINGW)
|
|
SET(MINGW32_LIBRARY "mingw32" CACHE STRING "mingw32 library")
|
|
@@ -36,27 +40,27 @@ IF(MINGW)
|
|
ENDIF(MINGW)
|
|
|
|
IF(SDL2PP_WITH_IMAGE)
|
|
- FIND_PACKAGE(SDL2_image REQUIRED)
|
|
- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIR})
|
|
- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_IMAGE_LIBRARY})
|
|
+ FIND_PACKAGE(sdl2-image CONFIG REQUIRED)
|
|
+ SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS})
|
|
+ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_image)
|
|
SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_image")
|
|
ELSE(SDL2PP_WITH_IMAGE)
|
|
MESSAGE(STATUS "SDL2_image support disabled")
|
|
ENDIF(SDL2PP_WITH_IMAGE)
|
|
|
|
IF(SDL2PP_WITH_TTF)
|
|
- FIND_PACKAGE(SDL2_ttf REQUIRED)
|
|
- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_TTF_INCLUDE_DIR})
|
|
- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_TTF_LIBRARY})
|
|
+ FIND_PACKAGE(sdl2-ttf CONFIG REQUIRED)
|
|
+ SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS})
|
|
+ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_ttf)
|
|
SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_ttf")
|
|
ELSE(SDL2PP_WITH_TTF)
|
|
MESSAGE(STATUS "SDL2_ttf support disabled")
|
|
ENDIF(SDL2PP_WITH_TTF)
|
|
|
|
IF(SDL2PP_WITH_MIXER)
|
|
- FIND_PACKAGE(SDL2_mixer REQUIRED)
|
|
- SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIR})
|
|
- SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} ${SDL2_MIXER_LIBRARY})
|
|
+ FIND_PACKAGE(sdl2-mixer CONFIG REQUIRED)
|
|
+ SET(SDL2_ALL_INCLUDE_DIRS ${SDL2_ALL_INCLUDE_DIRS})
|
|
+ SET(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_mixer)
|
|
SET(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_mixer")
|
|
ELSE(SDL2PP_WITH_MIXER)
|
|
MESSAGE(STATUS "SDL2_mixer support disabled")
|
|
@@ -81,7 +85,6 @@ ELSE(MSVC)
|
|
ENDIF()
|
|
ENDIF(MSVC)
|
|
|
|
-LIST(REMOVE_DUPLICATES SDL2_ALL_INCLUDE_DIRS)
|
|
|
|
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR})
|
|
INCLUDE_DIRECTORIES(SYSTEM ${SDL2_ALL_INCLUDE_DIRS})
|
|
@@ -200,10 +203,10 @@ IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
|
OPTION(SDL2PP_STATIC "Build static library instead of shared one" OFF)
|
|
|
|
# library
|
|
- IF(SDL2PP_STATIC)
|
|
+ IF(0)
|
|
ADD_LIBRARY(SDL2pp STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
|
|
ELSE(SDL2PP_STATIC)
|
|
- ADD_LIBRARY(SDL2pp SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
|
|
+ ADD_LIBRARY(SDL2pp ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
|
|
TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_ALL_LIBRARIES})
|
|
SET_TARGET_PROPERTIES(SDL2pp PROPERTIES VERSION 8.3.0 SOVERSION 8)
|
|
ENDIF(SDL2PP_STATIC)
|