CrossCompiling | Custom Compiler. What is the right way?
Backround After a long road, I got my unsupported compiler working, but for me it doesn't look right.
- First, I tried a monolithic toolchain file, but couldn't set specific settings like CMAKE_C_OUTPUT_EXTENSION, because they were overwritten later on (even with CACHE FORCE).
- So, I just used a bare toolchain file and created some custom files under share\cmake-3.14\Modules\Compiler and modified CMakePlatformId.h.in, CMakeDetermineCompilerId.cmake and CMakeCompilerIdDetection.cmake. My compiler is now recognized correctly and the tests are passed, but this depends on a special flag, which I don't need when I want to compile my target and multiple definitions leads to an error.
- I then used CMAKE_FORCE_C_COMPILER in the toolchain file. This works, but causes several deprecation warnings.
- Now, I stick with (2) and modified CMAKE_C_COMPILE_OBJECT through CMakeLists.txt.
Summary: To get my compiler working, I needed to replace CMAKE_C_COMPILE_OBJECT in CMakeLists.txt and I was forced to fork\modify CMake. In the end, my project is not really interchangable.
Questions:
- Is there a possibility to set temporary compiler flags just for passing the compiler tests?
- Is there a possibility to provide custom compiler files, which resides outside of CMake? Atm, paths like Modules\Compiler are static.
- Is there an alternative way to get my compiler working?
Edited by SJ