diff --git a/CMakeLists.txt b/CMakeLists.txt index 8df6670d..00c05908 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,13 @@ endfunction() # DEPRECATED! Should be merged into add_module_library. function(enable_module target) if (MSVC) - set(BMI ${CMAKE_CURRENT_BINARY_DIR}/${target}.ifc) + 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})