[CMake] need two compilation to achieve success

eial at cs.bgu.ac.il eial at cs.bgu.ac.il
Wed Jun 3 15:20:41 EDT 2009


On Wed 03 Jun 22:14 2009 Bill Hoffman wrote:
> eial at cs.bgu.ac.il wrote:
> 
> > I've just noticed the suggestion to remove the lib from the
> > TARGET_LINK_LIBRARIES entry which I did, that solved the previous
> > linking problem but now I get unknown reference to each function or
> > var that I use from the external libs. how can I add them without
> > adding them to TARGET_LINK_LIBRARIES?
> > 
> > 
> 
> You lost me....
> 
> 
> Where are the symbols defined that you are not finding?
> 
> Also, please try make VERBOSE=1 to see the link line being used.  Also, 
> you will want to use nm and grep to find out where the symbols should be 
> found.
> 
> -Bill
> 

ok, here is main CMakeList.txt:
cmake_minimum_required(VERSION 2.6)
PROJECT(AgathaHud)

#if you don't want the full compiler output, remove the following line
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/libs)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
find_package(Poco REQUIRED)
find_package(ARToolKit REQUIRED)
find_package(OpenCV REQUIRED)

SUBDIRS(src)

here is the second CMakeList.txt file which is in the src folder:
#this is just a basic CMakeLists.txt, for more information see the cmake manpage

#add definitions, compiler switches, etc.
ADD_DEFINITIONS(-Wall -O2)

#get all cpp files in libs
file(GLOB UTILS_CPP Utils/*.cpp)
file(GLOB THRDS_CPP Threads/*.cpp)
file(GLOB ENGINE_CPP Engine/*.cpp)

#build a shared library
ADD_LIBRARY(AgathaUtils SHARED ${UTILS_CPP}) #Utils/CAppLogger.cpp Utils/CConfigXmlHandler.cpp Utils/CInfoCenter.cpp Utils/CInfoContainer.cpp Utils/CMsg.cpp Utils/CThreadsPool.cpp Utils/CConfigCreator.cpp) 
ADD_LIBRARY(AgathaEngine SHARED ${THRDS_CPP}) #Threads/CCaptThrd.cpp Threads/CComputeThrd.cpp Threads/CLogMsgThrd.cpp Threads/CExtrapulateThrd.cpp)
ADD_LIBRARY(AgathaThreads SHARED ${ENGINE_CPP}) #Engine/CEngine.cpp)

#list all source files here
ADD_EXECUTABLE(AgathaHud CAgathaHud.cpp)

add_dependencies (AgathaHud AgathaUtils AgathaEngine AgathaThreads)

#need to link to some other libraries
TARGET_LINK_LIBRARIES(AgathaHud AgathaUtils AgathaEngine AgathaThreads)
#  				cv
#                                 PocoXML
#                                 PocoFoundation
#                                 AR
#                                 ARMulti
#                                 ARvideo

#add an install target here
#INSTALL_FILES(...)
#INSTALL_PROGRAMS(...)
#INSTALL_TARGET(...)





More information about the CMake mailing list