CMake: modern-ize wxWidgets

This commit is contained in:
Michael Maltese 2017-04-25 09:37:11 -07:00
parent f7892faa80
commit 8e7648f42a
1 changed files with 26 additions and 35 deletions

View File

@ -818,23 +818,20 @@ set(SRCS_UNIXGTK
"src/unix/uiactionx11.cpp"
"src/unix/utilsx11.cpp")
include_directories(.)
include_directories(include)
set(SRCS
${SRCS_AUI}
${SRCS_COMMON}
${SRCS_GENERIC})
add_library(wx STATIC ${SRCS_AUI} ${SRCS_COMMON} ${SRCS_GENERIC})
target_include_directories(wx PUBLIC . include)
target_compile_definitions(wx PRIVATE "WXBUILDING")
# wxWidgets warnings are not our problem.
target_compile_options(wx PRIVATE "-w")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
add_definitions(-D__WXOSX_COCOA__)
set(SRCS
${SRCS}
target_compile_definitions(wx PRIVATE "__WXOSX_COCOA__")
target_sources(wx PRIVATE
${SRCS_GENERICOSX}
${SRCS_OSX}
${SRCS_UNIX})
set(LIBS
${SRCS_UNIX}
)
target_link_libraries(wx PRIVATE
png
iconv
${APPKIT_LIBRARY}
@ -847,23 +844,23 @@ if(APPLE)
${OPENGL_LIBRARY}
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_definitions(-D__LINUX__=1)
target_compile_options(wx PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_compile_definitions(wx PRIVATE "__LINUX__=1")
else()
add_definitions(-D__BSD__=1)
target_compile_definitions(wx PRIVATE "__BSD__=1")
endif()
add_definitions(-D__WXGTK__)
set(SRCS
${SRCS}
target_compile_definitions(wx PRIVATE "__WXGTK__")
target_sources(wx PRIVATE
${SRCS_GENERICGTK}
${SRCS_GTK}
${SRCS_UNIX}
${SRCS_UNIXGTK})
${SRCS_UNIXGTK}
)
if (NOT X11_xf86vmode_FOUND OR NOT X11_Xinerama_FOUND)
message(FATAL_ERROR "wxGTK2 needs Xinerama and Xxf86vm")
endif()
set(LIBS
target_link_libraries(wx PRIVATE
png
${GTHREAD2_LIBRARIES}
${PANGOCAIRO_LIBRARIES}
@ -871,25 +868,19 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
${Backtrace_LIBRARY}
${X11_X11_LIB}
${X11_Xxf86vm_LIB}
${X11_Xinerama_LIB})
${X11_Xinerama_LIB}
)
else()
add_definitions(-D__WXMSW__)
add_definitions(-DNOPCH)
remove_definitions(-DWIN32_LEAN_AND_MEAN)
set(SRCS
${SRCS}
target_compile_definitions(wx PRIVATE "__WXMSW__" "NOPCH")
target_sources(wx PRIVATE
${SRCS_GENERICMSW}
${SRCS_MSW})
set(LIBS
${SRCS_MSW}
)
target_link_libraries(wx PRIVATE
Comctl32.lib
Rpcrt4.lib
${OPENGL_LIBRARIES}
)
endif()
add_definitions(-DWXBUILDING)
# wxWidgets warnings are not our problem.
add_definitions(-w)
add_library(wx STATIC ${PNG_SRCS} ${SRCS})
target_link_libraries(wx ${LIBS})