[CMake] how to build two libraries from same sources but with different defines?

Igor Karatayev igor.cwer at gmail.com
Mon Apr 27 06:05:52 EDT 2009


On Fri, Apr 24, 2009 at 8:07 PM, Richard Quirk <richard.quirk at gmail.com> wrote:
> On Fri, Apr 24, 2009 at 5:42 PM, Igor Karatayev <igor.cwer at gmail.com> wrote:
>> Hello.
>>
>> I am building my library for two different processors arm7 and arm9.
>> devkitArm requeres ARM7 or ARM9 macroses should be defined when
>> building for any processor. I tried to write
>>
>> include_directories(./)
>>
>> set(SOURCES
>>    src/library.cpp
>>    )
>>
>>    add_definitions(-DARM7)
>>    add_library(sandbox-arm7 ${SOURCES})
>>    remove_definitions(-DARM7)
>>    add_definitions(-DARM9)
>>    add_library(sandbox-arm9 ${SOURCES})
>>    remove_definitions(-DARM9)
>>
>> but it does not work as expected.
>
> If you can, use the latest devkitArm (r25), which ships with a decent
> default arm7 core - this lets you code just for the arm9 and it
> simplifies a lot of the effort. If that's not possible, then Denis's
> suggestion works a treat. I blogged a while ago on coding for the
> Nintendo DS and using CMake, some ideas may help you out:
>
> http://quirkygba.blogspot.com/2008/09/alternatives-to-make-part-1.html
I read your post to make my own toolchain file, before asking here. It
really helps me. Great work.


More information about the CMake mailing list