# cli
include_directories(${MonkeyCAM_SOURCE_DIR}/util)
include_directories(${MonkeyCAM_SOURCE_DIR}/core)
if(UNIX)
  include_directories(/opt/local/include) # For boost
  set(CMAKE_CXX_FLAGS "-g -Wall -Werror -std=c++11")
elseif(MINGW)
  include_directories(../../boost_1_55_0)
  set(CMAKE_CXX_FLAGS "-g -Werror -std=c++11") # NB Boost warnings with GCC
endif(UNIX)

link_directories(${MonkeyCAM_BINARY_DIR}/util)
link_directories(${MonkeyCAM_BINARY_DIR}/core)
link_directories(${MonkeyCAM_BINARY_DIR}/clipper)

add_executable(MonkeyCAM
               monkey-cam.cpp
               )

target_link_libraries(MonkeyCAM util core clipper)

install(CODE "
  message(\"Signing ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM...\")
  execute_process(
    COMMAND codesign -s \"Developer ID Application\" ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM
  )
  message(\"Verifying ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM...\")
  execute_process(
    COMMAND codesign --display --verbose=4 ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM
  )
  message(\"Done signing.\")
")

install(TARGETS MonkeyCAM DESTINATION bin/MacOS)

# cli
include_directories(${MonkeyCAM_SOURCE_DIR}/util)
include_directories(${MonkeyCAM_SOURCE_DIR}/core)
if(UNIX)
  include_directories(/opt/local/include) # For boost
  set(CMAKE_CXX_FLAGS "-g -Wall -Werror -std=c++11")
elseif(MINGW)
  include_directories(../../boost_1_55_0)
  set(CMAKE_CXX_FLAGS "-g -Werror -std=c++11") # NB Boost warnings with GCC
endif(UNIX)

link_directories(${MonkeyCAM_BINARY_DIR}/util)
link_directories(${MonkeyCAM_BINARY_DIR}/core)
link_directories(${MonkeyCAM_BINARY_DIR}/clipper)

add_executable(MonkeyCAM
               monkey-cam.cpp
               )

target_link_libraries(MonkeyCAM core clipper util)

install(CODE "
  message(\"Signing ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM...\")
  execute_process(
    COMMAND codesign -s \"Developer ID Application\" ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM
  )
  message(\"Verifying ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM...\")
  execute_process(
    COMMAND codesign --display --verbose=4 ${CMAKE_CURRENT_BINARY_DIR}/MonkeyCAM
  )
  message(\"Done signing.\")
")

install(TARGETS MonkeyCAM DESTINATION bin/MacOS)

Fix link order for GCC MinGW build
Fix link order for GCC MinGW build

Holy crap, the order of the libs in the target_link_libraries() directive matters for GCC in MinGW.
