I am new to using CMake (and fairly new to Makefiles, C, & C++ in general). I have been tasked to change our current build system to a system using CMake to generate Makefiles and compile our code. I am having difficulty deciphering the errors that CMake reports and have had no luck searching either this site or any sute for that matter. If this question has been answered elsewhere please direct me to it and I aplogize in advance.
I attempted to post an image showing the breakdown of our current file structure but I do not have the reputation points to post an image yet...
Here are the errors I am receiving upon running both cmake . & make:
*chrisk@DEVSERVER:~/633.CMake$ cmake .
xmlrole.c
xmltok.c
xmlparse.c
sysMon.cpp
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chrisk/633.CMake
chrisk@DEVSERVER:~/633.CMake$ make
[ 25%] Building C object arm/expat/CMakeFiles/expat.dir/xmlrole.c.o
[ 50%] Building C object arm/expat/CMakeFiles/expat.dir/xmltok.c.o
[ 75%] Building C object arm/expat/CMakeFiles/expat.dir/xmlparse.c.o
/home/chrisk/633.CMake/arm/expat/xmlparse.c: In function 'XML_Status
/home/chrisk/633.CMake/arm/expat/xmlparse.c: In function 'XML_Status XML_Parse(XML_ParserStruct*, const char*, int, int)':
/home/chrisk/633.CMake/arm/expat/xmlparse.c:1488:14: warning: enumeration value 'XML_FINISHED' not handled in switch
Linking C static library libexpat.a
[ 75%] Built target expat
[100%] Building CXX object arm/services/CMakeFiles/services.dir/sysMon.cpp.o
In file included from /home/projects/OMAP-L137/timesys/factory-current/build_armv5l- timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink- 1_65_01/dsplink/gpp/inc/usr/dsplink.h:52:0,
from /home/chrisk/633.CMake/dsp/included/flagIOBuffer.h:4,
from /home/chrisk/633.CMake/arm/framework/memoryManagerBase.h:4,
from /home/chrisk/633.CMake/arm/framework/memoryManager.h:4,
from /home/chrisk/633.CMake/arm/services/sysMon.cpp:9:
/home/projects/OMAP-L137/timesys/factory-current/build_armv5l-timesys-linux- uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr/linkcfgdefs.h:824:37: error: 'MAX_DSPS' was not declared in this scope
In file included from /home/chrisk/633.CMake/arm/services/sysMon.cpp:16:0:
/home/chrisk/633.CMake/arm/logging/logger.h:43:17: note: the mangling of 'va_list' has changed in GCC 4.4
make[2]: *** [arm/services/CMakeFiles/services.dir/sysMon.cpp.o] Error 1
make[1]: *** [arm/services/CMakeFiles/services.dir/all] Error 2
make: *** [all] Error 2
chrisk@DEVSERVER:~/633.CMake$
Here is the CMakeLists.txt in the project source directory:
*INCLUDE(CMakeForceCompiler)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(633.CMake)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
SET(FACTORY_CURRENT /home/projects/OMAP-L137/timesys/factory-current)
SET(TOOLCHAIN_LOC ${FACTORY_CURRENT}/build_armv5l-timesys-linux- uclibcgnueabi/toolchain/bin)
specify the cross compiler
SET(CMAKE_C_COMPILER ${TOOLCHAIN_LOC}/armv5l-timesys-linux-uclibcgnueabi-g++)
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_LOC}/armv5l-timesys-linux-uclibcgnueabi-g++)
SET(CMAKE_C_FLAGS "-Wall -c")
SET(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
where is the target environment
SET(CMAKE_FIND_ROOT_PATH /home/projects/OMAP-L137/timesys/factory-current)
SET(PROJECT_SOURCE_DIR /home/chrisk/633.CMake/)
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)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
ADD_SUBDIRECTORY(arm)*
Here is the CMakeLists.txt in the directory 633.CMake/arm/expat
*ADD_SUBDIRECTORY(expat)
ADD_SUBDIRECTORY(services)
*
Here is the CMakeLists.txt in the directory 633.CMake/arm/expat* (this creates the library libexpat.a as it should) and the file expatfiles.txt just lists the source files that are needed for expat (same thing applies to the services CMakeLists.txt:
*FILE(READ "expatfiles.txt" contents)
STRING(REGEX REPLACE "\n" ";" contents "${contents}")
foreach(expatfile ${contents})
message("${expatfile}")
endforeach()
ADD_LIBRARY(expat ${contents})*
Here is the CMakeLists.txt in the directory 633.CMake/arm/services*
*INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/arm/framework ${CMAKE_SOURCE_DIR}/arm/io_master ${CMAKE_SOURCE_DIR}/arm/flagDictionary
${CMAKE_SOURCE_DIR}/arm/logging ${CMAKE_SOURCE_DIR}/dsp/included ${CMAKE_SOURCE_DIR}/dsp/mb)
INCLUDE_DIRECTORIES(${FACTORY_CURRENT}/build_armv5l-timesys-linux- uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(/home/projects/OMAP-L137/timesys/factory-20120925-633/build_armv5l- timesys-linux-uclibcgnueabi/DSPLink-1_65_01/DSPLink-1_65_01/dsplink/gpp/inc/usr)
INCLUDE_DIRECTORIES(/home/projects/OMAP- L137/SDK/OMAPL137_arm_1_00_00_11/dsplink_linux_1_65_00_03/dsplink/gpp/src/inc/sys/Linux)
FILE(READ "servicesfiles.txt" contents)
STRING(REGEX REPLACE "\n" ";" contents "${contents}")
foreach(servicesfiles ${contents})
message("${servicesfiles}")
endforeach()
ADD_LIBRARY(services ${contents}
This particular error is not due to CMake. Instead see the line:
The problem is the missing symbol
MAX_DSPS
. Do a recursive grep in the source tree, and look where thisMAX_DSPS
is supposed to come from. It is likely that it is a Macro (or global variable) defined in a header file, which you are failing to include, or it maybe a macro which you need to supply at compile time via your CMakeLists.txt file (see documentation for: add_definitions on how to do it in CMake)