CMake: Apply implot fix on Windows with non-VS generators

If using CMake and Ninja or any CMake generator that isn't Visual Studio on Windows, the `-include` will be ignored and the implot fix will not be applied.
This commit is contained in:
Joshua Vandaële 2026-01-26 05:32:07 +01:00
parent c4c2aa8afd
commit e28cb4bd54
No known key found for this signature in database
GPG Key ID: 6BB95AF71EB0F406

View File

@ -22,4 +22,7 @@ target_link_libraries(implot
)
# https://github.com/epezent/implot/pull/565
target_compile_options(implot PRIVATE -include "${CMAKE_CURRENT_SOURCE_DIR}/implot_isnan_fix.h")
target_compile_options(implot PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/FI${CMAKE_CURRENT_SOURCE_DIR}/implot_isnan_fix.h>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-include ${CMAKE_CURRENT_SOURCE_DIR}/implot_isnan_fix.h>
)