Skip to content

Commit

Permalink
Fix BMI path for MSVC builds when building with Ninja generator
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhyn committed Feb 8, 2025
1 parent fc653df commit fec5a1c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ endfunction()
# DEPRECATED! Should be merged into add_module_library.
function(enable_module target)
if (MSVC)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${target}.ifc" BMI)
if(CMAKE_GENERATOR STREQUAL "Ninja")
# Ninja dyndep expects the .ifc output to be located in a specific relative path
file(RELATIVE_PATH BMI_DIR "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir")
else()
set(BMI_DIR "${CMAKE_CURRENT_BINARY_DIR}")
endif()
file(TO_NATIVE_PATH "${BMI_DIR}/${target}.ifc" BMI)
target_compile_options(${target}
PRIVATE /interface /ifcOutput ${BMI}
INTERFACE /reference fmt=${BMI})
Expand Down

0 comments on commit fec5a1c

Please sign in to comment.