From 4196c67b7203b006fb3a364d475b09486f9beb52 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 16 Feb 2020 15:23:03 +0100 Subject: [PATCH] CMake: Create wx-config for MinGW builds Use the same output folder for setup.h and wx-config as configure does. --- build/cmake/init.cmake | 12 ++++-------- build/cmake/install.cmake | 22 ++++++++++------------ build/cmake/main.cmake | 2 +- build/cmake/utils/CMakeLists.txt | 10 +++++----- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index f57863deb2..41c6d414e1 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -140,19 +140,15 @@ else() set(wxCOMPILER_PREFIX) endif() -if(MSVC OR MINGW) +if(MSVC) if(wxBUILD_SHARED) set(lib_suffix "dll") else() set(lib_suffix "lib") endif() - if(MSVC) - # Include generator expression to suppress default Debug/Release pair - set(wxPLATFORM_LIB_DIR "$<1:/>${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}") - else() - set(wxPLATFORM_LIB_DIR "/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}") - endif() + # Include generator expression to suppress default Debug/Release pair + set(wxPLATFORM_LIB_DIR "$<1:/>${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_${lib_suffix}") else() set(wxPLATFORM_LIB_DIR) endif() @@ -164,7 +160,7 @@ if(wxBUILD_CUSTOM_SETUP_HEADER_PATH) set(wxSETUP_HEADER_PATH ${wxBUILD_CUSTOM_SETUP_HEADER_PATH}) else() # Set path where setup.h will be created - if(MSVC OR MINGW) + if(MSVC) if(wxUSE_UNICODE) set(lib_unicode u) else() diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake index 5e30a933f2..968dff859e 100644 --- a/build/cmake/install.cmake +++ b/build/cmake/install.cmake @@ -12,27 +12,25 @@ if(NOT wxBUILD_INSTALL) endif() install(CODE "message(STATUS \"Installing: Headers...\")") -if(UNIX) - wx_install( - DIRECTORY "${wxSOURCE_DIR}/include/wx" - DESTINATION "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") -else() +if(MSVC) wx_install( DIRECTORY "${wxSOURCE_DIR}/include/wx" DESTINATION "include") - if(MSVC) - wx_install( - DIRECTORY "${wxSOURCE_DIR}/include/msvc" - DESTINATION "include") - endif() + wx_install( + DIRECTORY "${wxSOURCE_DIR}/include/msvc" + DESTINATION "include") +else() + wx_install( + DIRECTORY "${wxSOURCE_DIR}/include/wx" + DESTINATION "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") endif() # setup header and wx-config -if(MSVC OR MINGW) +if(MSVC) wx_install( DIRECTORY "${wxSETUP_HEADER_PATH}" DESTINATION "lib${wxPLATFORM_LIB_DIR}") -elseif(UNIX) +else() wx_install( DIRECTORY "${wxSETUP_HEADER_PATH}" DESTINATION "lib/wx/include") diff --git a/build/cmake/main.cmake b/build/cmake/main.cmake index ca761d8464..c038bbb387 100644 --- a/build/cmake/main.cmake +++ b/build/cmake/main.cmake @@ -37,7 +37,7 @@ if(NOT wxBUILD_CUSTOM_SETUP_HEADER_PATH) include(build/cmake/setup.cmake) endif() -if(UNIX) +if(NOT MSVC) # Write wx-config include(build/cmake/config.cmake) endif() diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index 21acfa3dfe..a47d615e12 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -21,17 +21,17 @@ if(wxUSE_XRC) set_target_properties(wxrc PROPERTIES FOLDER "Utilities") wx_install(TARGETS wxrc RUNTIME DESTINATION "bin") - if(UNIX) + if(NOT MSVC) install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E rename \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION} \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc${CMAKE_EXECUTABLE_SUFFIX} \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${CMAKE_EXECUTABLE_SUFFIX} \ )" ) install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E create_symlink \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION} \ - ${CMAKE_INSTALL_PREFIX}/bin/wxrc \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${CMAKE_EXECUTABLE_SUFFIX} \ + ${CMAKE_INSTALL_PREFIX}/bin/wxrc${CMAKE_EXECUTABLE_SUFFIX} \ )" ) endif()