CMake: Use a macro to get the flavour

Also include the flavour in builtin target names and include path.
This commit is contained in:
Maarten Bent
2021-06-06 22:48:27 +02:00
parent 91884752c1
commit 3e0057757b
3 changed files with 21 additions and 13 deletions

View File

@@ -81,6 +81,17 @@ macro(wx_install)
endif() endif()
endmacro() endmacro()
# Get a valid flavour name with optional prefix
macro(wx_get_flavour flavour prefix)
if(wxBUILD_FLAVOUR)
set(flav ${wxBUILD_FLAVOUR})
string(REPLACE "-" "_" flav ${flav})
set(${flavour} "${prefix}${flav}")
else()
set(${flavour})
endif()
endmacro()
# Set properties common to builtin third party libraries and wx libs # Set properties common to builtin third party libraries and wx libs
function(wx_set_common_target_properties target_name) function(wx_set_common_target_properties target_name)
cmake_parse_arguments(wxCOMMON_TARGET_PROPS "DEFAULT_WARNINGS" "" "" ${ARGN}) cmake_parse_arguments(wxCOMMON_TARGET_PROPS "DEFAULT_WARNINGS" "" "" ${ARGN})
@@ -185,11 +196,8 @@ function(wx_set_target_properties target_name is_base)
# Do not append library name for base or mono library # Do not append library name for base or mono library
set(lib_suffix "_${target_name_short}") set(lib_suffix "_${target_name_short}")
endif() endif()
if(wxBUILD_FLAVOUR) wx_get_flavour(lib_flavour "_")
set(lib_flavour "_${wxBUILD_FLAVOUR}") set(lib_suffix "${lib_flavour}${lib_suffix}")
string(REPLACE "-" "_" lib_flavour ${lib_flavour})
set(lib_suffix "${lib_flavour}${lib_suffix}")
endif()
set(dll_suffix "${lib_suffix}") set(dll_suffix "${lib_suffix}")
if(wxCOMPILER_PREFIX) if(wxCOMPILER_PREFIX)
@@ -517,14 +525,16 @@ function(wx_set_builtin_target_properties target_name)
set(lib_dbg "d") set(lib_dbg "d")
endif() endif()
wx_get_flavour(lib_flavour "_")
set(lib_version) set(lib_version)
if(NOT WIN32_MSVC_NAMING) if(NOT WIN32_MSVC_NAMING)
set(lib_version "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") set(lib_version "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}")
endif() endif()
set_target_properties(${target_name} PROPERTIES set_target_properties(${target_name} PROPERTIES
OUTPUT_NAME "${target_name}${lib_unicode}${lib_rls}${lib_version}" OUTPUT_NAME "${target_name}${lib_unicode}${lib_rls}${lib_flavour}${lib_version}"
OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_version}" OUTPUT_NAME_DEBUG "${target_name}${lib_unicode}${lib_dbg}${lib_flavour}${lib_version}"
) )
if(wxUSE_UNICODE) if(wxUSE_UNICODE)

View File

@@ -122,11 +122,8 @@ if(NOT wxBUILD_SHARED)
wx_string_append(wxBUILD_FILE_ID "-static") wx_string_append(wxBUILD_FILE_ID "-static")
endif() endif()
wx_string_append(wxBUILD_FILE_ID "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") wx_string_append(wxBUILD_FILE_ID "-${wxMAJOR_VERSION}.${wxMINOR_VERSION}")
if(wxBUILD_FLAVOUR) wx_get_flavour(lib_flavour "-")
set(lib_flavour ${wxBUILD_FLAVOUR}) wx_string_append(wxBUILD_FILE_ID "${lib_flavour}")
string(REPLACE "-" "_" lib_flavour ${lib_flavour})
wx_string_append(wxBUILD_FILE_ID "-${lib_flavour}")
endif()
set(wxARCH_SUFFIX) set(wxARCH_SUFFIX)
set(wxCOMPILER_PREFIX) set(wxCOMPILER_PREFIX)

View File

@@ -22,9 +22,10 @@ if(WIN32_MSVC_NAMING)
DESTINATION "include") DESTINATION "include")
endif() endif()
else() else()
wx_get_flavour(lib_flavour "-")
wx_install( wx_install(
DIRECTORY "${wxSOURCE_DIR}/include/wx" DIRECTORY "${wxSOURCE_DIR}/include/wx"
DESTINATION "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}") DESTINATION "include/wx-${wxMAJOR_VERSION}.${wxMINOR_VERSION}${lib_flavour}")
endif() endif()
# setup header and wx-config # setup header and wx-config