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 6, 2025
1 parent fc653df commit 8d0b319
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ 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")
file(RELATIVE_PATH FMT_REL_BIN_DIR ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
if (FMT_REL_BIN_DIR)
set(FMT_REL_BIN_DIR ${FMT_REL_BIN_DIR}/)
endif()
file(TO_NATIVE_PATH "${FMT_REL_BIN_DIR}CMakeFiles/fmt.dir/${target}.ifc" BMI)
else()
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${target}.ifc" BMI)
endif()
target_compile_options(${target}
PRIVATE /interface /ifcOutput ${BMI}
INTERFACE /reference fmt=${BMI})
Expand Down

0 comments on commit 8d0b319

Please sign in to comment.