[CMake] cmake + ninja + CMAKE_TOOLCHAIN_FILE fails
Guilherme
guibufolo at gmail.com
Tue Oct 16 03:47:11 EDT 2012
Hi!
When using 'cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/m3.cmake' with
the makefile generator this works prefectly but when using it with
'cmake -GNinja .. -DCMAKE_TOOLCHAIN_FILE=../cmake/m3.cmake' it fails
with the following message:
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/m3.cmake ../
-- The C compiler identification is GNU 4.6.3
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- broken
CMake Error at
/usr/local/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61
(message):
The C compiler "/srv/scratch/ARM_EABI/bin/arm-none-eabi-gcc" is not
able to
compile a simple test program.
It fails with the following output:
Change Dir: /srv/scratch/sigubufo/m3bare/ninja/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/ninja cmTryCompileExec1450194663
[1/2] Building C object
CMakeFiles/cmTryCompileExec1450194663.dir/testCCompiler.c.o
[2/2] Linking C executable cmTryCompileExec1450194663
FAILED: : && /srv/scratch/ARM_EABI/bin/arm-none-eabi-gcc
CMakeFiles/cmTryCompileExec1450194663.dir/testCCompiler.c.o -o
cmTryCompileExec1450194663 -rdynamic && :
arm-none-eabi-gcc: error: unrecognized option '-rdynamic'
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:5 (Project)
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module
file:/srv/scratch/sigubufo/m3bare/ninja/CMakeFiles/2.8.9.20120918-g56154/CMakeCXXCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
This is the m3.cmake file:
set(CMAKE_SYSTEM_NAME Generic)
set(COMPILER_PREFIX "arm-none-eabi-")
set(LAUTERBACH_EXE "t32marm")
set(COMMON_FLAGS "-ffunction-sections -fdata-sections -fno-builtin
-fno-unwind-tables -Wall -Wpointer-arith -Wundef -Wno-write-strings
-mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -ffunction-sections
-fdata-sections ")
set(CMAKE_C_FLAGS " ${COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -ffunction-sections
-fdata-sections -fno-builtin -fno-rtti -fno-exceptions
-fno-unwind-tables -Woverloaded-virtual" )
add_definitions("${COMMON_FLAGS}")
find_program(ELFSIZE "${COMPILER_PREFIX}size")
find_program(OBJCOPY "${COMPILER_PREFIX}objcopy")
find_program(MKIMAGE "mkimage")
# Set C/C++ Compiler and binutils
set(CMAKE_C_COMPILER ${COMPILER_PREFIX}gcc)
set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}g++)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
I already posted this in the ninja mailing list and they told me to come
here.
More information about the CMake
mailing list