cmake-conan icon indicating copy to clipboard operation
cmake-conan copied to clipboard

ARCH is not properly detected when using cmake-conan to install GTest with 32-bit MinGW

Open tjwrona opened this issue 5 years ago • 1 comments

I am attempting to use cmake-conan to build/install GTest using MinGW 32-bit v7.30 and I get linker errors when trying to run my tests because it is assuming GTest is already installed and compiled because it detects a 64-bit instance I had previously installed.

I am calling conan_cmake_run() as follows:

conan_cmake_run(
    CONANFILE conanfile.txt
    BASIC_SETUP CMAKE_TARGETS
    BUILD missing
)

My conanfile contains a single entry for gtest:

[requires]
gtest/1.8.1@bincrafters/stable

I am trying to compile my application on both 64 and 32 bit architectures. I built it with the 64-bit MinGW first so it created a 64-bit instance of GTest in my local conan repo. Then when I compiled it with the 32-bit MinGW it thought GTest was already installed and attempted to link to the 64-bit libraries. This caused strange linker errors.

To solve it I can pass the "ARCH" parameter to conan_cmake_run with "ARCH x86" -- then everything compiles and links fine, but It really should be automatically detecting that I am using a 32-bit compiler and fetch/build the proper GTest binaries.

tjwrona avatar Apr 22 '19 01:04 tjwrona

Hi,

I have this problem too. When cross compiling (using a toolchain file for example), Conan reports the current arch as the one of the host system instead of the one of the compiler target.

Thanks for the hint regarding ARCH, but I think that conan detection should be fixed.

DexterMagnific avatar Jan 30 '20 10:01 DexterMagnific