From d46b34e18aefa460ec1be4e1a0edad83ac68e7a6 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Fri, 24 Jan 2025 12:57:59 +0100 Subject: [PATCH] build: Fix output paths for dlls and executables on MSVC --- build-support/custom-modules/ns3-executables.cmake | 6 +++--- build-support/custom-modules/ns3-module-macros.cmake | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/build-support/custom-modules/ns3-executables.cmake b/build-support/custom-modules/ns3-executables.cmake index af80ba110..431069ea7 100644 --- a/build-support/custom-modules/ns3-executables.cmake +++ b/build-support/custom-modules/ns3-executables.cmake @@ -17,9 +17,9 @@ function(set_runtime_outputdirectory target_name output_directory target_prefix) PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_directory} RUNTIME_OUTPUT_NAME ${ns3-exec-outputname} ) - if(${XCODE}) - # Is that so hard not to break people's CI, AAPL?? Why would you output the - # targets to a Debug/Release subfolder? Why? + if(${MSVC} OR ${XCODE}) + # Prevent multi-config generators from placing output files into per + # configuration directory foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) set_target_properties( diff --git a/build-support/custom-modules/ns3-module-macros.cmake b/build-support/custom-modules/ns3-module-macros.cmake index c78ee953b..eb2f716a9 100644 --- a/build-support/custom-modules/ns3-module-macros.cmake +++ b/build-support/custom-modules/ns3-module-macros.cmake @@ -208,9 +208,12 @@ function(build_lib) PUBLIC_HEADER "${BLIB_HEADER_FILES};${BLIB_DEPRECATED_HEADER_FILES};${CMAKE_HEADER_OUTPUT_DIRECTORY}/${BLIB_LIBNAME}-module.h" PRIVATE_HEADER "${BLIB_PRIVATE_HEADER_FILES}" - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} # set output - # directory for - # DLLs + # set output directory for DLLs + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ) if(${NS3_CLANG_TIMETRACE})