[cmake-developers] CMAKE_C_COMPILER_ARG# not documented?

Robert Dailey rcdailey.lists at gmail.com
Thu Jul 19 14:25:41 EDT 2018


On Thu, Jul 19, 2018 at 1:17 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> On Thu, Jul 19, 2018 at 1:13 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
>> On Thu, Jul 19, 2018 at 1:07 PM, Brad King <brad.king at kitware.com> wrote:
>>> On 07/19/2018 11:58 AM, Robert Dailey wrote:
>>>> I can't remember where I heard about these CMake variables, but in one
>>>> of my toolchain files I do this:
>>>>
>>>> set( CMAKE_C_COMPILER_ARG1 -m32 )
>>>> set( CMAKE_CXX_COMPILER_ARG1 -m32 )
>>>
>>> They are not documented because they are internal implementation
>>> details.  Projects should not be setting them.
>>
>> I think this was recommended to me because `-m32` had to be the first
>> argument to clang. I'll try to dig up the conversation, I forgot who
>> recommended it and why.
>
> Found it:
> https://cmake.org/pipermail/cmake/2013-March/054161.html
>
> Looks like something Bill Hoffman suggested years ago. I still don't
> remember why I started using it, it was definitely to work around some
> sort of issue. What is the proper, public API solution that gives
> identical functionality? Should I be using `CMAKE_C_COMPILER` instead,
> and appending to it as a string from my toolchain file?
>
> Thanks in advance.

Looking at the docs a bit closer, it seems like this is the better solution:

set( CMAKE_C_FLAGS_INIT -m32 )
set( CMAKE_CXX_FLAGS_INIT -m32 )

Not sure if you'd agree, but at least I can verify it is working.


More information about the cmake-developers mailing list