From 6e1940c404eeea05c9bc1f53b7ac2bc692442dce Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Mon, 24 Apr 2017 14:33:15 -0700 Subject: [PATCH] CMake: don't globally include wxWidgets headers --- CMakeLists.txt | 15 +++++++++------ Externals/wxWidgets3/CMakeLists.txt | 1 + Source/Core/DolphinWX/CMakeLists.txt | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ab703b2c7..f4e2c302be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -796,17 +796,20 @@ if(NOT DISABLE_WX) endif() if(wxWidgets_FOUND) - include(${wxWidgets_USE_FILE}) message(STATUS "wxWidgets found, enabling GUI build") + if(NOT TARGET wxWidgets::wxWidgets) + add_library(wxWidgets::wxWidgets INTERFACE IMPORTED) + set_target_properties(wxWidgets::wxWidgets PROPERTIES + INTERFACE_LINK_LIBRARIES "${wxWidgets_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${wxWidgets_INCLUDE_DIRS}" + INTERFACE_COMPILE_DEFINITIONS "${wxWidgets_DEFINITIONS}" + INTERFACE_COMPILE_OPTIONS "${wxWidgets_CXX_FLAGS}" + ) + endif() else() message(STATUS "Using static wxWidgets from Externals") - - include_directories(SYSTEM - Externals/wxWidgets3 - Externals/wxWidgets3/include) add_subdirectory(Externals/wxWidgets3) set(wxWidgets_FOUND TRUE) - set(wxWidgets_LIBRARIES "wx") endif() endif() diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 4f93792412..30fe4f587d 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -895,3 +895,4 @@ else() message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform") endif() +add_library(wxWidgets::wxWidgets ALIAS wx) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 2cad94b5b3..2cd6792a0f 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -78,7 +78,7 @@ set(GUI_SRCS WxUtils.cpp ) -set(WXLIBS ${wxWidgets_LIBRARIES}) +set(WXLIBS wxWidgets::wxWidgets) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(WXLIBS ${WXLIBS} dl)