hedgewars/CMakeLists.txt
changeset 7708 95de696e4711
parent 7706 19ade14ecc29
child 7718 97ba379164ec
equal deleted inserted replaced
7707:e7e7b2082f44 7708:95de696e4711
   125 
   125 
   126     if(powerpc_build)
   126     if(powerpc_build)
   127         set(powerpc_build "powerpc")
   127         set(powerpc_build "powerpc")
   128     endif()
   128     endif()
   129 
   129 
   130     #on OSX we need to provide the main() function when building as executable
   130     #on OSX we need to provide the SDL_main() function when building as executable
   131     if(NOT BUILD_ENGINE_LIBRARY)
   131     if(NOT BUILD_ENGINE_LIBRARY)
   132         #let's look for the bundled sdlmain, if not found build our own
   132         #let's look for the installed sdlmain file; if it is not found, let's build our own
   133         find_package(SDL REQUIRED)
   133         find_package(SDL REQUIRED)
   134         #remove the ";-framework Cocoa" from the SDL_LIBRARY variable
   134         #remove the ";-framework Cocoa" from the SDL_LIBRARY variable
   135         string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}")
   135         string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}")
   136         #find libsdmain.a
   136         #find libsdmain.a
   137         find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_dir}/Resources/)
   137         find_file(SDLMAIN_LIB libSDLMain.a PATHS ${sdl_dir}/Resources/)
   138 
   138 
   139         if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND")
   139         if(SDLMAIN_LIB MATCHES "SDLMAIN_LIB-NOTFOUND")
   140             set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
   140             set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
   141             include_directories(${SDL_INCLUDE_DIR})
   141             include_directories(${SDL_INCLUDE_DIR})
   142             add_library (SDLmain STATIC SDLMain.m)
   142             add_library (SDLmain STATIC SDLMain.m)
   143             #add a dependency to the hwengine target
   143             #add a dependency to the hwengine target
   144             set(engine_sources ${engine_sources} SDLmain)
   144             set(engine_sources ${engine_sources} SDLmain)
   145             set(SDLMAIN_LIB "${CMAKE_BINARY_DIR}/bin/libSDLmain.a")
   145             set(SDLMAIN_LIB "${LIBRARY_OUTPUT_PATH}/libSDLmain.a")
   146         endif()
   146         endif()
   147 
   147 
   148         set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags})
   148         set(pascal_flags "-k${SDLMAIN_LIB}" ${pascal_flags})
   149     endif()
   149     endif()
   150 endif(APPLE)
   150 endif(APPLE)