External project in CMake unable to locate compiler definitions

  arm64, cmake, cross-compiling, external-project, windows

I am creating a cross-compilation project for x64_arm64. For this, I use the command-line argument -AARM64 to specify the cmake_generator_platform. However, when using the same in ExternalProject_Add command is throwing errors.

As per my understanding, this is a cached variable and its value should remain same in the external project. But somehow my observations are different. Can anyone help me in understanding this?

With -AARM64 in CMAKE_ARGS for external project, following is the error in console:

CUSTOMBUILD : CMake error : Multiple -A options not allowed

Without -AARM64 in CMAKE_ARGS, following is the error in console:

  CMake Error at CMakeLists.txt:7 (project):
    No CMAKE_C_COMPILER could be found.
    
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MS
  VC/14.28.29333/bin/Hostx64/arm64/cl.exe
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MS
  VC/14.28.29333/bin/Hostx64/arm64/cl.exe - broken

I also tried to explicitly set the Compilers definition using -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} in CMAKE_ARGS, following is the error seen:

  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MS
  VC/14.28.29333/bin/Hostx64/arm64/cl.exe
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MS
  VC/14.28.29333/bin/Hostx64/arm64/cl.exe - broken

Please suggest the best way to configure the external project.

Source: Windows Questions

LEAVE A COMMENT