mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-28 00:00:18 +01:00
Fix multi-config builds
Hopefully, this corrects the handling of the different configs like Debug, Release, etc, when dealing with multi-config generators.
This commit is contained in:
49
cmake-proxies/cmake-modules/PrintProperties.cmake
Normal file
49
cmake-proxies/cmake-modules/PrintProperties.cmake
Normal file
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# From https://stackoverflow.com/a/51987470 but modified
|
||||
#
|
||||
function(print_properties typ tgt)
|
||||
message("Properties for ${typ} ${tgt}:")
|
||||
|
||||
# Get all propreties that cmake supports
|
||||
execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST)
|
||||
|
||||
# Convert command output into a CMake list
|
||||
STRING(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
|
||||
STRING(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
|
||||
|
||||
# Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
|
||||
list(FILTER CMAKE_PROPERTY_LIST EXCLUDE REGEX "^LOCATION$|^LOCATION_|_LOCATION$")
|
||||
|
||||
# For some reason, "TYPE" shows up twice - others might too?
|
||||
list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST)
|
||||
|
||||
# build whitelist by filtering down from CMAKE_PROPERTY_LIST in case cmake is
|
||||
# a different version, and one of our hardcoded whitelisted properties
|
||||
# doesn't exist!
|
||||
unset(CMAKE_WHITELISTED_PROPERTY_LIST)
|
||||
foreach(prop ${CMAKE_PROPERTY_LIST})
|
||||
if(prop MATCHES "^(INTERFACE|[_a-z]|IMPORTED_LIBNAME_|MAP_IMPORTED_CONFIG_)|^(COMPATIBLE_INTERFACE_(BOOL|NUMBER_MAX|NUMBER_MIN|STRING)|EXPORT_NAME|IMPORTED(_GLOBAL|_CONFIGURATIONS|_LIBNAME)?|NAME|TYPE|NO_SYSTEM_FROM_IMPORTED)$")
|
||||
list(APPEND CMAKE_WHITELISTED_PROPERTY_LIST ${prop})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(PROP_LIST ${CMAKE_PROPERTY_LIST})
|
||||
if( typ MATCHES "TARGET" )
|
||||
get_target_property(target_type ${tgt} TYPE)
|
||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
set(PROP_LIST ${CMAKE_WHITELISTED_PROPERTY_LIST})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach (prop ${PROP_LIST})
|
||||
string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" prop ${prop})
|
||||
get_property(propval ${typ} ${tgt} PROPERTY ${prop} SET)
|
||||
if (propval)
|
||||
get_property(propval ${typ} ${tgt} PROPERTY ${prop})
|
||||
if (NOT propval STREQUAL "propval-NOTFOUND")
|
||||
message (" ${prop} = ${propval}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
@@ -5,7 +5,6 @@ list( APPEND SOURCES
|
||||
PRIVATE
|
||||
${TARGET_ROOT}/compat.c
|
||||
${TARGET_ROOT}/crc.c
|
||||
$<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:${TARGET_ROOT}/debug.c>
|
||||
${TARGET_ROOT}/field.c
|
||||
${TARGET_ROOT}/file.c
|
||||
${TARGET_ROOT}/frame.c
|
||||
|
||||
@@ -27,10 +27,9 @@ list( APPEND LIBRARIES
|
||||
wxwidgets
|
||||
)
|
||||
|
||||
set_target_property_all( ${TARGET} LIBRARY_OUTPUT_DIRECTORY "${_DEST}/modules" )
|
||||
set_target_properties( ${TARGET}
|
||||
PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} "${_DEST}/modules"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${_DEST}/modules"
|
||||
PREFIX ""
|
||||
FOLDER "lib-src"
|
||||
)
|
||||
|
||||
@@ -30,10 +30,9 @@ list( APPEND LIBRARIES
|
||||
Audacity
|
||||
)
|
||||
|
||||
set_target_property_all( ${TARGET} LIBRARY_OUTPUT_DIRECTORY "${_DEST}/modules" )
|
||||
set_target_properties( ${TARGET}
|
||||
PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} "${_DEST}/modules"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${_DEST}/modules"
|
||||
PREFIX ""
|
||||
FOLDER "lib-src"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user