Skip to content

Commit

Permalink
Fix Ninja Multi-Config Cross-Config support
Browse files Browse the repository at this point in the history
The default output directory was the same for all `$<CONFIG>`s,
which caused conflicting build rules.
The issue probably still exists for the rare case when:
1. The user specified an `OUTPUT_DIRECTORY` property AND
2. did not specify an `OUTPUT_DIRECTORY_$<CONFIG>` property AND
3. The value of the `OUTPUT_DIRECTORY` does not contain a genex,
  depending on the `$<CONFIG>`.

Corrosion could detect and append a `$<CONFIG>` in this case, but
I think leaving this up to the user is reasonable for now.
  • Loading branch information
jschwe committed Mar 6, 2024
1 parent 74fb8cc commit b01a6d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/Corrosion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function(_corrosion_set_imported_location_deferred target_name base_property out
elseif(output_directory)
set(curr_out_dir "${output_directory}")
else()
set(curr_out_dir "${CMAKE_CURRENT_BINARY_DIR}")
set(curr_out_dir "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
endif()
string(REPLACE "\$<CONFIG>" "${config_type}" curr_out_dir "${curr_out_dir}")
message(DEBUG "Setting ${base_property}_${config_type_upper} for target ${target_name}"
Expand Down Expand Up @@ -233,7 +233,7 @@ function(_corrosion_copy_byproduct_deferred target_name output_dir_prop_names ca
# Fallback to the default directory. We do not append the configuration directory here
# and instead let CMake do this, since otherwise the resolving of dynamic library
# imported paths may fail.
set(curr_out_dir "${CMAKE_CURRENT_BINARY_DIR}")
set(curr_out_dir "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
endif()
set(multiconfig_out_dir_genex "${multiconfig_out_dir_genex}$<$<CONFIG:${config_type}>:${curr_out_dir}>")
endforeach()
Expand Down

0 comments on commit b01a6d3

Please sign in to comment.