File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -496,19 +496,29 @@ if (NOT "${CMAKE_REQUIRED_INCLUDES}" STREQUAL "")
496496endif ()
497497foreach (file ${PyPartMC_headers} )
498498 set (CMAKE_REQUIRED_INCLUDES "${PYPARTMC_INCLUDE_DIRS} ;${pybind11_INCLUDE_DIRS} " )
499+ set (CMAKE_REQUIRED_FLAGS "-Werror" )
500+ string (REGEX REPLACE "[\- ./:]" "_" file_var ${file} )
499501 check_cxx_source_compiles("
500502 // https://github.com/nlohmann/json/issues/1408
501- #define HAVE_SNPRINTF
503+ #if defined(_WIN32) || defined(_WIN64)
504+ # define HAVE_SNPRINTF
505+ #endif
502506 #include \" ${file} \"
503507 int main() { return 0;}
504508 "
505- _header_self_contained_${file }
509+ _header_self_contained_${file_var }
506510 )
507511 unset (CMAKE_REQUIRED_INCLUDES)
508- if (NOT _header_self_contained_${file} )
512+ unset (CMAKE_REQUIRED_FLAGS)
513+ if (NOT _header_self_contained_${file_var} )
509514 message (SEND_ERROR "non-self-contained header: ${file} " )
510- file (READ "${CMAKE_BINARY_DIR} /CMakeFiles/CMakeError.log" tmp)
515+ if (${CMAKE_VERSION} VERSION_LESS "3.26.0" )
516+ file (READ "${CMAKE_BINARY_DIR} /CMakeFiles/CMakeError.log" tmp)
517+ else ()
518+ file (READ "${CMAKE_BINARY_DIR} /CMakeFiles/CMakeConfigureLog.yaml" tmp)
519+ endif ()
511520 message (FATAL_ERROR ${tmp} )
512521 endif ()
522+ unset (file_var)
513523endforeach ()
514524
You can’t perform that action at this time.
0 commit comments