[libc-commits] [libc] c267501 - [libc] Use proper flags for compiler version detection

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Thu May 4 00:10:00 PDT 2023


Author: Guillaume Chatelet
Date: 2023-05-04T07:09:46Z
New Revision: c267501c155f933a1c0cff8630826f49c5c22864

URL: https://github.com/llvm/llvm-project/commit/c267501c155f933a1c0cff8630826f49c5c22864
DIFF: https://github.com/llvm/llvm-project/commit/c267501c155f933a1c0cff8630826f49c5c22864.diff

LOG: [libc] Use proper flags for compiler version detection

The `-v` flag means verbose and not version.
With `clang` this flag prints the version and exits successfully.
Under `GCC` this is not a valid command line so the binary exits with
an error.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCArchitectures.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index 63ec2ef7a286a..f3852e1b9e056 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -76,7 +76,7 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
   set(${sys_var} ${target_sys} PARENT_SCOPE)
 endfunction(get_arch_and_system_from_triple)
 
-execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
+execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version -v
                 RESULT_VARIABLE libc_compiler_info_result
                 OUTPUT_VARIABLE libc_compiler_info
                 ERROR_VARIABLE libc_compiler_info)


        


More information about the libc-commits mailing list