Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to partially disabling cmake C/C++ custom compiler checking

I am trying to do some crosscompilation using cmake. Some are easy with all the examples on Internet, I managed to crosscompile my library on Linux (x86 and ARM), Windows and Android. But now I would like to do it on a custom platform.

The process I need to achieve:

  1. Sourcing my environment (this destroy all previous bash classic environment)
  2. Compile with cmake
  3. Execute what I want

But Cmake is testing for symbols in my custom C/C++ libraries which make my library unable to compile. The errors I have are that cmake some versions of GLIBCXX and CXXABI (no C issues) but not all of them.

Is there a way to make cmake ok with it ?

EDIT:

I tried using:

set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)

And with:

include(CMakeForceCompiler)
...
cmake_force_c_compiler(${ENV_PATH}/bin/${CC})
cmake_force_cxx_compiler(${ENV_PATH}/bin/${CXX})

But cmake is still checking for symbols.

like image 374
baptiste Avatar asked Oct 29 '25 05:10

baptiste


1 Answers

Commandline:

    cmake ... \
    -DCMAKE_C_COMPILER_FORCED=TRUE \
    -DCMAKE_CXX_COMPILER_FORCED=TRUE

or

CMakeLists.txt

    ...
    set(CMAKE_C_COMPILER_FORCED TRUE)
    set(CMAKE_CXX_COMPILER_FORCED TRUE)
    ...

Works for me.

like image 193
Clemens1509 Avatar answered Oct 30 '25 21:10

Clemens1509



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!