CMake: don't globally include wxWidgets headers

This commit is contained in:
Michael Maltese 2017-04-24 14:33:15 -07:00
parent f4c0723387
commit 6e1940c404
3 changed files with 11 additions and 7 deletions

View file

@ -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()

View file

@ -895,3 +895,4 @@ else()
message(FATAL_ERROR "wxWidgets in Externals is not compatible with your platform")
endif()
add_library(wxWidgets::wxWidgets ALIAS wx)

View file

@ -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)