summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/audio_core/CMakeLists.txt3
-rw-r--r--src/citra/CMakeLists.txt6
-rw-r--r--src/input_common/CMakeLists.txt3
4 files changed, 11 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 238e92dcc..b746554fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -171,6 +171,13 @@ if (ENABLE_SDL2)
else()
find_package(SDL2 REQUIRED)
endif()
+
+ if (SDL2_FOUND)
+ # TODO(yuriks): Make FindSDL2.cmake export an IMPORTED library instead
+ add_library(SDL2 INTERFACE)
+ target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
+ target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
+ endif()
else()
set(SDL2_FOUND NO)
endif()
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index c571213fc..ecd3025cc 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -32,7 +32,6 @@ include_directories(../../externals/soundtouch/include)
if(SDL2_FOUND)
set(SRCS ${SRCS} sdl2_sink.cpp)
set(HEADERS ${HEADERS} sdl2_sink.h)
- include_directories(${SDL2_INCLUDE_DIR})
endif()
create_directory_groups(${SRCS} ${HEADERS})
@@ -42,6 +41,6 @@ target_link_libraries(audio_core PUBLIC common core)
target_link_libraries(audio_core PRIVATE SoundTouch)
if(SDL2_FOUND)
- target_link_libraries(audio_core PRIVATE ${SDL2_LIBRARY})
+ target_link_libraries(audio_core PRIVATE SDL2)
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
endif()
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index f6f2e8e91..d72d2b5f4 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -15,15 +15,13 @@ set(HEADERS
create_directory_groups(${SRCS} ${HEADERS})
-include_directories(${SDL2_INCLUDE_DIR})
-
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra PRIVATE common core input_common)
-target_link_libraries(citra PRIVATE ${SDL2_LIBRARY} inih glad)
+target_link_libraries(citra PRIVATE inih glad)
if (MSVC)
target_link_libraries(citra PRIVATE getopt)
endif()
-target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
+target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2 Threads::Threads)
if(UNIX AND NOT APPLE)
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index 5b306e42e..e3e36ada7 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -13,7 +13,6 @@ set(HEADERS
if(SDL2_FOUND)
set(SRCS ${SRCS} sdl/sdl.cpp)
set(HEADERS ${HEADERS} sdl/sdl.h)
- include_directories(${SDL2_INCLUDE_DIR})
endif()
create_directory_groups(${SRCS} ${HEADERS})
@@ -22,6 +21,6 @@ add_library(input_common STATIC ${SRCS} ${HEADERS})
target_link_libraries(input_common PUBLIC core PRIVATE common)
if(SDL2_FOUND)
- target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY})
+ target_link_libraries(input_common PRIVATE SDL2)
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
endif()