[Test] Invoke GetErrcMessages from config-ix instead of llvm/CMakeLists
authorJustin Bogner <mail@justinbogner.com>
Tue, 21 Feb 2023 22:28:04 +0000 (14:28 -0800)
committerJustin Bogner <mail@justinbogner.com>
Wed, 22 Feb 2023 00:06:39 +0000 (16:06 -0800)
Since GetErrcMessages uses cmake's `try_run` mechanism it's sensitive
to changes to CMAKE_CXX_FLAGS, so we move it into config-ix with the
similar flag-sensitive configuration. This makes it run before
HandleLLVMOptions and avoids issues with LLVM_ENABLE_WERROR and other
configuration that manipulate CMAKE_CXX_FLAGS.

Differential Revision: https://reviews.llvm.org/D144526

llvm/CMakeLists.txt
llvm/cmake/config-ix.cmake

index ed350c5..c993ff5 100644 (file)
@@ -975,11 +975,6 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_LIBRARY_DIR} )
 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_LIBRARY_DIR} )
 
-if(LLVM_INCLUDE_TESTS)
-  include(GetErrcMessages)
-  get_errc_messages(LLVM_LIT_ERRC_MESSAGES)
-endif()
-
 # For up-to-date instructions for installing the TFLite dependency, refer to
 # the bot setup script: https://github.com/google/ml-compiler-opt/blob/main/buildbot/buildbot_init.sh
 set(LLVM_HAVE_TFLITE "" CACHE BOOL "Use tflite")
index b78c1b3..752ca33 100644 (file)
@@ -438,6 +438,11 @@ if (CMAKE_COMPILER_IS_GNUCXX)
   endif()
 endif()
 
+if(LLVM_INCLUDE_TESTS)
+  include(GetErrcMessages)
+  get_errc_messages(LLVM_LIT_ERRC_MESSAGES)
+endif()
+
 # By default, we target the host, but this can be overridden at CMake
 # invocation time.
 include(GetHostTriple)