I have a project which is cross-compiled for a Xilinx board using Vitis and the systems that are associated with that. In order to cross compile, cmake has a cross-compilation file specified as:
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
This simply changes the name of the compiler used. Per Xilinx/Vitis’s internal machinations, the toolchain is globally configured by sourcing their bash scripts. This may be important to note because it means that I am not necessarily specifying a sysroots
path in my cmake cross-compilation file.
I would like to have an installed version of googletest
that I would be able to link to regardless of the target architecture. That is, I could have one version compiled for x86_64 and another located in /usr/local/lib
and a special version, compiled for use in the cross-compilation using the cross-compilation toolchain, located in /my/favorite/path
.
Using find_package
, how would I target one version of googletest
while cross compiling (e.g. /my/favorite/path/googletest/gtest_main.a
), and the other version while compiling for my local machine (e.g., /usr/local/lib/gtest_main.a
)?
I’ve played around with find_package(GTest PATHS ...)
, but I haven’t met with a lot of success. During the make install
portion of googletest
compilation there is a cmake
directory created which does not appear to contain path-specific information, but I’m guessing is required as part of the find_package
for GTest
.
Any suggestions would be greatly appreciated. Thanks!
4