I try to build progect. When I make ./build.sh -arch x64 I get a linking error:
Linking CXX shared library /home/buzanova/gmat/application/bin/libGmatBase.so
[72%] Built target GmatBase
Linking CXX executable /home/buzanova/gmat/application/bin/gmatConsole
/home/buzanova/gmat/application/bin/libGmatBase.so.R2013a: undefined reference to DelaL::DelaL(std::string const&, GmatBase*)
etc.....
My CMakeFile.txt contain
if (UNIX)
MESSAGE("-- Using a shared base library")
IF(APPLE) # mac
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -dylib -dynamiclib -two_levelnamespace -undefined dynamic_lookup")
# snow leopard
#SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -arch i386")
endif()
endif (UNIX)
INCLUDE_DIRECTORIES("./include")
INCLUDE_DIRECTORIES("./foundation")
INCLUDE_DIRECTORIES("./hardware")
etc......
SET(BASE_SRCS
asset/AssetException.cpp
asset/BodyFixedPoint.cpp
asset/GroundstationInterface.cpp
etc...
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../application/bin")
ADD_LIBRARY(${TargetName} SHARED ${BASE_SRCS})
How can I fix it?
for static libraries you need to add some linker flags:
Here's an example( assume that dir myLib is ins the same directory as the makefile):