diff options
Diffstat (limited to 'eng/native/functions.cmake')
-rw-r--r-- | eng/native/functions.cmake | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index bd96bc9c599..7824fb6a757 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -291,22 +291,35 @@ function(strip_symbols targetName outputFilename) endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS) set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) + else(CLR_CMAKE_HOST_UNIX) + set(${outputFilename} ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb PARENT_SCOPE) endif(CLR_CMAKE_HOST_UNIX) endfunction() -function(install_symbols targetName destination_path) - strip_symbols(${targetName} strip_destination_file) +function(install_with_stripped_symbols targetName kind destination) + strip_symbols(${targetName} symbol_file) + install_symbols(${symbol_file} ${destination}) + if ("${kind}" STREQUAL "TARGETS") + set(install_source ${targetName}) + elseif("${kind}" STREQUAL "PROGRAMS") + set(install_source $<TARGET_FILE:${targetName}>) + else() + message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead") + endif() + install(${kind} ${install_source} DESTINATION ${destination}) +endfunction() +function(install_symbols symbol_file destination_path) if(CLR_CMAKE_TARGET_WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION ${destination_path}/PDB) + install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB) else() - install(FILES ${strip_destination_file} DESTINATION ${destination_path}) + install(FILES ${symbol_file} DESTINATION ${destination_path}) endif() endfunction() -# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination]) +# install_clr(TARGETS TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATION destination]) function(install_clr) - set(oneValueArgs DESTINATION) + set(oneValueArgs ADDITIONAL_DESTINATION) set(multiValueArgs TARGETS) cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}") @@ -314,24 +327,29 @@ function(install_clr) message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )") endif() - if ("${INSTALL_CLR_DESTINATION}" STREQUAL "") - set(INSTALL_CLR_DESTINATION ".") + set(destinations ".") + + if (NOT "${INSTALL_CLR_ADDITIONAL_DESTINATION}" STREQUAL "") + list(APPEND destinations ${INSTALL_CLR_ADDITIONAL_DESTINATION}) endif() foreach(targetName ${INSTALL_CLR_TARGETS}) list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) - install_symbols(${targetName} ${INSTALL_CLR_DESTINATION}) - - # We don't need to install the export libraries for our DLLs - # since they won't be directly linked against. - install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION ${INSTALL_CLR_DESTINATION}) - - if(CLR_CMAKE_PGO_INSTRUMENT) - if(WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL) - endif() - endif() + strip_symbols(${targetName} symbol_file) + + foreach(destination in ${destinations}) + # We don't need to install the export libraries for our DLLs + # since they won't be directly linked against. + install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION ${destination}) + install_symbols(${symbol_file} ${destination}) + + if(CLR_CMAKE_PGO_INSTRUMENT) + if(WIN32) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL) + endif() + endif() + endforeach() endif() endforeach() endfunction() |