#include path
include_directories(
${PROJECT_SOURCE_DIR}/include
${HGE_INCLUDE_DIR}
${IKL_INCLUDE_DIR}
${BOOST_DIRECTORY}
)
#include all files
FILE(GLOB CORE_SRCS source/core/*.cpp)
FILE(GLOB TOOL_SRCS source/tools/*.cpp)
FILE(GLOB GAME_SRCS source/game/*.cpp)
#Making a compiled library
add_library(GAMECORE_LIBRARY ${CORE_SRCS} ${HGE_LIBRARY} ${HGE_HELPER_LIBRARY})
#add executable
add_executable(DemoGame ${GAME_SRCS})
##link executable to HGE lib
TARGET_LINK_LIBRARIES(DemoGame ${HGE_LIBRARY} ${HGE_HELPER_LIBRARY} ${IKL_LIBRARY} GAMECORE_LIBRARY)
if(BUILD_TOOLS)
add_executable(EntityTool ${TOOL_SRCS})
TARGET_LINK_LIBRARIES(EntityTool ${HGE_LIBRARY} ${HGE_HELPER_LIBRARY} ${IKL_LIBRARY} GAMECORE_LIBRARY)
endif(BUILD_TOOLS)
这是我目前的 cmake ..
我收到 hgeGUI 类的奇怪链接器错误,
例如:DemoGame/source/core/GameMainMenu.cpp:74: undefined reference to `hgeGUI::hgeGUI()'
这只发生在我尝试将核心文件编译成静态库时。当我使用 CORE_SRCS 添加可执行文件并删除对当前编译库的依赖项时..它将正常工作..
我还尝试将 hgegui.cpp 文件复制粘贴到我的核心源目录中..并将其更改#include "..\..\include\hgegui.h"
为#include "hgegui.h"
之后我的链接器代码解决了这个问题,但我得到了分段错误,但我猜在上一步中链接文件是不正确的..
这是他们的 .h 文件的链接
http://trac.assembla.com/snowscape/browser/hge/include/hgegui.h