File tree 3 files changed +26
-5
lines changed
3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 1
- cmake_minimum_required (VERSION 3.14 FATAL_ERROR)
1
+ cmake_minimum_required (VERSION 3.15 FATAL_ERROR)
2
2
3
3
if (CMAKE_VERSION VERSION_LESS 3.19 AND CMAKE_GENERATOR STREQUAL "Xcode" )
4
4
message (AUTHOR_WARNING "Using a CMake version before 3.19 with a recent Xcode SDK and the Xcode generator "
Original file line number Diff line number Diff line change @@ -55,9 +55,17 @@ endif()
55
55
56
56
# Temporary fix to deal with wrong include dir set by SDL2's CMake configuration.
57
57
get_target_property (_SDL2_INCLUDE_DIR SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES )
58
- if (_SDL2_INCLUDE_DIR MATCHES "(.+)/SDL2\$ " )
58
+ if (_SDL2_INCLUDE_DIR MATCHES "(.+)/SDL2\$ " AND _SDL2_TARGET_TYPE STREQUAL STATIC_LIBRARY)
59
+ # Check if SDL2::SDL2 is aliased to SDL2::SDL2-static (will be the case for static-only builds)
60
+ get_target_property (_SDL2_ALIASED_TARGET SDL2::SDL2 ALIASED_TARGET)
61
+ if (_SDL2_ALIASED_TARGET)
62
+ set (_sdl2_target ${_SDL2_ALIASED_TARGET} )
63
+ else ()
64
+ set (_sdl2_target SDL2::SDL2)
65
+ endif ()
66
+
59
67
message (STATUS "SDL2 include dir contains \" SDL2\" subdir (SDL bug #4004) - fixing to \" ${CMAKE_MATCH_1} \" ." )
60
- set_target_properties (SDL2::SDL2 PROPERTIES
68
+ set_target_properties (${_sdl2_target} PROPERTIES
61
69
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_MATCH_1} "
62
70
)
63
71
endif ()
Original file line number Diff line number Diff line change @@ -49,7 +49,20 @@ target_link_libraries(projectMSDL
49
49
PRIVATE
50
50
libprojectM::${PROJECTM_LINKAGE}
51
51
Poco::Util
52
- SDL2::SDL2$<$<STREQUAL :" ${SDL2_LINKAGE} " , " static" >: " -static" >
52
+ SDL2::SDL2$<$<STREQUAL :${SDL2_LINKAGE} , static >: -static >
53
53
SDL2::SDL2main
54
- OpenGL::GL
55
54
)
55
+
56
+ if (MSVC )
57
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.16" )
58
+ set_target_properties (projectMSDL
59
+ PROPERTIES
60
+ VS_DPI_AWARE "PerMonitor"
61
+ )
62
+ else ()
63
+ message (AUTHOR_WARNING
64
+ "You're using a CMake version less than 3.16 with Visual Studio.\n "
65
+ "The resulting projectMSDL executable will not be DPI-aware and possibly render at a "
66
+ "lower-than-expected resolution on high-DPI displays." )
67
+ endif ()
68
+ endif ()
You can’t perform that action at this time.
0 commit comments