From a2ceb762abd9d7c1e483386e36cc7d3d7e5fbd06 Mon Sep 17 00:00:00 2001 From: fleroviux Date: Tue, 3 Oct 2023 13:14:54 +0200 Subject: [PATCH] Remove remaining instance of find_package(SDL2 REQUIRED) --- CMakeLists.txt | 6 ++++++ src/dual/CMakeLists.txt | 5 +++-- src/platform/sdl/CMakeLists.txt | 9 --------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c48fa8..ef54adc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,12 @@ project(dual CXX) option(PLATFORM_SDL "Build SDL frontend" ON) +find_package(PkgConfig REQUIRED) +option(BUILD_STATIC "Build a statically linked executable" OFF) +if(BUILD_STATIC) + list(APPEND PKG_CONFIG_EXECUTABLE "--static") +endif() + add_subdirectory(external) add_subdirectory(src/dual) diff --git a/src/dual/CMakeLists.txt b/src/dual/CMakeLists.txt index 637b07f..1af2821 100644 --- a/src/dual/CMakeLists.txt +++ b/src/dual/CMakeLists.txt @@ -103,5 +103,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() # @todo: remove this when properly implementing key input -find_package(SDL2 REQUIRED) -target_link_libraries(dual PRIVATE SDL2::SDL2) \ No newline at end of file +find_package(PkgConfig REQUIRED) +pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2) +target_link_libraries(dual PRIVATE PkgConfig::SDL2) \ No newline at end of file diff --git a/src/platform/sdl/CMakeLists.txt b/src/platform/sdl/CMakeLists.txt index e98e9c7..f89a74f 100644 --- a/src/platform/sdl/CMakeLists.txt +++ b/src/platform/sdl/CMakeLists.txt @@ -20,17 +20,8 @@ set(HEADERS ) find_package(PkgConfig REQUIRED) - -option(BUILD_STATIC "Build a statically linked executable" OFF) - -if(BUILD_STATIC) - list(APPEND PKG_CONFIG_EXECUTABLE "--static") -endif() - pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2) -#find_package(SDL2 REQUIRED) - add_executable(dual-sdl ${SOURCES} ${HEADERS}) target_include_directories(dual-sdl PRIVATE src) target_link_libraries(dual-sdl PRIVATE dual PkgConfig::SDL2) \ No newline at end of file