[CMake] Assembler and C++ for the same target

Stefan Weber stefan.weber at gmail.com
Thu Sep 25 18:00:35 EDT 2008


I just spotted yet another issue that might influence the solution:

Note the capital S in the file extension of the ASM file. It seems this is
crucial: when I rename to a small s and manually pass it to g++ it does not
work anymore. When I leave the cap S, it works. Looking a bit deeper shows
that the ASM file has preprocessor macros in it, so it needs to go through
g++ (and obviously g++ only looks at it if the S is capital)... now I'm
totally confused...

On Thu, Sep 25, 2008 at 11:50 PM, Stefan Weber <stefan.weber at gmail.com>wrote:

>
> > Ideally, I would like to pass it to
>> > add_library with all the other source files (in the same way I can pass
>> it
>> > to C++ which automatically forwards it to the assembler). This is not
>> > working,
>>
>> Stop. The next step is no logical one. If it doesn't work for one target,
>> why
>> Should it for another?
>
>
> I think I was not clear enough here: it is not working when I combine ASM
> source files and CXX source files and as I found out by now, this is
> probably not supported anways. (Mixing ASM and C++ source files would be the
> ideal scenario because I can do it with g++ directly, too)
>
>
>> > cmake_minimum_required(VERSION 2.6)
>>  > project(TEST)
>> > enable_language(ASM)
>> > add_library(asmtest MyAsm.S)
>>
>> That looks fine. And just adding the assembler file works here. Are you
>> cross-compiling? If yes, did you define CMAKE_ASM_COMPILER?
>
>
> No, I'm compiling on the target platform itself.
>
> What is the compilation output? (make VERBOSE=1)
>> Does that file actually appear there?
>
>
> Thanks for the hint, your guess was right, the file does NOT appear there.
> My conclusion is that add_library does not look for the right extension,
> could that be it? I tried to do:
>
> set(${CMAKE_ASM_SOURCE_FILE_EXTENSIONS} "s;S")
>
> but this does not help. To debug this, I do the following on the next line
>
> message("${CMAKE_ASM_SOURCE_FILE_EXTENSIONS}")
>
> Strangly, this does not print anything, just an empty line. Why is that?
> Simliarly, I cannot change CMAKE_ASM_COMPILER. When I echo it, it returns
> /usr/bin/as correctly but for a little test, I set it to /usr/bin/c++.
> However, when I echo it after the resetting it, the value is still the
> original one: /usr/bin/as. So it seems that I somehow cannot define the
> variables for ASM mode. Could that be the root of the problem?
>
> Any ideas for a workaround? At this point, I'm desperate enough to accept
> any hack...
>
> Thanks,
>
> Stefan
>
>
>>
>>
>> HS
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080926/03e94631/attachment.htm>


More information about the CMake mailing list