[CMake] Toolchain with non-gcc argument format
oliver.zabel at egoproducts.com
oliver.zabel at egoproducts.com
Wed Nov 8 09:54:42 EST 2017
Hi,
i have some modules which i want to cross-compile for different platforms
which uses different compilers. One of them for example is the arm-gcc
compiler which works over the toolchain file.
Now i have a Renesas RX compiler which uses for example instead of "-I"
for include paths the argument "-include=". So using this toolchain fails
because cmake trys to use gcc arguments.
I managed to compile my modules with the following approache:
set(CMAKE_C_COMPILER_WORKS 1)
project(MyModule C)
cmake_minimum_required(VERSION 3.0)
set(EXECUTABLE_NAME MyModule)
set(SRC_FILES
${PROJECT_SOURCE_DIR}/module.c
${PROJECT_SOURCE_DIR}/main.c
)
IF(RXCOMPILER)
MESSAGE(STATUS "RX Mode")
add_custom_target(dummy_target ALL DEPENDS EXECUTABLE_NAME)
ADD_CUSTOM_COMMAND(
OUTPUT EXECUTABLE_NAME
COMMAND ${CMAKE_C_COMPILER}
ARGS -output=obj=abs -cpu=rx200 -lang=c99 -goptimize -size
${SRC_FILES}
COMMENT "RX Compiler"
)
ELSE(RXCOMPILER)
add_executable(EXECUTABLE_NAME ${SRC_FILES})
ENDIF(RXCOMPILER)
Is there a better way of doing this? For example telling cmake to use
"-include=" instaed of "-I"?
Thanks for your help!
Best regards,
oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171108/d24ae0c2/attachment.html>
More information about the CMake
mailing list