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
--
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