Hi,
I'm working on cross-compiling llvm and sub-projects to dynamically build Clang toolchain and associated libraries for an embedded project.
I'm starting with this mailing list, as I see the pattern using "config-ix.cmake" a common one; it's found in all the sub-projects.
For those that are not aware, in CMake the standard approach for dealing with unique toolchains, system roots, etc is through the use of a CMAKE_TOOLCHAIN_FILE variable. This toolchain file is used to define the compiler, system type, architecture, sysroot, etc. It enables a simpler, and more versatile build script.
With tip of the tree on llvm and sub-projects now, when I use a toolchain file, I'm finding I have to make edits to the config-ix.cmake files. The issue is related to re-defining CMAKE_SYSROOT and the use of; among others:
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
When this flag is used in stand-alone cross-compiled builds (using toolchain file to set the CMAKE_SYSROOT), it causes all the subsequent flag checks to fail.
I think leveraging an implied CMake toolchain file for sub-projects should be the preferred solution for "projects", and it's a fairly minor change to accommodate.