Hi,

this is a nasty problem, preventing suitable compiler detection.
I can confirm it with older versions of CMake, e.g. 3.2.x. Did not recognize it 
has been fixed in the meanwhile.
If anyone has a suitable solution or patched CMake version, I could help 
testing it.

Regards,
Falk

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Thibault Genessay
Sent: Dienstag, 9. Februar 2016 15:10
To: cmake@cmake.org
Subject: [CMake] Toolchains and CMAKE_FORCE_C_COMPILER in 3.5

Hi,

I'm a long time user of CMake (and huge fan of it) but newly registered on this 
list, so please forgive me if I have missed something regarding the new 3.5 
series.
I use CMake with the GCC ARM Embedded compiler 
(https://launchpad.net/gcc-arm-embedded<https://urldefense.proofpoint.com/v2/url?u=https-3A__launchpad.net_gcc-2Darm-2Dembedded&d=CwMFaQ&c=VCWpAYkS3z1bOCIxc-BPGZarCq9MRCAVxZJE051VqH8&r=Ee2S2RR_IcVA2riuzsDuYo9W0-YuR65ZmnX9oJ70u5c&m=Ly4Lf_QNoPZw7NLyJgPtadlPnK3hYtbHWzoTFvG3t2k&s=YFTH4j_hy43hY-cPXn1-edRIyxes7EcC5rXO6mAT-Eo&e=>)
 to cross-compile my project (Windows host, STM32 target, MinGW binutils). Like 
many users (all?) I had to create a toolchain file because CMake doesn't 
support this compiler/setup out of the box. I have taken inspiration from the 
many Google hits and had a working setup until 3.5. This setup relied on the 
CMAKE_FORCE_<lang>_COMPILER macros.
I installed 3.5 and the build broke, CMake complaining that this macro was 
deprecated and should not be used because of the many improvements on the 
compiler detection side. OK, so I removed the offending lines, simply setting 
the CMAKE_C_COMPILER variable to the compiler's executable ... and suddenly I 
remember why I did use this FORCE hack in the first place: CMake tells me my 
compiler is broken because it cannot compile a test program (undefined symbol: 
_exit). This is somehow correct, as I compile for bare metal and I am providing 
the _exit function in my code. This is a misunderstanding the 
CMAKE_FORCE_C_COMPILER works around by simply saying "believe me, this compiler 
works".
Now I am left without many options: I can't use the FORCE hack, and I can't 
convince CMake my compiler is OK. I am very open to redesign my toolchain file, 
or use a stock one from CMake, or whatever this takes, but I simply do not know 
how to proceed. Actually, I feel my current toolchain file, although 
functional, is not "clean" but never had enough time to do it. Now that it's a 
blocking issue, I do have time :)
I rolled back to 3.4 and things work so I'm safe for now. But I would be very 
glad if somebody knew more about this specific problem, or this compiler, or 
toolchain file writing in general. I would love to write a "stock" toolchain 
file for this compiler but I simply do not know enough (nor I can find enough 
up-to-date documentation).
Thanks for reading,
Cheers
Thibault



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to