Skip to content

Commit ed27df5

Browse files
authoredFeb 10, 2025
Replace forward slashes by backslashes in BMI path for MSVC. (fmtlib#4344)
* Fix slashes in BMI path for MSVC builds * Fix BMI path for MSVC builds when building with Ninja generator
1 parent d42a068 commit ed27df5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ endfunction()
2727
# DEPRECATED! Should be merged into add_module_library.
2828
function(enable_module target)
2929
if (MSVC)
30-
set(BMI ${CMAKE_CURRENT_BINARY_DIR}/${target}.ifc)
30+
if(CMAKE_GENERATOR STREQUAL "Ninja")
31+
# Ninja dyndep expects the .ifc output to be located in a specific relative path
32+
file(RELATIVE_PATH BMI_DIR "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir")
33+
else()
34+
set(BMI_DIR "${CMAKE_CURRENT_BINARY_DIR}")
35+
endif()
36+
file(TO_NATIVE_PATH "${BMI_DIR}/${target}.ifc" BMI)
3137
target_compile_options(${target}
3238
PRIVATE /interface /ifcOutput ${BMI}
3339
INTERFACE /reference fmt=${BMI})

0 commit comments

Comments
 (0)
Please sign in to comment.