Browse Source

CompileFeatures: Warn explicitly when feature detection binary is not found

This step is not normally expected to fail, so warn instead of logging it.
Brad King 2 years ago
parent
commit
9199449687
1 changed files with 7 additions and 4 deletions
  1. 7 4
      Modules/Internal/FeatureTesting.cmake

+ 7 - 4
Modules/Internal/FeatureTesting.cmake

@@ -39,10 +39,13 @@ macro(_record_compiler_features lang compile_flags feature_list)
     COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
     COPY_FILE_ERROR _copy_error
     )
-  if(CMAKE_${lang}_FEATURE_TEST AND NOT _copy_error)
-    set(_result 0)
-  else()
+  if(NOT CMAKE_${lang}_FEATURE_TEST)
+    set(_result 255)
+  elseif(_copy_error)
     set(_result 255)
+    message(WARNING "${_copy_error}")
+  else()
+    set(_result 0)
   endif()
   unset(CMAKE_${lang}_FEATURE_TEST CACHE)
   unset(compile_flags_for_link)
@@ -66,7 +69,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
     endif()
   else()
     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-      "Detecting ${lang} [${compile_flags}] compiler features failed to compile with the following output:\n${_output}\n${_copy_error}\n\n")
+      "Detecting ${lang} [${compile_flags}] compiler features failed to compile with the following output:\n${_output}\n\n")
   endif()
 endmacro()