Cmake + sdl - disable sdlmain
I will link SDL to my application using cmake (winxp sp3, cmake 2.8.4).
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})
Problem: SDL_LIBRARY contains SDLmain.lib and I need to avoid linking to it (I already have one other library that contains the main one, but cmakelists.txt is not mentioned in this example).
I need to remove the SDLmain entry from SDL_LIBRARY. This needs to be done without using hardcoded library paths - basically I need to keep using find_package to set up sdl-related variables, but I need to make sure SDLmain is not in SDL_LIBRARY. Also, I am using cmake 2.8.4 which has no line (FIND).
How can i do this?
+3
source to share
1 answer
Does it help?
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.
+1
source to share