Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Cmake build for Mac OS X  (Read 1762 times)

0 Members and 1 Guest are viewing this topic.

Nikola

  • Newbie
  • *
  • Posts: 1
    • View Profile
Cmake build for Mac OS X
« on: December 27, 2015, 05:50:21 pm »
Hello!

I'm working on transitioning my build workflow away from Xcode (6.x) to Cmake and the command line with an eye towards cross-platform builds.

I've managed to get my cmake generated make file to build, but it produces an executable that's missing my resources.  I need help modifying my existing CMakeLists.txt file to build mac os x bundles (*.app), currently I'm only able to do this via Xcode.

Here's my current CmakeLists.txt

cmake_minimum_required(VERSION 3.2.2)
project(aegis CXX)

include_directories(include)

file(GLOB SOURCES "source/*.*")
file(GLOB_RECURSE RESOURCES RELATIVE resources/ *.*)

# Define sources and executable
set(EXECUTABLE_NAME "aegis")
add_executable(${EXECUTABLE_NAME} ${SOURCES})

# Detect and add SFML
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

#Find any version 2.X of SFML
#See the FindSFML.cmake file for additional details and instructions
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
  include_directories(${SFML_INCLUDE_DIR})
  target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()

target_compile_features(aegis PRIVATE cxx_range_for)

I've done some research into Cpack and BundleUtilities, but I'm not sure if either are required.  I'm looking for the most transparent straightforward solution, once I figure this first step out I'll move towards a more robust build.

Thanks in advance.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Cmake build for Mac OS X
« Reply #1 on: December 29, 2015, 07:39:25 pm »
Look into the Cocoa example. It does what you want.
SFML / OS X developer

 

anything