我使用cmake(winxp sp3,cmake 2.8.4)将SDL链接到我的应用程序。
cmake_minimum_required(VERSION 2.8)
find_package(SDL REQUIRED)
set(src WIN32 main.cpp)
include_directories(${QT_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${SDL_INCLUDE_DIR})
add_executable(test ${src})
target_link_libraries(test ${SDL_LIBRARY})
问题:SDL_LIBRARY包含SDLmain.lib,我需要避免与它链接(我已经有一个其他库包含main但在此cmakelists.txt示例中未提及)。
我需要从SDL_LIBRARY中删除SDLmain条目。这必须在不使用库的硬编码路径的情况下完成 - 基本上我需要继续使用find_package来设置与sdl相关的变量,但我必须确保SDLmain不在SDL_LIBRARY中。另外,我正在使用没有字符串(FIND)的cmake 2.8.4。
我该怎么做?
答案 0 :(得分:2)
这有帮助吗?
FindSDL.cmake
:
# This module responds to the the flag:
# SDL_BUILDING_LIBRARY
# If this is defined, then no SDL_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL_LIBRARY variable.